/* ═══════════════════════════════════════════════════════════
   SIDEBAR LAYOUT
═══════════════════════════════════════════════════════════ */
#page-app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform .25s ease;
    overflow: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 1.1rem 1.1rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-logo .logo-icon { font-size: 1.4rem; }
.sidebar-logo .logo-img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; }
.sidebar-logo .logo-text { font-size: 1.05rem; font-weight: 700; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .6rem 0 1rem;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

.nav-fixed { padding: 0 .75rem; }
.nav-sep   { height: 1px; background: var(--border); margin: .6rem .75rem; }

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .55rem 1.1rem .3rem;
    cursor: pointer;
    user-select: none;
}

.nav-section-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--text-dim);
    text-transform: uppercase;
}

.nav-chevron {
    font-size: .65rem;
    color: var(--text-dim);
    transition: transform .2s;
    line-height: 1;
}
.nav-chevron.open { transform: rotate(180deg); }

.nav-section-items {
    overflow: hidden;
    max-height: 500px;
    transition: max-height .25s ease, opacity .2s;
    opacity: 1;
    padding: 0 .75rem;
}
.nav-section-items.collapsed { max-height: 0; opacity: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .75rem;
    border-radius: var(--radius);
    color: var(--text-sub);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
    margin-bottom: 1px;
}
.nav-item:hover  { background: var(--bg-4); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }

.nav-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .6;
}
.nav-icon svg { width: 16px; height: 16px; display: block; }
.nav-item.active .nav-icon,
.nav-item:hover  .nav-icon { opacity: 1; }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
}

.user-info { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }

.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700; color: #fff; flex-shrink: 0;
}

.user-details { min-width: 0; }
.user-name { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .7rem; color: var(--text-dim); }

.btn-logout {
    background: none;
    border: 1px solid var(--border-mid);
    color: var(--text-sub);
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.btn-logout:hover { background: rgba(239,68,68,.12); color: var(--red); border-color: rgba(239,68,68,.3); }

.hamburger {
    display: none;
    position: fixed;
    top: .75rem; left: .75rem;
    z-index: 200;
    background: var(--bg-2);
    border: 1px solid var(--border-mid);
    color: var(--text);
    width: 36px; height: 36px;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    align-items: center; justify-content: center;
}
.sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99;
}

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
    background: var(--bg);
}

.content-section { display: none; }
.content-section.active { display: block; }

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.02em;
    flex: 1;
}
.page-sub { color: var(--text-sub); font-size: .9rem; width: 100%; margin-top: -.75rem; }

/* Footer */
.app-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w);
    right: 0;
    padding: .6rem 2rem;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    z-index: 50;
}
.app-footer a {
    color: var(--text-dim);
    font-size: .72rem;
    cursor: pointer;
    text-decoration: none;
    transition: color .15s;
}
.app-footer a:hover { color: var(--text-sub); }

/* Responsive */
@media (max-width: 680px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .hamburger { display: flex; }
    .main-content { margin-left: 0; padding: 1rem; padding-top: 3.5rem; }
    .app-footer { left: 0; padding: .6rem 1rem; }
}
