:root {
    --nx-bg: #05070f;
    --nx-bg-2: #0b1220;
    --nx-surface: rgba(14, 22, 42, 0.78);
    --nx-surface-2: rgba(20, 30, 56, 0.9);
    --nx-line: rgba(125, 211, 252, 0.16);
    --nx-text: #e8eefc;
    --nx-muted: #8ea0bf;
    --nx-cyan: #22d3ee;
    --nx-violet: #818cf8;
    --nx-ok: #34d399;
    --nx-danger: #fb7185;
    --nx-glow: rgba(34, 211, 238, 0.28);
    --nx-radius: 16px;
    --nx-sidebar: 272px;
}

* { box-sizing: border-box; }

html, body.theme-nexus {
    min-height: 100%;
    background: var(--nx-bg);
    color: var(--nx-text);
    font-family: "Outfit", "Segoe UI", sans-serif;
}

body.theme-nexus {
    background-image:
        radial-gradient(1200px 500px at 10% -10%, rgba(34, 211, 238, 0.16), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgba(129, 140, 248, 0.18), transparent 50%),
        radial-gradient(700px 500px at 80% 100%, rgba(14, 165, 233, 0.08), transparent 55%),
        linear-gradient(transparent 23px, rgba(125, 211, 252, 0.035) 24px),
        linear-gradient(90deg, transparent 23px, rgba(125, 211, 252, 0.035) 24px);
    background-size: auto, auto, auto, 24px 24px, 24px 24px;
    background-attachment: fixed;
}

.theme-nexus ::selection {
    background: rgba(34, 211, 238, 0.28);
    color: #fff;
}

.nx-shell { min-height: 100vh; display: flex; }
.nx-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(2, 6, 18, 0.62);
    backdrop-filter: blur(6px);
    z-index: 30;
}
.sidebar-open .nx-overlay { display: block; }

.nx-sidebar {
    width: var(--nx-sidebar);
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(10, 16, 32, 0.92), rgba(7, 11, 22, 0.96));
    border-right: 1px solid var(--nx-line);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.25);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    z-index: 40;
    display: flex;
    flex-direction: column;
}
.nx-brand {
    padding: 1.25rem 1.2rem 1rem;
    border-bottom: 1px solid var(--nx-line);
    display: flex;
    gap: 0.85rem;
    align-items: center;
}
.nx-mark {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(129, 140, 248, 0.25));
    border: 1px solid rgba(34, 211, 238, 0.35);
    box-shadow: 0 0 24px var(--nx-glow);
    color: var(--nx-cyan);
}
.nx-brand h1 {
    font-family: "Syne", sans-serif;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0;
}
.nx-brand p {
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    color: var(--nx-muted);
}
.nx-nav {
    padding: 1rem 0.85rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}
.nx-nav::-webkit-scrollbar { width: 8px; }
.nx-nav::-webkit-scrollbar-thumb {
    background: rgba(125, 211, 252, 0.18);
    border-radius: 99px;
}

.nav-section {
    margin: 1.1rem 0.75rem 0.45rem;
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6d7f9e;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.58rem 0.8rem;
    border-radius: 11px;
    color: #c3d0ea;
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid transparent;
    transition: 0.18s ease;
}
.nav-link svg { width: 16px; height: 16px; opacity: 0.8; flex-shrink: 0; }
.nav-link:hover {
    background: rgba(34, 211, 238, 0.08);
    color: #fff;
}
.nav-link.is-active {
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.16), rgba(129, 140, 248, 0.1));
    border-color: rgba(34, 211, 238, 0.28);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.08), 0 0 18px rgba(34, 211, 238, 0.08);
}
.nav-link.is-active svg { opacity: 1; color: var(--nx-cyan); }
.nav-link.nav-exit {
    margin-top: 1rem;
    color: #fda4af;
    background: rgba(244, 63, 94, 0.08);
}
.nav-link.nav-exit:hover { background: rgba(244, 63, 94, 0.16); color: #fecdd3; }

.nx-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.nx-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.4rem;
    background: rgba(5, 7, 15, 0.72);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--nx-line);
}
.nx-topbar-title {
    font-family: "Syne", sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--nx-muted);
}
.nx-chip {
    font-size: 0.75rem;
    color: #b7f0f9;
    border: 1px solid rgba(34, 211, 238, 0.28);
    background: rgba(34, 211, 238, 0.08);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
}
.nx-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.nx-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 38px;
    padding: 0 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--nx-line);
    background: rgba(14, 22, 42, 0.72);
    color: var(--nx-text);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    transition: 0.18s ease;
}
.nx-theme-toggle svg { width: 16px; height: 16px; }
.nx-theme-toggle:hover {
    border-color: rgba(34, 211, 238, 0.45);
    box-shadow: 0 0 16px var(--nx-glow);
}
.nx-theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .nx-theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .nx-theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .nx-theme-toggle .icon-moon { display: block; }
.nx-theme-float {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 50;
}
.nx-burger {
    display: none;
    width: 42px; height: 42px;
    border-radius: 12px;
    border: 1px solid var(--nx-line);
    background: rgba(14, 22, 42, 0.8);
    color: #fff;
    cursor: pointer;
}
.nx-content { padding: 1.5rem 1.5rem 2.5rem; }

.theme-nexus .bg-white {
    background: linear-gradient(180deg, rgba(18, 26, 48, 0.86), rgba(10, 16, 32, 0.82)) !important;
    border: 1px solid var(--nx-line) !important;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28) !important;
    color: var(--nx-text);
    backdrop-filter: blur(18px);
}
.theme-nexus .bg-gray-100 { background: transparent !important; }
.theme-nexus .text-gray-900,
.theme-nexus .text-gray-800 { color: var(--nx-text) !important; }
.theme-nexus .text-gray-500,
.theme-nexus .text-gray-600,
.theme-nexus .text-gray-700 { color: var(--nx-muted) !important; }
.theme-nexus .border,
.theme-nexus .border-b,
.theme-nexus .border-r { border-color: var(--nx-line) !important; }
.theme-nexus .shadow { box-shadow: none !important; }
.theme-nexus .rounded { border-radius: var(--nx-radius) !important; }

.theme-nexus h1.text-2xl,
.theme-nexus .nx-content > h1,
.theme-nexus .nx-content > .flex h1 {
    font-family: "Syne", sans-serif;
    letter-spacing: -0.03em;
    background: linear-gradient(90deg, #f8fbff 20%, #67e8f9 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.theme-nexus input,
.theme-nexus select,
.theme-nexus textarea {
    background: rgba(5, 10, 24, 0.72) !important;
    border: 1px solid rgba(125, 211, 252, 0.22) !important;
    color: var(--nx-text) !important;
    border-radius: 12px !important;
}
.theme-nexus input:focus,
.theme-nexus select:focus,
.theme-nexus textarea:focus {
    outline: none;
    border-color: var(--nx-cyan) !important;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
}
.theme-nexus option { background: #0b1220; color: #e8eefc; }

.theme-nexus .bg-blue-600,
.theme-nexus button.bg-blue-600,
.theme-nexus a.bg-blue-600 {
    background: linear-gradient(135deg, #22d3ee, #6366f1) !important;
    border: 0;
    box-shadow: 0 10px 24px rgba(34, 211, 238, 0.22);
    font-weight: 600;
}
.theme-nexus .hover\:bg-blue-700:hover { filter: brightness(1.08); }
.theme-nexus .bg-green-600 {
    background: linear-gradient(135deg, #10b981, #0f766e) !important;
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.2);
}
.theme-nexus .bg-gray-700 {
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid var(--nx-line) !important;
    color: #fff !important;
}
.theme-nexus .bg-white.border { color: var(--nx-text); }

.theme-nexus .text-blue-600 { color: #67e8f9 !important; }
.theme-nexus .text-green-700 { color: #6ee7b7 !important; }
.theme-nexus .text-red-600,
.theme-nexus .text-red-700 { color: #fda4af !important; }
.theme-nexus .bg-red-50 { background: rgba(244, 63, 94, 0.1) !important; }
.theme-nexus .hover\:bg-red-100:hover { background: rgba(244, 63, 94, 0.18) !important; }
.theme-nexus .hover\:bg-gray-100:hover,
.theme-nexus .hover\:bg-gray-50:hover { background: rgba(34, 211, 238, 0.08) !important; }

.theme-nexus .bg-red-100 { background: rgba(244, 63, 94, 0.14) !important; }
.theme-nexus .text-red-800 { color: #fecdd3 !important; }
.theme-nexus .bg-green-100 { background: rgba(16, 185, 129, 0.14) !important; }
.theme-nexus .text-green-800 { color: #a7f3d0 !important; }
.theme-nexus .bg-yellow-100 { background: rgba(251, 191, 36, 0.14) !important; }
.theme-nexus .text-yellow-800 { color: #fde68a !important; }

.theme-nexus table { width: 100%; }
.theme-nexus thead th {
    color: #93a4c3;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
}
.theme-nexus tbody tr { transition: background 0.15s ease; }
.theme-nexus tbody tr:hover { background: rgba(34, 211, 238, 0.05); }

.theme-nexus .text-sm.text-red-600 { color: #fda4af !important; }

.theme-nexus input[type="checkbox"],
.theme-nexus input[type="radio"] {
    width: auto !important;
    height: auto !important;
    accent-color: #22d3ee;
    background: transparent !important;
    box-shadow: none !important;
}

.theme-nexus input[type="file"] {
    padding: 0.45rem !important;
}

.theme-nexus form.inline { display: inline; }

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.15rem 1.2rem !important;
}
.stat-card::after {
    content: "";
    position: absolute;
    right: -20px; top: -20px;
    width: 90px; height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--nx-glow), transparent 70%);
    pointer-events: none;
}
.stat-card .stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--nx-muted);
}
.stat-card .stat-value {
    font-family: "Syne", sans-serif;
    font-size: 1.45rem;
    margin-top: 0.35rem;
    color: #f4f8ff;
}

.nx-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    position: relative;
}
.nx-auth-card {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}
.nx-auth-card .bg-white { padding: 1.75rem !important; }
.nx-orbit {
    position: absolute;
    width: 280px; height: 280px;
    border: 1px dashed rgba(34, 211, 238, 0.22);
    border-radius: 50%;
    animation: nx-spin 28s linear infinite;
    pointer-events: none;
}
.nx-orbit.two {
    width: 420px; height: 420px;
    border-color: rgba(129, 140, 248, 0.18);
    animation-duration: 42s;
    animation-direction: reverse;
}
@keyframes nx-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .nx-sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
    }
    .sidebar-open .nx-sidebar { transform: none; }
    .nx-burger { display: grid; place-items: center; }
    .nx-chip { display: none; }
    .nx-theme-label { display: none; }
}

html[data-theme="light"] {
    --nx-bg: #eef3f9;
    --nx-bg-2: #ffffff;
    --nx-surface: rgba(255, 255, 255, 0.9);
    --nx-line: rgba(15, 23, 42, 0.1);
    --nx-text: #0f172a;
    --nx-muted: #5b6b82;
    --nx-cyan: #0284c7;
    --nx-violet: #4f46e5;
    --nx-glow: rgba(14, 165, 233, 0.18);
}

html[data-theme="light"] body.theme-nexus {
    background-color: var(--nx-bg);
    background-image:
        radial-gradient(1000px 420px at 8% -8%, rgba(14, 165, 233, 0.16), transparent 55%),
        radial-gradient(800px 380px at 100% 0%, rgba(99, 102, 241, 0.12), transparent 50%),
        linear-gradient(transparent 23px, rgba(15, 23, 42, 0.035) 24px),
        linear-gradient(90deg, transparent 23px, rgba(15, 23, 42, 0.035) 24px);
    color: var(--nx-text);
}

html[data-theme="light"] .nx-sidebar {
    background: linear-gradient(180deg, #ffffff, #f7faff);
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .nx-topbar {
    background: rgba(238, 243, 249, 0.82);
}

html[data-theme="light"] .nx-mark {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(79, 70, 229, 0.12));
}

html[data-theme="light"] .nav-section { color: #7b8aa3; }
html[data-theme="light"] .nav-link { color: #334155; }
html[data-theme="light"] .nav-link:hover {
    background: rgba(14, 165, 233, 0.08);
    color: #0f172a;
}
html[data-theme="light"] .nav-link.is-active {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(79, 70, 229, 0.08));
    border-color: rgba(14, 165, 233, 0.28);
    color: #0f172a;
    box-shadow: none;
}
html[data-theme="light"] .nav-link.nav-exit {
    color: #be123c;
    background: rgba(244, 63, 94, 0.08);
}

html[data-theme="light"] .nx-chip {
    color: #0369a1;
    border-color: rgba(2, 132, 199, 0.22);
    background: rgba(14, 165, 233, 0.08);
}

html[data-theme="light"] .nx-theme-toggle,
html[data-theme="light"] .nx-burger {
    background: #fff;
    color: #0f172a;
}

html[data-theme="light"] .nx-overlay { background: rgba(15, 23, 42, 0.35); }

html[data-theme="light"] .theme-nexus .bg-white {
    background: #ffffff !important;
    border-color: var(--nx-line) !important;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06) !important;
    color: var(--nx-text);
}

html[data-theme="light"] .theme-nexus h1.text-2xl,
html[data-theme="light"] .theme-nexus .nx-content > h1,
html[data-theme="light"] .theme-nexus .nx-content > .flex h1 {
    background: linear-gradient(90deg, #0f172a 10%, #0284c7 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html[data-theme="light"] .theme-nexus input,
html[data-theme="light"] .theme-nexus select,
html[data-theme="light"] .theme-nexus textarea {
    background: #fff !important;
    border-color: #d5deea !important;
    color: #0f172a !important;
}
html[data-theme="light"] .theme-nexus option { background: #fff; color: #0f172a; }

html[data-theme="light"] .theme-nexus .text-blue-600 { color: #0284c7 !important; }
html[data-theme="light"] .theme-nexus .text-green-700 { color: #047857 !important; }
html[data-theme="light"] .theme-nexus .text-red-600,
html[data-theme="light"] .theme-nexus .text-red-700 { color: #e11d48 !important; }
html[data-theme="light"] .theme-nexus thead th { color: #64748b; }
html[data-theme="light"] .theme-nexus tbody tr:hover { background: rgba(14, 165, 233, 0.05); }
html[data-theme="light"] .stat-card .stat-value { color: #0f172a; }
html[data-theme="light"] .nx-orbit { border-color: rgba(2, 132, 199, 0.22); }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="light"] .theme-nexus .bg-red-100 { background: #ffe4e6 !important; }
html[data-theme="light"] .theme-nexus .text-red-800 { color: #9f1239 !important; }
html[data-theme="light"] .theme-nexus .bg-green-100 { background: #d1fae5 !important; }
html[data-theme="light"] .theme-nexus .text-green-800 { color: #065f46 !important; }
html[data-theme="light"] .theme-nexus .bg-yellow-100 { background: #fef3c7 !important; }
html[data-theme="light"] .theme-nexus .text-yellow-800 { color: #92400e !important; }
html[data-theme="light"] .theme-nexus .bg-gray-700 {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
html[data-theme="light"] .theme-nexus input[type="checkbox"],
html[data-theme="light"] .theme-nexus input[type="radio"] {
    accent-color: #0284c7;
}

