:root {
    --sidebar: #0f172a;
    --sidebar-soft: #1e293b;
    --sidebar-fg: #cbd5e1;
    --sidebar-fg-hover: #fff;
    --accent: #dc3545;
    --body: #f5f7fb;
    --text: #1f2937;
}

body {
    min-height: 100vh;
    background: var(--body);
    color: var(--text);
    font-size: .9rem;
}

.auth-page {
    display: grid;
    place-items: center;
    background:
        linear-gradient(120deg, rgba(23, 32, 51, .88), rgba(220, 53, 69, .68)),
        url('https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1600&q=80') center / cover;
}

.auth-card {
    width: min(430px, calc(100vw - 32px));
    border: 0;
    border-radius: 8px;
}

.brand-mark {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 300px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    background: radial-gradient(1200px 600px at -10% -10%, #172036 0%, var(--sidebar) 42%);
    color: var(--sidebar-fg);
    transition: width .2s ease, transform .2s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 8px 14px;
    font-size: 1.05rem;
}

.brand-text {
    min-width: 0;
    flex: 1;
}

.brand-text strong,
.brand-text small {
    display: block;
    white-space: nowrap;
}

.brand-text small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .62);
    font-size: .72rem;
    line-height: 1.15;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    margin-left: auto;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #dbeafe;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .22);
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--sidebar-fg);
    white-space: nowrap;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: var(--sidebar-fg-hover);
    background: rgba(255, 255, 255, .08);
}

.sidebar .nav-link > .bi {
    width: 22px;
    flex: 0 0 22px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
}

.app-main {
    min-height: 100vh;
    margin-left: 300px;
    transition: margin-left .2s ease;
}

.topbar {
    min-height: 70px;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.topbar-title-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.topbar h1 {
    margin: 0;
    font-size: 1.18rem;
}

.okami-universes {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
}

.okami-universe-button {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-size: .9rem;
    font-weight: 400;
    box-shadow: 0 2px 7px rgba(var(--bs-body-color-rgb), .1);
}

.content {
    padding: 20px;
}

.empty-workspace {
    min-height: calc(100vh - 110px);
}

.profile-card {
    max-width: 620px;
    border-color: #e5e7eb;
}

.mobile-menu-toggle,
.sidebar-backdrop {
    display: none;
}

html.sidebar-collapsed .sidebar {
    width: 74px;
    padding-left: 10px;
    padding-right: 10px;
}

html.sidebar-collapsed .app-main {
    margin-left: 74px;
}

html.sidebar-collapsed .brand-text,
html.sidebar-collapsed .sidebar .nav-link span {
    display: none !important;
}

html.sidebar-collapsed .brand {
    justify-content: center;
    gap: 0;
}

html.sidebar-collapsed .brand-mark {
    display: none;
}

html.sidebar-collapsed .sidebar-toggle {
    margin-left: 0;
}

html.sidebar-collapsed .sidebar .nav-link {
    width: 44px;
    height: 40px;
    padding: 0;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    font-size: 0;
}

[data-bs-theme="dark"] body {
    --body: #10131a;
    --text: #e8edf7;
}

[data-bs-theme="dark"] .topbar,
[data-bs-theme="dark"] .profile-card {
    background: #171b24;
    border-color: #2a3140;
    color: var(--text);
}

@media (max-width: 900px) {
    .sidebar,
    html.sidebar-collapsed .sidebar {
        width: min(310px, 88vw);
        min-height: 100dvh;
        padding: 16px 14px;
        transform: translateX(-105%);
        box-shadow: 16px 0 40px rgba(0, 0, 0, .25);
    }

    html.mobile-menu-open .sidebar {
        transform: translateX(0);
    }

    .app-main,
    html.sidebar-collapsed .app-main {
        margin-left: 0;
    }

    html.sidebar-collapsed .brand-text,
    html.sidebar-collapsed .sidebar .nav-link span {
        display: initial !important;
    }

    html.sidebar-collapsed .brand {
        justify-content: flex-start;
        gap: 10px;
    }

    html.sidebar-collapsed .brand-mark {
        display: initial;
    }

    html.sidebar-collapsed .sidebar-toggle {
        margin-left: auto;
    }

    html.sidebar-collapsed .sidebar .nav-link {
        width: auto;
        height: auto;
        padding: 8px 10px;
        justify-content: flex-start;
        gap: 8px;
        font-size: .88rem;
    }

    .mobile-menu-toggle {
        width: 42px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        font-size: 1.35rem;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1040;
        width: 100%;
        height: 100%;
        border: 0;
        background: rgba(2, 6, 23, .58);
    }

    html.mobile-menu-open .sidebar-backdrop {
        display: block;
    }

    body.mobile-menu-lock {
        overflow: hidden;
    }

    .topbar {
        min-height: 68px;
        padding: 12px 16px;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
    }

    .topbar-title-wrap {
        min-width: 0;
    }

    .topbar h1 {
        font-size: 1.15rem;
    }

    .content {
        padding: 16px 12px;
    }
}
