/* ==================================================
   TEMPLATE 5 LAYOUT
================================================== */
:root {
    --t5-primary: #4f46e5;
    --t5-primary-dark: #312e81;
    --t5-accent: #06b6d4;
    --t5-accent-soft: #dff7fb;
    --t5-ink: #16172f;
    --t5-muted: #64708a;
    --t5-line: #d9def2;
    --t5-bg: #eaf0ff;
    --t5-panel: #ffffff;
    --t5-shadow: rgba(22, 23, 47, 0.14);
    --t5-navy: #141837;
    --t5-navy-2: #20245b;
}

body {
    background:
        radial-gradient(circle at 18% 12%, rgba(6, 182, 212, 0.12), transparent 30%),
        linear-gradient(90deg, rgba(79, 70, 229, 0.07) 1px, transparent 1px),
        linear-gradient(180deg, #f8fbff 0%, var(--t5-bg) 100%);
    background-size: auto, 30px 30px, auto;
    color: var(--t5-ink);
}

.page-wrap {
    min-height: 100vh;
    margin-left: 0;
    padding: 108px 28px 34px;
    color: var(--t5-ink);
}

.page-inner {
    width: min(1840px, 100%);
    margin: 0 auto;
}

/* =========================
   TOP NAVIGATION
========================= */
.topbar {
    position: fixed;
    top: 18px;
    left: 28px;
    right: 28px;
    width: auto;
    height: 68px;
    z-index: 2000;
    padding: 0 18px;
    border: 1px solid rgba(121, 137, 255, 0.28);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(20, 24, 55, 0.98) 0%, rgba(32, 36, 91, 0.96) 62%, rgba(7, 112, 137, 0.92) 100%);
    box-shadow: 0 18px 42px rgba(15, 20, 55, 0.24);
    backdrop-filter: blur(18px);
}

.topbar-inner {
    height: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
}

.topbar-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 190px;
    height: 44px;
    padding: 0 14px 0 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.topbar-logo-mark {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: #eef4ff;
    object-fit: cover;
}

.topbar-logo-text {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
}

.topbar-left {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.topbar-left::-webkit-scrollbar {
    display: none;
}

.topbar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-right .topbar-menu {
    justify-content: flex-end;
}

.topbar-item a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px 0 8px;
    border-radius: 6px;
    color: #cbd5f7;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.topbar-item a i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.11);
    text-align: center;
    font-size: 13px;
    color: #8de8f7;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.topbar-item a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.topbar-item a:hover i {
    border-color: rgba(103, 232, 249, 0.42);
    background: rgba(6, 182, 212, 0.16);
    color: #67e8f9;
}

.topbar-item.is-active a {
    background: #ffffff;
    color: var(--t5-navy);
    box-shadow: 0 10px 24px rgba(3, 9, 35, 0.24);
}

.topbar-item.is-active a::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -9px;
    height: 3px;
    border-radius: 999px;
    background: var(--t5-accent);
}

.topbar-item.is-active a i {
    border-color: rgba(79, 70, 229, 0.16);
    background: #eef4ff;
    color: var(--t5-primary);
}

.topbar-right {
    margin-top: 0;
    padding-top: 0;
}

.topbar-right .topbar-item a {
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #dbe4ff;
}

.topbar-toggle {
    display: none;
}

.topbar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 15, 45, 0.46);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

@media (max-width: 980px) {
    .page-wrap {
        padding-top: 90px;
    }

    .topbar {
        top: 12px;
        left: 14px;
        right: 14px;
        height: auto;
        min-height: 62px;
    }

    .topbar-inner {
        grid-template-columns: auto 1fr auto;
    }

    .topbar-logo {
        min-width: 0;
        width: 46px;
        padding: 0 9px;
    }

    .topbar-logo-text {
        display: none;
    }
}

@media (max-width: 640px) {
    .page-wrap {
        padding: 82px 14px 24px;
    }

    .topbar-toggle {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 2200;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(255,255,255,0.35);
        border-radius: 6px;
        background: #181a3f;
        color: #fff;
        box-shadow: 0 14px 30px rgba(22, 23, 47, 0.22);
    }

    .topbar {
        top: 0;
        left: auto;
        right: 0;
        width: min(310px, 88vw);
        height: 100vh;
        padding: 18px;
        border-radius: 0;
        transform: translateX(100%);
        transition: transform 0.24s ease;
    }

    .topbar.is-open {
        transform: translateX(0);
    }

    .topbar.is-open + .topbar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .topbar-inner {
        grid-template-columns: 1fr;
        align-content: start;
        gap: 18px;
    }

    .topbar-logo {
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
    }

    .topbar-logo-text {
        display: block;
    }

    .topbar-left {
        overflow: visible;
    }

    .topbar-menu {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-item a {
        justify-content: flex-start;
        width: 100%;
    }

    .topbar-right {
        margin-top: auto;
    }
}
