/* Nexus Control — Layout */

/* ── App shell ──────────────────────────────────────────────────────── */
#nxctl-portal .nc-app {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
#nxctl-portal .nc-sidebar {
    width: var(--nc-sidebar-w);
    height: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--nc-sidebar-bg);
    border-right: 1px solid var(--nc-border);
    transition: width var(--nc-dur-md) var(--nc-ease);
    overflow: hidden;
    z-index: 100;
    position: relative;
}

#nxctl-portal.nc-sidebar-collapsed .nc-sidebar {
    width: var(--nc-sidebar-w-col);
}

#nxctl-portal .nc-sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--nc-space-3);
    padding: var(--nc-space-4) var(--nc-space-4);
    height: var(--nc-topbar-h);
    border-bottom: 1px solid var(--nc-border);
    overflow: hidden;
    flex-shrink: 0;
}

#nxctl-portal .nc-sidebar__logo {
    width: 32px;
    height: 32px;
    border-radius: var(--nc-radius);
    background: var(--nc-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 800;
    font-size: var(--nc-fs-md);
    color: #fff;
    letter-spacing: -0.02em;
}

#nxctl-portal .nc-sidebar__title {
    font-size: var(--nc-fs-sm);
    font-weight: 700;
    color: var(--nc-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--nc-dur) var(--nc-ease), width var(--nc-dur) var(--nc-ease);
}

#nxctl-portal.nc-sidebar-collapsed .nc-sidebar__title { opacity: 0; width: 0; }

/* Navigation */
#nxctl-portal .nc-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--nc-space-2) 0;
}

#nxctl-portal .nc-nav__section {
    padding: var(--nc-space-3) var(--nc-space-3) var(--nc-space-1);
}

#nxctl-portal .nc-nav__section-label {
    font-size: var(--nc-fs-xs);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--nc-muted);
    white-space: nowrap;
    transition: opacity var(--nc-dur);
}

#nxctl-portal.nc-sidebar-collapsed .nc-nav__section-label { opacity: 0; }

#nxctl-portal .nc-nav__item {
    display: flex;
    align-items: center;
    gap: var(--nc-space-3);
    padding: 9px var(--nc-space-4);
    margin: 1px var(--nc-space-2);
    border-radius: var(--nc-radius);
    cursor: pointer;
    transition: background var(--nc-dur), color var(--nc-dur);
    white-space: nowrap;
    overflow: hidden;
    color: var(--nc-muted);
    font-size: var(--nc-fs-base);
    font-weight: 500;
    position: relative;
}

#nxctl-portal .nc-nav__item:hover {
    background: var(--nc-hover);
    color: var(--nc-text);
}

#nxctl-portal .nc-nav__item.active {
    background: var(--nc-accent-dim);
    color: var(--nc-accent);
    font-weight: 600;
}

#nxctl-portal .nc-nav__item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--nc-accent);
    border-radius: 0 3px 3px 0;
}

#nxctl-portal .nc-nav__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.75;
}

#nxctl-portal .nc-nav__label {
    transition: opacity var(--nc-dur), width var(--nc-dur);
    overflow: hidden;
}

#nxctl-portal.nc-sidebar-collapsed .nc-nav__label { opacity: 0; width: 0; }

#nxctl-portal .nc-nav__badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--nc-radius-full);
    background: var(--nc-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity var(--nc-dur);
}

#nxctl-portal.nc-sidebar-collapsed .nc-nav__badge { opacity: 0; }

/* Collapse toggle button */
#nxctl-portal .nc-sidebar__collapse {
    padding: var(--nc-space-3) var(--nc-space-4);
    border-top: 1px solid var(--nc-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

#nxctl-portal.nc-sidebar-collapsed .nc-sidebar__collapse {
    justify-content: center;
}

#nxctl-portal .nc-collapse-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--nc-radius);
    background: var(--nc-surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--nc-dur), transform var(--nc-dur);
    color: var(--nc-muted);
}

#nxctl-portal .nc-collapse-btn:hover { background: var(--nc-hover); color: var(--nc-text); }
#nxctl-portal.nc-sidebar-collapsed .nc-collapse-btn { transform: rotate(180deg); }

/* ── Topbar ───────────────────────────────────────────────────────────── */
#nxctl-portal .nc-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#nxctl-portal .nc-topbar {
    height: var(--nc-topbar-h);
    display: flex;
    align-items: center;
    gap: var(--nc-space-3);
    padding: 0 var(--nc-space-5);
    border-bottom: 1px solid var(--nc-border);
    background: var(--nc-topbar-bg);
    flex-shrink: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#nxctl-portal .nc-topbar__breadcrumb {
    flex: 1;
    font-size: var(--nc-fs-md);
    font-weight: 600;
    color: var(--nc-text);
}

#nxctl-portal .nc-topbar__actions {
    display: flex;
    align-items: center;
    gap: var(--nc-space-2);
}

#nxctl-portal .nc-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--nc-radius);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--nc-dur);
    color: var(--nc-muted);
    position: relative;
    flex-shrink: 0;
}
#nxctl-portal .nc-icon-btn:hover { background: var(--nc-hover); color: var(--nc-text); }

#nxctl-portal .nc-bell-count {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: var(--nc-radius-full);
    background: var(--nc-accent);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transform: scale(0);
    transition: transform .15s var(--nc-ease);
}
#nxctl-portal .nc-bell-count.visible { transform: scale(1); }

#nxctl-portal .nc-user-pill {
    display: flex;
    align-items: center;
    gap: var(--nc-space-2);
    padding: var(--nc-space-1) var(--nc-space-2);
    border-radius: var(--nc-radius-full);
    cursor: pointer;
    transition: background var(--nc-dur);
}
#nxctl-portal .nc-user-pill:hover { background: var(--nc-hover); }

#nxctl-portal .nc-avatar {
    width: 28px; height: 28px;
    border-radius: var(--nc-radius-full);
    background: var(--nc-accent);
    color: #fff;
    font-size: var(--nc-fs-xs);
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
#nxctl-portal .nc-avatar img { width: 100%; height: 100%; object-fit: cover; }

#nxctl-portal .nc-user-name {
    font-size: var(--nc-fs-sm);
    font-weight: 600;
    color: var(--nc-text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Main content area ───────────────────────────────────────────────── */
#nxctl-portal .nc-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--nc-space-6);
}

/* Section visibility — controlled by JS router */
#nxctl-portal .nc-section {
    display: none;
    animation: ncFadeIn .2s var(--nc-ease);
}
#nxctl-portal .nc-section.active { display: block; }

@keyframes ncFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Inbox drawer ────────────────────────────────────────────────────── */
#nxctl-portal .nc-inbox-drawer {
    position: absolute;
    top: var(--nc-topbar-h);
    right: 0;
    width: 360px;
    max-width: 90vw;
    height: calc(100% - var(--nc-topbar-h));
    background: var(--nc-surface);
    border-left: 1px solid var(--nc-border);
    box-shadow: var(--nc-shadow-xl);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--nc-dur-md) var(--nc-ease);
}
#nxctl-portal .nc-inbox-drawer.open { transform: translateX(0); }

#nxctl-portal .nc-inbox-header {
    padding: var(--nc-space-4) var(--nc-space-5);
    border-bottom: 1px solid var(--nc-border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-size: var(--nc-fs-md);
}

#nxctl-portal .nc-inbox-list {
    flex: 1; overflow-y: auto; padding: var(--nc-space-2) 0;
}

#nxctl-portal .nc-inbox-item {
    padding: var(--nc-space-3) var(--nc-space-5);
    border-bottom: 1px solid var(--nc-border);
    cursor: pointer;
    transition: background var(--nc-dur);
}
#nxctl-portal .nc-inbox-item:hover { background: var(--nc-hover); }
#nxctl-portal .nc-inbox-item.unread { background: var(--nc-accent-dim); }
#nxctl-portal .nc-inbox-item__subject { font-weight: 600; font-size: var(--nc-fs-sm); color: var(--nc-text); }
#nxctl-portal .nc-inbox-item__preview { font-size: var(--nc-fs-xs); color: var(--nc-muted); margin-top: 2px; }
#nxctl-portal .nc-inbox-item__time { font-size: var(--nc-fs-xs); color: var(--nc-muted); margin-top: 3px; }

/* Mobile hamburger */
#nxctl-portal .nc-hamburger {
    display: none;
    width: 36px; height: 36px;
    align-items: center; justify-content: center;
    border-radius: var(--nc-radius);
    cursor: pointer;
    color: var(--nc-text);
}

/* Mobile sidebar overlay */
#nxctl-portal .nc-sidebar-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}
