:root {
    --nexus-bg: #f4f7fb;
    --nexus-surface: #ffffff;
    --nexus-surface-soft: #f9fbff;
    --nexus-sidebar: #e7edf8;
    --nexus-border: #d7deea;
    --nexus-text: #2f3441;
    --nexus-muted: #6f7788;
    --nexus-primary: #8a97c9;
    --nexus-primary-strong: #7583b8;
    --nexus-primary-soft: #eef1fb;
    --nexus-success: #7fae9a;
    --nexus-warning: #c9a676;
    --nexus-danger: #c68d97;
    --nexus-shadow: 0 6px 18px rgba(43, 58, 91, 0.06);
}

html, body {
    min-height: 100%;
}

body.nexus-body {
    margin: 0;
    background: var(--nexus-bg);
    color: var(--nexus-text);
}

.nexus-app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.nexus-sidebar {
    background: var(--nexus-sidebar);
    border-right: 1px solid var(--nexus-border);
    padding: 20px;
}

.nexus-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--nexus-border);
}

.nexus-brand h1 {
    margin: 0;
    font-size: 1.25rem;
}

.nexus-brand p {
    margin: 2px 0 0;
    color: var(--nexus-muted);
    font-size: 0.8rem;
}

.nexus-brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--nexus-primary-soft);
    color: var(--nexus-primary-strong);
    border: 1px solid var(--nexus-border);
}

.nexus-nav-group + .nexus-nav-group {
    margin-top: 18px;
}

.nexus-nav-title {
    color: var(--nexus-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-bottom: 8px;
}

.nexus-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--nexus-text);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    border: 1px solid transparent;
}

.nexus-nav-link:hover,
.nexus-nav-link.active {
    background: #f7f9fe;
    border-color: #cbd6ea;
    color: var(--nexus-primary-strong);
    text-decoration: none;
}

.nexus-main {
    min-width: 0;
}

.nexus-topbar-shell {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.nexus-topbar-meta,
.nexus-topbar-work {
    background: var(--nexus-sidebar);
    border-bottom: 1px solid var(--nexus-border);
}

.nexus-topbar-meta {
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nexus-topbar-work {
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.nexus-topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nexus-top-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f8fbff;
    border: 1px solid var(--nexus-border);
    border-radius: 4px;
    color: #566074;
    font-size: 0.75rem;
    font-weight: 600;
}

.nexus-top-pill-brand {
    background: var(--nexus-primary-soft);
    color: var(--nexus-primary-strong);
}

.nexus-page-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.nexus-page-description {
    margin: 4px 0 0;
    color: var(--nexus-muted);
}

.nexus-content {
    padding: 20px;
}

.nexus-alert {
    border-radius: 6px;
}

.nexus-kpi-card {
    min-height: 175px;
}

.nexus-kpi-value {
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 800;
    margin-top: 12px;
}

.nexus-kpi-value-small {
    font-size: 1.35rem;
}

.nexus-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--nexus-border);
    font-size: 0.72rem;
    font-weight: 700;
}

.nexus-chip-info {
    background: var(--nexus-primary-soft);
    color: var(--nexus-primary-strong);
}

.nexus-chip-success {
    background: #eff7f3;
    color: #5f8f7a;
}

.nexus-chip-warning {
    background: #fff7ee;
    color: #ad8654;
}

.nexus-chip-danger {
    background: #fbf0f3;
    color: #b0737e;
}

.nexus-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.nexus-outline-box {
    border: 1px solid var(--nexus-border);
    border-radius: 6px;
    background: var(--nexus-surface-soft);
    padding: 14px;
    height: 100%;
}

.nexus-outline-box h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.nexus-field-hint,
.nexus-login-note,
.nexus-feature-list li,
.nexus-permission-list {
    color: var(--nexus-muted);
}

.nexus-login-card {
    margin-top: 48px;
    border-radius: 8px;
    border: 1px solid var(--nexus-border);
    box-shadow: var(--nexus-shadow);
}

.nexus-login-badge {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--nexus-border);
    background: var(--nexus-surface);
    padding: 6px 10px;
    border-radius: 4px;
    color: var(--nexus-primary-strong);
    font-weight: 700;
    font-size: 0.75rem;
}

.nexus-auth-shell {
    padding-top: 36px;
    padding-bottom: 36px;
}

.nexus-error-card {
    max-width: 760px;
    margin: 48px auto 0;
    text-align: center;
    border-radius: 8px;
    box-shadow: var(--nexus-shadow);
}

.nexus-error-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--nexus-primary-soft);
    color: var(--nexus-primary-strong);
    font-size: 1.3rem;
    border: 1px solid var(--nexus-border);
}

.nexus-error-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.nexus-debug-box {
    margin-top: 20px;
    padding: 14px;
    text-align: left;
    background: #f7f9fe;
    border: 1px solid var(--nexus-border);
    border-radius: 6px;
    overflow: auto;
    font-size: 0.8rem;
    line-height: 1.4;
}

.nexus-permission-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

@media (max-width: 960px) {
    .nexus-app {
        grid-template-columns: 1fr;
    }

    .nexus-sidebar {
        order: 2;
    }

    .nexus-topbar-work {
        flex-direction: column;
        align-items: flex-start;
    }
}
