.glsp-scope-selector {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    position: relative;
    z-index: 1302;
}

.glsp-scope-badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    white-space: nowrap;
}

.glsp-scope-form {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    position: relative;
    overflow: visible;
}

.glsp-scope-toggle {
    min-width: 180px;
    max-width: 260px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
    border-radius: .5rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    background-image: none !important;
    box-shadow: none;
}

.glsp-scope-toggle:focus,
.glsp-scope-toggle:focus-visible {
    border-color: color-mix(in srgb, var(--app-primary) 65%, #7aa995);
    box-shadow: 0 0 0 .2rem rgba(17, 92, 71, 0.18);
}

.glsp-scope-toggle-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.glsp-scope-menu {
    min-width: 180px;
    max-width: 320px;
    border-radius: .5rem;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.16);
    overflow: hidden;
    z-index: 1360;
}

.glsp-scope-menu .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .45rem;
    color: var(--text);
    background: transparent;
}

.glsp-scope-menu .dropdown-item:focus,
.glsp-scope-menu .dropdown-item:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--app-primary) 14%, transparent);
}

.glsp-scope-menu .dropdown-item.active,
.glsp-scope-menu .dropdown-item:active {
    color: var(--text);
    background: color-mix(in srgb, var(--app-primary) 20%, transparent);
}

html[data-theme="dark"] .glsp-scope-toggle {
    background: color-mix(in srgb, var(--surface) 90%, #0a1110);
    border-color: color-mix(in srgb, var(--border) 80%, #23352f);
    color: #e7f2ee;
    background-image: none !important;
}

html[data-theme="dark"] .glsp-scope-toggle:focus,
html[data-theme="dark"] .glsp-scope-toggle:focus-visible {
    border-color: color-mix(in srgb, var(--app-primary) 65%, #7aa995);
    box-shadow: 0 0 0 .2rem rgba(17, 92, 71, 0.24);
}

html[data-theme="dark"] .glsp-scope-menu {
    background: #15181b;
    border-color: #2a3f35;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .glsp-scope-menu .dropdown-item {
    color: #e7f2ee;
}

html[data-theme="dark"] .glsp-scope-menu .dropdown-item:hover,
html[data-theme="dark"] .glsp-scope-menu .dropdown-item:focus {
    color: #f2f8ff;
    background: rgba(17, 92, 71, 0.25);
}

html[data-theme="dark"] .glsp-scope-menu .dropdown-item.active,
html[data-theme="dark"] .glsp-scope-menu .dropdown-item:active {
    color: #f2f8ff;
    background: rgba(17, 92, 71, 0.32);
}

.glsp-scope-selector-app {
    width: 100%;
    justify-content: flex-end;
}

.glsp-scope-selector-app .glsp-scope-badge {
    max-width: 148px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.glsp-scope-selector-app .glsp-scope-select {
    min-width: 132px;
    max-width: 168px;
}

.glsp-scope-selector-app .glsp-scope-toggle {
    min-width: 132px;
    max-width: 168px;
}

@media (max-width: 767.98px) {
    .glsp-scope-selector {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .glsp-scope-selector-app .glsp-scope-form {
        width: 100%;
        justify-content: flex-end;
    }

    .glsp-scope-toggle {
        min-width: 136px;
        max-width: 64vw;
    }
}
