.wallet-selector {
    --wallet-bg: #292441;
    --wallet-surface: #332c50;
    --wallet-border: #4e456b;
    --wallet-text: #f5f3ff;
    --wallet-muted: #b7b2d1;
    --wallet-accent: #b8b0ff;
    --wallet-button: #6454dc;
    position: relative;
    min-width: 0;
    max-width: min(28rem, 50vw);
}

.wallet-selector[data-wallet-theme="light"] {
    --wallet-bg: #fff;
    --wallet-surface: #f3f8f5;
    --wallet-border: #d7e4dc;
    --wallet-text: #243d2e;
    --wallet-muted: #52705e;
    --wallet-accent: #267047;
    --wallet-button: #267047;
}

.wallet-selector .wallet-selector__toggle {
    display: flex;
    align-items: center;
    gap: .625rem;
    width: 100%;
    min-height: 42px;
    padding: .375rem .625rem;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: .625rem;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font: inherit;
    font-size: .875rem;
    cursor: pointer;
}

.wallet-selector .wallet-selector__toggle:hover,
.wallet-selector .wallet-selector__toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, .16);
}

.wallet-selector__name,
.wallet-selector__address {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wallet-selector__chevron {
    flex: 0 0 auto;
    margin-left: auto;
}

.wallet-selector__icon,
.wallet-selector .thumby {
    display: inline-flex;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 4px;
    float: none;
    border: 1px solid var(--wallet-border);
    border-radius: .625rem;
    background: #fff;
    color: var(--wallet-button);
}

.wallet-selector__icon img,
.wallet-selector .thumby img {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 0;
    object-fit: contain;
}

.wallet-selector .wallet-selector__menu {
    width: 26rem;
    min-width: 0;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 5rem);
    max-height: calc(100dvh - 5rem);
    overflow: auto;
    overscroll-behavior: contain;
    margin: .5rem 0 0;
    padding: 0;
    border: 1px solid var(--wallet-border);
    border-radius: .875rem;
    background: var(--wallet-bg);
    color: var(--wallet-text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, .24);
}

.wallet-selector .wallet-selector__current {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--wallet-border);
    color: var(--wallet-text);
    text-decoration: none;
}

.wallet-selector__details {
    display: grid;
    gap: .25rem;
    min-width: 0;
}

.wallet-selector__caption {
    color: var(--wallet-muted);
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .075em;
    line-height: 1.5;
    text-transform: uppercase;
}

.wallet-selector__current-address {
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .8125rem;
    line-height: 1.6;
}

.wallet-selector .wallet-selector__search {
    display: block;
    margin: 0;
    padding: 1rem;
}

.wallet-selector__search label {
    display: block;
    margin: 0 0 .5rem;
    color: var(--wallet-text);
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.5;
}

.wallet-selector__input-group {
    display: flex;
    align-items: stretch;
    gap: .5rem;
}

.wallet-selector .wallet-selector__search .form-control {
    flex: 1;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: .5rem .75rem;
    border: 1px solid var(--wallet-border);
    border-radius: .5rem;
    background: var(--wallet-surface);
    color: var(--wallet-text);
    font-size: .8125rem;
}

.wallet-selector__search .form-control::placeholder {
    color: var(--wallet-muted);
    opacity: 1;
}

.wallet-selector .wallet-selector__submit {
    flex: 0 0 auto;
    min-height: 40px;
    padding: .5rem .875rem;
    border: 1px solid transparent;
    border-radius: .5rem;
    background: var(--wallet-button);
    color: #fff;
    font: inherit;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
}

.wallet-selector .wallet-selector__submit:hover {
    filter: brightness(1.12);
}

.wallet-selector__recent-title {
    padding: .75rem 1rem .375rem;
    border-top: 1px solid var(--wallet-border);
}

.wallet-selector__recents {
    max-height: 18rem;
    max-height: min(18rem, 40vh);
    overflow: auto;
    overscroll-behavior: contain;
    padding: .25rem .5rem .5rem;
}

.wallet-selector .dropdown-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .625rem .5rem;
    border: 0;
    border-radius: .5rem;
    color: var(--wallet-text);
    font-size: .8125rem;
    line-height: 1.5;
    text-decoration: none;
}

.wallet-selector .dropdown-item > span:not(.thumby):not(.balance) {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wallet-selector__address {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .75rem;
}

.wallet-selector__coin {
    color: var(--wallet-muted);
    font-size: .6875rem;
    font-weight: 500;
}

.wallet-selector .balance {
    flex: 0 1 auto;
    max-width: 35%;
    margin-left: auto;
    overflow-wrap: anywhere;
    color: var(--wallet-muted);
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: normal;
}

.wallet-selector .wallet-selector__current:hover,
.wallet-selector .dropdown-item:hover,
.wallet-selector .dropdown-item:focus {
    background: var(--wallet-surface);
    color: var(--wallet-text);
}

.wallet-selector a:focus-visible,
.wallet-selector input:focus-visible,
.wallet-selector button:focus-visible {
    outline: 2px solid var(--wallet-accent);
    outline-offset: -3px;
    box-shadow: none;
}

@media (max-width: 767.98px) {
    .wallet-selector-navbar > .navbar-brand {
        display: flex;
        align-items: center;
        max-width: calc(100% - 3.5rem);
        min-width: 0;
        margin-right: .5rem;
    }

    .wallet-selector-navbar > .navbar-brand svg {
        min-width: 0;
        flex-shrink: 1;
    }

    .wallet-selector {
        max-width: 42px;
    }

    .wallet-selector .wallet-selector__toggle {
        justify-content: center;
        width: 42px;
        padding: 4px;
    }

    .wallet-selector__toggle .wallet-selector__name,
    .wallet-selector__toggle .wallet-selector__chevron {
        display: none;
    }
}
