:root {
    --shell-line: rgba(34, 48, 68, 0.08);
    --shell-fill: rgba(251, 252, 253, 0.94);
    --shell-card: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 251, 0.95));
}

.topbar {
    display: grid;
    grid-template-columns: minmax(260px, auto) minmax(0, 1fr);
    align-items: start;
    gap: 18px 24px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--shell-line);
    background: var(--shell-fill);
}

.topbar-sections {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px 16px;
    min-width: 0;
}

.topbar-sections-public {
    align-items: center;
}

.nav-cluster {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.nav-cluster-label,
.account-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 20px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-cluster-label::before,
.account-label::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(23, 59, 112, 0.24);
}

.nav-cluster-admin .nav-cluster-label::before {
    background: rgba(143, 37, 49, 0.34);
}

.nav-main,
.nav-admin,
.nav-public {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    border-radius: 18px;
    border: 1px solid rgba(34, 48, 68, 0.08);
    background: rgba(245, 248, 252, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.nav a {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 12px;
    font-weight: 700;
}

.nav a:hover {
    border-color: rgba(23, 59, 112, 0.16);
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 40, 0.06);
}

.account-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 6px;
    border-radius: 18px;
    border: 1px solid rgba(34, 48, 68, 0.08);
    background: rgba(245, 248, 252, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.account-bar form {
    margin: 0;
}

.user-badge {
    max-width: min(340px, 32vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page.page-constructor {
    max-width: none;
    width: 100%;
    padding-left: clamp(18px, 2vw, 28px);
    padding-right: clamp(18px, 2vw, 28px);
}

@media (max-width: 1180px) {
    .topbar {
        grid-template-columns: 1fr;
    }

    .topbar-sections {
        justify-content: flex-start;
    }

    .account-bar {
        justify-content: flex-start;
    }

    .user-badge {
        max-width: min(100%, 420px);
    }
}

@media (max-width: 720px) {
    .topbar {
        padding: 12px 14px;
        gap: 14px;
    }

    .nav-main,
    .nav-admin,
    .nav-public,
    .account-bar {
        width: 100%;
    }

    .nav a,
    .account-bar .ghost-button {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    .user-badge {
        order: -1;
        max-width: 100%;
        width: 100%;
    }
}
