/* Keep the affordance on the page's trailing edge, even when a value has a different direction. */
:root {
    --dropdown-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Crect x='.5' y='.5' width='23' height='23' rx='7' fill='%23edf5ef'/%3E%3Cpath d='m8 10 4 4 4-4' fill='none' stroke='%232e694d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --dropdown-icon-position: right 10px center;
    --dropdown-padding: 10px 44px 10px 12px;
}
html[dir="rtl"] {
    --dropdown-icon-position: left 10px center;
    --dropdown-padding: 10px 12px 10px 44px;
}

html[dir] body select:not([multiple]):is(:not([size]), [size="1"]) {
    appearance: none;
    box-sizing: border-box;
    max-inline-size: 100%;
    min-inline-size: 0;
    min-block-size: 44px;
    padding: var(--dropdown-padding);
    border: 1px solid #b9cfc1;
    border-radius: 10px;
    background: var(--dropdown-chevron) var(--dropdown-icon-position) / 24px 24px no-repeat, #fff;
    box-shadow: 0 1px 2px rgb(17 65 40 / 5%);
    color: #1b3c2b;
    font-weight: 500;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
html[dir] body select:not([multiple]):enabled:hover { border-color: #729e83; }
/* Keep numeric years and currency codes aligned with the other controls. */
html[dir="rtl"] select[dir="ltr"] { text-align: right; justify-content: flex-end; }
html[dir="ltr"] select[dir="rtl"] { text-align: left; justify-content: flex-end; }
html[dir] body select:not([multiple]):focus-visible {
    outline: 2px solid #21744d;
    outline-offset: 2px;
}
html[dir] body select:not([multiple]):open {
    outline: 2px solid #21744d;
    outline-offset: 2px;
}
html[dir] body select:not([multiple]):disabled {
    border-color: #d5dfd8;
    background-color: #f3f6f4;
    color: #64766a;
    cursor: not-allowed;
}
html[dir] body select:not([multiple]):is([aria-invalid="true"], :user-invalid) { border-color: #aa443c; }

@supports (appearance: base-select) and selector(::picker(select)) {
    html[dir] body select:not([multiple]):is(:not([size]), [size="1"]),
    select:not([multiple]):is(:not([size]), [size="1"])::picker(select) {
        appearance: base-select;
    }
    select::picker-icon { display: none; }
    select::picker(select) {
        box-sizing: border-box;
        inline-size: anchor-size(width);
        min-inline-size: min(15rem, calc(100vw - 16px));
        max-inline-size: calc(100vw - 16px);
        max-block-size: min(22rem, 50dvh);
        overflow: auto;
        overscroll-behavior: contain;
        margin-block: 5px;
        padding: 5px;
        border: 1px solid #bbcfc2;
        border-radius: 12px;
        background: white;
        box-shadow: 0 12px 32px rgb(13 54 34 / 17%), 0 2px 6px rgb(13 54 34 / 6%);
        color: #203d2d;
        font: inherit;
        scrollbar-width: thin;
        scrollbar-color: #a8c2b1 transparent;
    }
    select:not([multiple]):is(:not([size]), [size="1"]) option {
        position: relative;
        min-block-size: 38px;
        align-items: center;
        padding: var(--dropdown-padding);
        border-radius: 7px;
        font-weight: 450;
        white-space: normal;
        overflow-wrap: anywhere;
        cursor: pointer;
    }
    select:not([multiple]) option:checked { background: #e7f3ea; color: #145b3c; font-weight: 650; }
    select option::checkmark { position: absolute; right: 12px; color: #196343; }
    html[dir="rtl"] select option::checkmark { right: auto; left: 12px; }
    select option:enabled:hover { background-color: #f0f5f1; }
    select option:focus-visible { outline: 2px solid #337a52; outline-offset: -2px; }
    select option:disabled { color: #718075; cursor: not-allowed; }
    select optgroup { margin: 3px 0; color: #476351; font-weight: 650; }
    select optgroup + optgroup { padding-block-start: 5px; border-block-start: 1px solid #e1eae3; }
}

.sidebar .sidebar-dropdown-arrow, .fund-dropdown .fund-dropdown-arrow {
    display: inline-grid;
    place-items: center;
    inline-size: 24px;
    block-size: 24px;
    border-radius: 7px;
}
.sidebar .sidebar-dropdown-arrow { background: #214e3f; color: #ceead7; }
:is(.rc-disclosure, .expense-row-actions)[open] > summary { background-color: #edf5ef; color: #185b3b; }
:is(.rc-disclosure, .expense-row-actions, .fund-dropdown) > summary:focus-visible {
    outline: 2px solid #21744d;
    outline-offset: 2px;
}
@media (forced-colors: active) {
    select::picker(select) { appearance: auto; }
    html[dir] body select:not([multiple]):is(:not([size]), [size="1"]) {
        appearance: auto;
        background: Field;
        color: FieldText;
        border-color: ButtonText;
        padding-inline: 10px;
    }
    select::picker-icon { display: initial; }
}
