#globalLoader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg);
    transition: opacity .3s ease;
}
#globalLoader.hide { opacity: 0; pointer-events: none; }
.spinner {
    width: 42px;
    height: 42px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 999px;
    animation: spin .8s linear infinite;
}
.loader-text { color: var(--accent); font-family: var(--font-h); font-size: 1.15rem; }
@keyframes spin { to { transform: rotate(360deg); } }

#topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 200;
    height: var(--topbar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    background: rgba(var(--bg-rgb), .96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}
.brand {
    color: var(--accent);
    font-family: var(--font-h);
    font-size: 1.25rem;
    text-decoration: none;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .82rem;
}
.user-av {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
}
#sidebar {
    position: fixed;
    top: var(--topbar);
    bottom: 0;
    left: 0;
    z-index: 100;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--border);
}
.nav-section { padding: 14px 10px 4px; }
.nav-label {
    margin: 0 0 4px;
    padding: 0 8px;
    color: var(--txt-muted);
    font-size: .62rem;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--txt-muted);
    cursor: pointer;
    font-size: .84rem;
    font-weight: 500;
    text-align: left;
}
.nav-item:hover { background: var(--card); color: var(--txt); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-icon { width: 18px; text-align: center; }
.sidebar-footer {
    margin-top: auto;
    padding: 14px 12px;
    border-top: 1px solid var(--border);
}
.sidebar-footer-label {
    margin-bottom: 4px;
    color: var(--txt-muted);
    font-size: .7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.sidebar-footer-name { font-size: .84rem; font-weight: 600; }
#main {
    min-height: calc(100vh - var(--topbar));
    margin-top: var(--topbar);
    margin-left: var(--sidebar);
    padding: 28px;
}
body.record-mode #topbar,
body.record-mode #sidebar {
    display: none;
}
body.record-mode #main {
    min-height: 100vh;
    margin: 0;
    padding: 0;
}
#toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mobile-only { display: none; }
@media (max-width: 860px) {
    .mobile-only { display: inline-flex; }
    #sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    body.sidebar-open #sidebar { transform: translateX(0); }
    #main { margin-left: 0; padding: 22px 16px; }
}
