:root {
    --app-select-ink: #172334;
    --app-select-muted: #6f7d93;
    --app-select-surface: #fffaf3;
    --app-select-surface-strong: #fffdf8;
    --app-select-line: rgba(216, 198, 166, 0.82);
    --app-select-focus: #0f7a78;
    --app-select-focus-soft: rgba(15, 122, 120, 0.16);
    --app-select-option-active: #edf7f6;
    --app-select-option-selected: #e1f1ef;
}

.app-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

.app-select-native {
    position: absolute !important;
    inline-size: 1px !important;
    block-size: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.app-select-trigger {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    overflow: hidden;
    border: 1px solid var(--app-select-line);
    border-radius: 12px;
    background: var(--app-select-surface);
    color: var(--app-select-ink);
    font: inherit;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    text-wrap: pretty;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.app-select-trigger::after {
    content: '';
    justify-self: end;
    inline-size: 7px;
    block-size: 7px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transform-origin: center;
    color: #536176;
    transition: transform 160ms ease;
}

.app-select-trigger-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-select:hover:not(.is-disabled) .app-select-trigger {
    border-color: rgba(15, 122, 120, 0.44);
    background: var(--app-select-surface-strong);
}

.app-select.is-open .app-select-trigger,
.app-select-trigger:focus-visible {
    z-index: 1;
    border-color: var(--app-select-focus);
    outline: 3px solid var(--app-select-focus-soft);
    outline-offset: 0;
    background: var(--app-select-surface-strong);
}

.app-select.is-open .app-select-trigger::after {
    transform: rotate(225deg) translateY(-1px);
}

.app-select.is-invalid .app-select-trigger {
    border-color: #c4322f;
    outline-color: rgba(196, 50, 47, 0.14);
}

.app-select.is-disabled .app-select-trigger {
    color: #9aa3b1;
    background: #f2eee7;
    box-shadow: none;
    cursor: not-allowed;
}

.app-select-panel {
    position: fixed;
    z-index: 4200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 24px);
    height: var(--app-select-panel-height, 300px);
    max-height: calc(100vh - 24px);
    padding: 8px;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid rgba(207, 179, 129, 0.82);
    border-radius: 14px;
    background: #fffdf8;
    box-shadow: 0 20px 42px rgba(30, 38, 49, 0.18), 0 2px 8px rgba(216, 167, 69, 0.12);
}

.app-select-panel[hidden] {
    display: none;
}

.app-select-option[hidden],
.app-select-option-group[hidden],
.app-select-options[hidden],
.app-select-empty[hidden] {
    display: none !important;
}

.app-select-search {
    display: block;
    flex: 0 0 auto;
}

.app-select-search input {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid rgba(216, 198, 166, 0.86);
    border-radius: 9px;
    background: #fffaf3;
    color: var(--app-select-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 650;
}

.app-select-search input:focus {
    border-color: var(--app-select-focus);
    outline: 2px solid var(--app-select-focus-soft);
    background: #fffdf8;
}

.app-select-options {
    display: grid;
    flex: 1 1 auto;
    gap: 3px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(15, 122, 120, 0.54) transparent;
    scrollbar-width: thin;
    touch-action: pan-y;
}

.app-select-options::-webkit-scrollbar {
    width: 8px;
}

.app-select-options::-webkit-scrollbar-thumb {
    border: 2px solid #fffdf8;
    border-radius: 999px;
    background: rgba(15, 122, 120, 0.54);
}

.app-select-options::-webkit-scrollbar-track {
    background: transparent;
}

.app-select-option-group {
    display: grid;
    gap: 3px;
    padding: 5px 0;
}

.app-select-option-group + .app-select-option-group {
    border-top: 1px solid rgba(216, 198, 166, 0.45);
}

.app-select-option-group-label {
    margin: 0;
    padding: 2px 10px;
    color: var(--app-select-muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
}

.app-select-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16px;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--app-select-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.35;
    text-align: left;
    text-wrap: pretty;
    cursor: pointer;
}

.app-select-option::after {
    content: '';
    inline-size: 6px;
    block-size: 10px;
    justify-self: center;
    border-right: 2px solid transparent;
    border-bottom: 2px solid transparent;
    transform: rotate(45deg) translate(-1px, -1px);
}

.app-select-option:hover,
.app-select-option:focus-visible {
    background: var(--app-select-option-active);
    outline: none;
}

.app-select-option.is-selected {
    background: var(--app-select-option-selected);
    color: #086d6c;
    font-weight: 800;
}

.app-select-option.is-selected::after {
    border-color: currentColor;
}

.app-select-option:disabled {
    color: #a0a8b4;
    background: transparent;
    cursor: not-allowed;
}

.app-select-option-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.app-select-empty {
    margin: 0;
    padding: 14px 10px;
    color: var(--app-select-muted);
    font-size: 14px;
    font-weight: 650;
    text-align: center;
}

.score-select-cell .app-select {
    width: min(100%, 160px);
}

.template-editor-summary-field .app-select-trigger,
.template-editor-field-grid .app-select-trigger,
.template-item-editor-row .app-select-trigger,
.amount-baseline-form-matrix .app-select-trigger,
.account-create-grid .app-select-trigger,
.cycle-form-grid .app-select-trigger,
.efficiency-filter-form .app-select-trigger {
    min-height: 42px;
}

@media (max-width: 720px) {
    .app-select-trigger {
        min-height: 44px;
    }

    .app-select-panel {
        border-radius: 12px;
    }

    .app-select-option {
        min-height: 42px;
    }
}
