:root {
    --brand-primary: #e62935;
    --brand-secondary: #8b2cf5;
    --app-background: #090b10;
    --sidebar-background: #0d1017;

    --surface-1: #10131b;
    --surface-2: #151924;
    --surface-3: #1a1f2b;

    --border: rgba(255, 255, 255, .075);
    --border-strong: rgba(255, 255, 255, .12);

    --text: #f6f7fb;
    --text-soft: #c5cbd7;
    --muted: #7d8799;

    --success: #33d17a;
    --warning: #f6b94a;
    --danger: #ff5c6c;

    --sidebar-width: 262px;
    --topbar-height: 74px;

    --radius-sm: 10px;
    --radius: 15px;
    --radius-lg: 22px;

    --shadow:
        0 22px 55px rgba(0, 0, 0, .22);
}


/* =======================================================
   RESET / BASE
   ======================================================= */

* {
    box-sizing: border-box;
}

html {
    background: var(--app-background);
}

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

body {
    background:
        radial-gradient(
            circle at 70% -10%,
            color-mix(
                in srgb,
                var(--brand-primary) 10%,
                transparent
            ),
            transparent 30%
        ),
        var(--app-background);

    color: var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    color: inherit;
}


/* =======================================================
   ICONS
   ======================================================= */

.ui-icon {
    display: block;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* =======================================================
   APP LAYOUT
   ======================================================= */

.app-layout {
    min-height: 100vh;
}


/* =======================================================
   SIDEBAR
   ======================================================= */

.sidebar {
    position: fixed;
    z-index: 40;

    inset: 0 auto 0 0;

    width: var(--sidebar-width);

    display: flex;
    flex-direction: column;

    padding:
        max(22px, env(safe-area-inset-top))
        16px
        max(18px, env(safe-area-inset-bottom));

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, .015),
            transparent 24%
        ),
        var(--sidebar-background);

    border-right: 1px solid var(--border);
}


/* =======================================================
   SIDEBAR BRAND
   ======================================================= */

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 50px;

    padding:
        0
        7px
        22px;

    border-bottom: 1px solid var(--border);
}

.brand-symbol {
    flex: 0 0 auto;

    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;

    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            var(--brand-primary),
            var(--brand-secondary)
        );

    box-shadow:
        0 10px 30px
        color-mix(
            in srgb,
            var(--brand-primary) 22%,
            transparent
        );

    color: white;

    font-size: 18px;
    font-weight: 850;
}

.sidebar-logo-image {
    width: 42px;
    height: 42px;

    object-fit: contain;
}

.brand-copy {
    min-width: 0;
}

.brand-copy strong {
    display: block;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 15px;
}

.brand-copy span {
    display: block;

    margin-top: 3px;

    color: var(--muted);

    font-size: 11px;
}


/* =======================================================
   SIDEBAR NAVIGATION
   ======================================================= */

.sidebar-navigation {
    flex: 1;

    overflow-y: auto;

    margin:
        18px
        -5px
        0;

    padding:
        0
        5px;

    scrollbar-width: thin;
}

.nav-section {
    display: grid;
    gap: 5px;

    margin-bottom: 17px;
}

.nav-section-label {
    margin-top: 3px;

    padding:
        7px
        11px;

    color: #697286;

    font-size: 10px;
    font-weight: 800;

    letter-spacing: .115em;

    text-transform: uppercase;
}

.nav-link {
    min-height: 43px;

    display: flex;
    align-items: center;
    gap: 11px;

    padding:
        9px
        11px;

    border: 1px solid transparent;
    border-radius: 11px;

    color: #929bad;

    font-size: 13px;
    font-weight: 600;

    transition:
        background .17s ease,
        color .17s ease,
        border-color .17s ease,
        transform .17s ease;
}

.nav-link:hover {
    background:
        rgba(255, 255, 255, .035);

    color: var(--text-soft);
}

.nav-link.is-active {
    background:
        linear-gradient(
            90deg,
            color-mix(
                in srgb,
                var(--brand-primary) 15%,
                transparent
            ),
            rgba(255, 255, 255, .025)
        );

    border-color:
        color-mix(
            in srgb,
            var(--brand-primary) 25%,
            transparent
        );

    color: white;
}

.nav-link.is-active .nav-icon {
    color: var(--brand-primary);
}

.nav-icon {
    width: 23px;

    display: grid;
    place-items: center;

    color: #778196;
}


/* =======================================================
   SIDEBAR FOOTER
   ======================================================= */

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-top: 12px;

    padding:
        15px
        7px
        0;

    border-top: 1px solid var(--border);
}

.sidebar-user {
    flex: 1;

    min-width: 0;

    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    flex: 0 0 auto;

    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border:
        1px solid
        color-mix(
            in srgb,
            var(--brand-primary) 30%,
            var(--border)
        );

    border-radius: 12px;

    background:
        color-mix(
            in srgb,
            var(--brand-primary) 9%,
            var(--surface-2)
        );

    color: #fff;

    font-size: 13px;
    font-weight: 800;
}

.sidebar-user-copy {
    min-width: 0;
}

.sidebar-user-copy strong,
.sidebar-user-copy span {
    display: block;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-copy strong {
    font-size: 12px;
}

.sidebar-user-copy span {
    margin-top: 3px;

    color: var(--muted);

    font-size: 10px;
}

.sidebar-logout {
    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: transparent;
    color: var(--muted);

    cursor: pointer;
}

.sidebar-logout:hover {
    border-color:
        rgba(255, 92, 108, .17);

    background:
        rgba(255, 92, 108, .08);

    color: var(--danger);
}


/* =======================================================
   MAIN
   ======================================================= */

.app-main {
    min-height: 100vh;

    margin-left:
        var(--sidebar-width);
}


/* =======================================================
   TOPBAR
   ======================================================= */

.app-topbar {
    position: sticky;
    z-index: 30;

    top: 0;

    min-height:
        var(--topbar-height);

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    padding:
        0
        max(
            26px,
            env(safe-area-inset-right)
        )
        0
        30px;

    border-bottom:
        1px solid
        var(--border);

    background:
        color-mix(
            in srgb,
            var(--app-background) 88%,
            transparent
        );

    backdrop-filter:
        blur(18px);
}

.topbar-left,
.topbar-actions,
.topbar-user {
    display: flex;
    align-items: center;
}

.topbar-left {
    gap: 14px;
}

.topbar-eyebrow {
    margin-bottom: 4px;

    color: var(--muted);

    font-size: 9px;
    font-weight: 800;

    letter-spacing: .13em;
}

.topbar-title {
    font-size: 15px;
}

.topbar-actions {
    gap: 12px;
}

.topbar-icon-button,
.mobile-menu-button,
.drawer-close {
    position: relative;

    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;

    border:
        1px solid
        var(--border);

    border-radius: 12px;

    background:
        var(--surface-1);

    color: #929bad;

    cursor: pointer;
}

.notification-dot {
    position: absolute;

    top: 9px;
    right: 9px;

    width: 6px;
    height: 6px;

    border:
        2px solid
        var(--surface-1);

    border-radius: 999px;

    background:
        var(--brand-primary);
}

.topbar-user {
    gap: 9px;
}

.user-avatar-small {
    width: 36px;
    height: 36px;

    border-radius: 11px;
}

.topbar-user-copy strong,
.topbar-user-copy span {
    display: block;
}

.topbar-user-copy strong {
    font-size: 12px;
}

.topbar-user-copy span {
    margin-top: 2px;

    color: var(--muted);

    font-size: 10px;
}

.mobile-menu-button {
    display: none;
}


/* =======================================================
   CONTENT
   ======================================================= */

.app-content {
    width:
        min(
            1500px,
            100%
        );

    margin:
        0
        auto;

    padding:
        34px
        30px
        calc(
            45px +
            env(safe-area-inset-bottom)
        );
}


/* =======================================================
   PAGE HEADER
   ======================================================= */

.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;

    margin-bottom: 27px;
}

.page-kicker,
.panel-kicker {
    display: block;

    color:
        var(--brand-primary);

    font-size: 9px;
    font-weight: 850;

    letter-spacing: .14em;
}

.page-hero h1 {
    margin:
        7px
        0
        7px;

    font-size:
        clamp(
            26px,
            3vw,
            35px
        );

    line-height: 1.1;

    letter-spacing:
        -.035em;
}

.page-hero p {
    margin: 0;

    color: var(--muted);

    font-size: 13px;
}


/* =======================================================
   MOBILE COMPONENTS
   ======================================================= */

.mobile-bottom-nav,
.mobile-drawer,
.mobile-drawer-overlay {
    display: none;
}


/* =======================================================
   MOBILE
   ======================================================= */

@media (max-width: 760px) {

    :root {
        --topbar-height: 66px;
    }

    body {
        padding-bottom:
            calc(
                70px +
                env(safe-area-inset-bottom)
            );
    }

    .sidebar {
        display: none;
    }

    .app-main {
        margin-left: 0;
    }

    .app-topbar {
        padding:
            max(
                env(safe-area-inset-top),
                0px
            )
            15px
            0;

        min-height:
            calc(
                var(--topbar-height) +
                env(safe-area-inset-top)
            );
    }

    .mobile-menu-button {
        display: grid;
    }

    .topbar-eyebrow {
        display: none;
    }

    .topbar-title {
        font-size: 13px;
    }

    .topbar-user-copy {
        display: none;
    }

    .topbar-icon-button,
    .mobile-menu-button {
        width: 38px;
        height: 38px;
    }

    .app-content {
        padding:
            23px
            15px
            calc(
                25px +
                env(safe-area-inset-bottom)
            );
    }

    .page-hero {
        align-items: flex-start;

        margin-bottom: 20px;
    }

    .page-hero h1 {
        font-size: 27px;
    }

    .page-hero p {
        max-width: 300px;

        line-height: 1.55;
    }


    /* ===================================================
       MOBILE BOTTOM NAV
       =================================================== */

    .mobile-bottom-nav {
        position: fixed;
        z-index: 80;

        inset:
            auto
            0
            0;

        min-height:
            calc(
                64px +
                env(safe-area-inset-bottom)
            );

        display: grid;

        grid-template-columns:
            repeat(
                5,
                1fr
            );

        padding:
            5px
            7px
            env(safe-area-inset-bottom);

        border-top:
            1px solid
            var(--border);

        background:
            color-mix(
                in srgb,
                #0a0d12 93%,
                transparent
            );

        backdrop-filter:
            blur(20px);
    }

    .mobile-nav-item {
        min-width: 0;

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        gap: 4px;

        border: 0;

        background: transparent;

        color: #6d7789;

        font-size: 8px;
        font-weight: 650;

        cursor: pointer;
    }

    .mobile-nav-item.is-active {
        color:
            var(--brand-primary);
    }


    /* ===================================================
       MOBILE DRAWER OVERLAY
       =================================================== */

    .mobile-drawer-overlay {
        position: fixed;
        z-index: 89;

        inset: 0;

        display: block;

        opacity: 0;
        visibility: hidden;

        background:
            rgba(0, 0, 0, .55);

        backdrop-filter:
            blur(3px);

        transition:
            opacity .2s ease,
            visibility .2s ease;
    }

    .mobile-drawer-overlay.is-open {
        opacity: 1;

        visibility: visible;
    }


    /* ===================================================
       MOBILE DRAWER
       =================================================== */

    .mobile-drawer {
        position: fixed;
        z-index: 90;

        top: 0;
        right: 0;
        bottom: 0;

        width:
            min(
                340px,
                88vw
            );

        display: flex;
        flex-direction: column;

        padding:
            max(
                18px,
                env(safe-area-inset-top)
            )
            16px
            max(
                18px,
                env(safe-area-inset-bottom)
            );

        transform:
            translateX(103%);

        border-left:
            1px solid
            var(--border);

        background: #0d1017;

        transition:
            transform .22s ease;
    }

    .mobile-drawer.is-open {
        transform:
            translateX(0);
    }

    .mobile-menu-open {
        overflow: hidden;
    }


    /* ===================================================
       MOBILE DRAWER HEADER
       =================================================== */

    .mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;

        gap: 15px;

        padding-bottom: 15px;

        border-bottom:
            1px solid
            var(--border);
    }

    .drawer-close {
        width: 37px;
        height: 37px;
    }


    /* ===================================================
       MOBILE DRAWER USER
       =================================================== */

    .mobile-drawer-user {
        display: flex;
        align-items: center;

        gap: 11px;

        padding:
            17px
            3px;
    }

    .mobile-drawer-user strong,
    .mobile-drawer-user span {
        display: block;
    }

    .mobile-drawer-user strong {
        font-size: 12px;
    }

    .mobile-drawer-user span {
        margin-top: 3px;

        color: var(--muted);

        font-size: 9px;
    }


    /* ===================================================
       MOBILE DRAWER NAVIGATION
       =================================================== */

    .mobile-drawer-navigation {
        flex: 1;

        display: grid;

        align-content: start;

        gap: 4px;

        overflow-y: auto;
    }

    .drawer-link {
        min-height: 44px;

        display: flex;
        align-items: center;

        gap: 11px;

        padding:
            9px
            11px;

        border:
            1px solid
            transparent;

        border-radius: 11px;

        color: #8a94a6;

        font-size: 11px;
        font-weight: 600;
    }

    .drawer-link.is-active {
        border-color:
            color-mix(
                in srgb,
                var(--brand-primary) 22%,
                transparent
            );

        background:
            color-mix(
                in srgb,
                var(--brand-primary) 8%,
                transparent
            );

        color: #fff;
    }


    /* ===================================================
       MOBILE DRAWER LOGOUT
       =================================================== */

    .drawer-logout-form {
        padding-top: 13px;

        border-top:
            1px solid
            var(--border);
    }

    .drawer-logout {
        width: 100%;

        min-height: 43px;

        display: flex;
        align-items: center;
        justify-content: center;

        gap: 9px;

        border:
            1px solid
            rgba(255, 92, 108, .14);

        border-radius: 11px;

        background:
            rgba(255, 92, 108, .055);

        color: #ff7e8b;

        font-size: 10px;
        font-weight: 700;
    }

}