.top-bar {
    min-height: 92px;
    padding: 14px 24px;
    gap: 24px;
    background: linear-gradient(112deg, #1a3166 0%, #243a72 58%, #1a3166 100%);
}

.top-bar-main {
    flex: 1 1 330px;
    max-width: 390px;
}

.top-bar-titles {
    display: grid;
    grid-template-areas:
        "brand connection"
        "context connection";
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 14px;
    row-gap: 2px;
    width: 100%;
}

.page-title.brand {
    grid-area: brand;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.35;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.page-title.context {
    grid-area: context;
    padding-left: 0;
    overflow: hidden;
    border-left: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conn-status {
    grid-area: connection;
    align-self: center;
    min-height: 32px;
    margin-right: 0;
    padding: 5px 10px;
    gap: 7px;
    white-space: nowrap;
}

.global-actions {
    flex: 0 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.auth-user-badge {
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    max-width: 180px;
    padding: 8px 13px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 999px;
    background: rgba(248, 251, 255, 0.96);
    color: #1d4ed8;
    box-shadow: 0 8px 18px rgba(9, 21, 52, 0.14);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

#auth-user-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-actions .top-action {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 11px;
    gap: 7px;
    border-radius: 9px;
    box-shadow: 0 6px 14px rgba(9, 21, 52, 0.12);
    font-size: 12px;
    line-height: 1.15;
    white-space: nowrap;
}

.global-actions .top-action .btn-icon {
    flex: 0 0 auto;
    font-size: 14px;
    line-height: 1;
}

.global-actions .top-action .btn-label {
    white-space: nowrap;
}

.global-actions .top-action-light {
    border-color: rgba(255, 255, 255, 0.38);
    background: rgba(255, 255, 255, 0.96);
    color: #344563;
}

.global-actions .top-action-light:hover {
    border-color: #fff;
    background: #fff;
    color: #11224d;
}

.global-actions .top-action-muted {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(15, 23, 42, 0.5);
    color: #fff;
}

.global-actions .top-action-muted:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
}

.global-actions .top-action-save {
    border: 1px solid #f7cf4d;
    background: linear-gradient(180deg, #ffd95c 0%, #fbc02d 100%);
    color: #293557;
    box-shadow: 0 7px 16px rgba(251, 192, 45, 0.22);
}

.global-actions .top-action-save:hover {
    border-color: #ffe284;
    background: linear-gradient(180deg, #ffe177 0%, #f7c436 100%);
    color: #17213e;
}

.global-actions .top-action-logout {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(8, 16, 38, 0.66);
    color: #fff;
}

.global-actions .top-action-logout:hover {
    border-color: rgba(254, 202, 202, 0.55);
    background: #7f1d1d;
    color: #fff;
}

@media (max-width: 1440px) and (min-width: 1025px) {
    .top-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .top-bar-main {
        flex-basis: auto;
        max-width: none;
        width: 100%;
    }

    .top-bar-titles {
        grid-template-areas: "brand context connection";
        grid-template-columns: auto minmax(160px, 1fr) auto;
        align-items: center;
    }

    .page-title.context {
        padding-left: 14px;
        border-left: 1px solid rgba(255, 255, 255, 0.2);
    }

    .global-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
    }
}

@media (max-width: 1024px) {
    .top-bar {
        padding: 12px 16px;
        gap: 10px;
    }

    .top-bar-main {
        max-width: none;
    }

    .global-actions {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 1px 0 3px;
        scrollbar-width: thin;
    }

    .global-actions .top-action {
        flex: 0 0 42px;
        min-width: 42px;
        min-height: 40px;
        padding: 6px;
    }

    .auth-user-badge {
        min-height: 40px;
        max-width: 150px;
        padding: 7px 11px;
    }
}

@media (max-width: 480px) {
    .top-bar-titles {
        column-gap: 8px;
    }

    .page-title.brand {
        font-size: 10px;
        white-space: normal;
    }

    .page-title.context {
        font-size: 15px;
    }

    .conn-status {
        min-height: 30px;
        padding: 4px 8px;
        font-size: 10px;
    }
}
