.portal-language-switcher {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 13px;
    line-height: 1.2;
    z-index: 120;
}

.portal-language-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 5px 10px;
    color: #334155;
    background: rgba(255, 255, 255, .88);
    border: 1px solid #d7e0ec;
    border-radius: 9px;
    box-shadow: 0 2px 8px rgba(30, 64, 175, .05);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .18s ease, color .18s ease, box-shadow .18s ease, background .18s ease;
}

.portal-language-trigger:hover,
.portal-language-switcher.is-open .portal-language-trigger {
    color: #1769e0;
    border-color: #9fc2f5;
    box-shadow: 0 5px 16px rgba(37, 99, 235, .12);
}

.portal-language-globe {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    color: #fff;
    background: linear-gradient(135deg, #438cf6, #6b63f6);
    border-radius: 50%;
    font-size: 11px;
}

.portal-language-caret {
    width: 6px;
    height: 6px;
    margin: -3px 1px 0 2px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform .18s ease;
}

.portal-language-switcher.is-open .portal-language-caret {
    margin-top: 3px;
    transform: rotate(225deg);
}

.portal-language-menu {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(142px, 1fr));
    gap: 4px;
    width: 320px;
    padding: 9px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    background: rgba(255, 255, 255, .98);
    border: 1px solid #dfe6f0;
    border-radius: 14px;
    box-shadow: 0 18px 55px rgba(15, 23, 42, .18);
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.portal-language-switcher.is-open .portal-language-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.portal-language-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
    color: #334155;
    border-radius: 9px;
    text-decoration: none;
    transition: color .16s ease, background .16s ease;
}

.portal-language-option:hover {
    color: #145fc9;
    background: #f1f6ff;
}

.portal-language-option.is-active {
    color: #145fc9;
    background: linear-gradient(135deg, #eaf2ff, #f4f1ff);
    font-weight: 700;
}

.portal-language-option small {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 400;
}

.portal-locale-page-bar {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.portal-locale-page-brand {
    color: #172033;
    font-size: 15px;
    font-weight: 750;
    text-decoration: none;
}

html.portal-dark .portal-language-trigger {
    color: #c6d6ec;
    background: #111f34;
    border-color: #31445f;
    box-shadow: none;
}

html.portal-dark .portal-language-trigger:hover,
html.portal-dark .portal-language-switcher.is-open .portal-language-trigger {
    color: #75b4ff;
    border-color: #4d78aa;
}

html.portal-dark .portal-language-menu {
    background: #101d31;
    border-color: #31445f;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}

html.portal-dark .portal-language-option {
    color: #c6d6ec;
}

html.portal-dark .portal-language-option:hover {
    color: #8fc1ff;
    background: #192b45;
}

html.portal-dark .portal-language-option.is-active {
    color: #9ac7ff;
    background: linear-gradient(135deg, #1a3151, #282a51);
}

html.portal-dark .portal-locale-page-brand {
    color: #eef5ff;
}

@media (max-width: 720px) {
    .portal-locale-page-bar { padding: 12px 14px 0; }
    .portal-language-label { display: none; }
    .portal-language-trigger { min-width: 30px; padding: 5px 6px; }
    .portal-language-caret { display: none; }
    .portal-language-menu {
        position: fixed;
        top: 58px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: min(70vh, 520px);
        overflow-y: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .portal-language-menu { grid-template-columns: 1fr; }
}
