.ui-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    color: var(--text);
    font: inherit;
    font-weight: 800;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    transition:
        transform var(--motion-fast) var(--ease-standard),
        background-color var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard);
}

.ui-button:hover {
    transform: translateY(-1px);
}

.ui-button:active {
    transform: translateY(0) scale(0.985);
}

.ui-button--primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.2);
}

.ui-button--primary:hover {
    background: var(--accent-strong);
}

.ui-button--secondary {
    border-color: rgba(15, 118, 110, 0.18);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.ui-button--danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.ui-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    background: var(--surface);
    box-shadow: var(--shadow-panel);
}

.ui-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
}

.ui-empty-state {
    padding: var(--space-6);
    border: 1px dashed var(--line);
    border-radius: var(--radius-panel);
    color: var(--muted);
    text-align: center;
}

.ui-form-control {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: var(--ui-control-min-height, 44px);
    padding: var(--ui-control-padding, 0.65rem 0.75rem);
    border: 1px solid var(--ui-control-border, rgb(20 35 31 / 50%));
    border-radius: var(--ui-control-radius, 10px);
    background: var(--ui-control-background, #ffffff);
    color: var(--ui-control-color, var(--text));
    font: inherit;
    font-size: var(--ui-control-font-size, 0.94rem);
}

.ui-choice-control {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 44px;
}

.ui-choice-control > input:is([type="checkbox"], [type="radio"]) {
    flex: 0 0 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
    min-height: 0;
    margin: 0;
    padding: 0;
    accent-color: var(--ui-control-accent, var(--accent));
}

.native-select--enhanced {
    position: absolute !important;
    width: 1px !important;
    min-width: 0 !important;
    height: 1px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-select {
    --custom-select-open-z-index: 80;
    --custom-select-list-z-index: 90;
    --custom-select-button-min-height: 50px;
    --custom-select-button-padding: 12px 16px;
    --custom-select-button-border: var(--line);
    --custom-select-button-radius: 18px;
    --custom-select-button-shadow: inset 0 1px 0 rgb(255 255 255 / 88%), 0 10px 24px rgb(35 48 41 / 5%);
    --custom-select-button-hover-border: rgb(15 107 95 / 44%);
    --custom-select-button-focus-shadow: inset 0 1px 0 rgb(255 255 255 / 90%), 0 12px 28px rgb(15 107 95 / 13%);
    --custom-select-list-offset: 8px;
    --custom-select-list-natural-max-height: 300px;
    --custom-select-list-limit: 48vh;
    --custom-select-list-border: rgb(15 107 95 / 26%);
    --custom-select-list-radius: 18px;
    --custom-select-list-shadow: 0 20px 44px rgb(35 48 41 / 18%);
    --custom-select-option-min-height: 42px;
    --custom-select-option-padding: 10px 13px;
    --custom-select-option-radius: 12px;
    --custom-select-option-weight: 800;
    --custom-select-option-hover-background: rgb(223 243 237 / 82%);
    --custom-select-option-hover-color: var(--accent-strong);
    --custom-select-selected-background: #e7efff;
    --custom-select-selected-color: #1f57c8;
    --custom-select-selected-hover-background: #dbe8ff;
    --custom-select-selected-hover-color: #1848a8;
    position: relative;
    width: 100%;
    min-width: 0;
}

.custom-select.is-open {
    z-index: var(--custom-select-open-z-index);
}

.custom-select__button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-height: var(--custom-select-button-min-height);
    padding: var(--custom-select-button-padding);
    border: 1px solid var(--custom-select-button-border);
    border-radius: var(--custom-select-button-radius);
    background: linear-gradient(180deg, #ffffff, #f8fbf8);
    color: var(--text);
    font: inherit;
    font-weight: 900;
    text-align: left;
    box-shadow: var(--custom-select-button-shadow);
    cursor: pointer;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.custom-select__button::after {
    content: "";
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 160ms ease;
}

.custom-select__button:hover {
    border-color: var(--custom-select-button-hover-border);
    background: #ffffff;
}

.custom-select__button:focus-visible,
.custom-select.is-open .custom-select__button {
    outline: 3px solid #0b5f55;
    outline-offset: 2px;
    border-color: var(--accent);
    box-shadow: var(--custom-select-button-focus-shadow);
}

.custom-select.is-open .custom-select__button::after {
    transform: translateY(2px) rotate(225deg);
}

.custom-select.is-disabled .custom-select__button {
    cursor: not-allowed;
    opacity: 0.62;
}

.custom-select__value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select__list {
    position: absolute;
    z-index: var(--custom-select-list-z-index);
    top: calc(100% + var(--custom-select-list-offset));
    right: 0;
    left: 0;
    display: grid;
    gap: 4px;
    max-height: min(var(--custom-select-list-max-height, var(--custom-select-list-natural-max-height)), var(--custom-select-list-limit));
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid var(--custom-select-list-border);
    border-radius: var(--custom-select-list-radius);
    background: #ffffff;
    box-shadow: var(--custom-select-list-shadow);
}

.custom-select.is-open-above .custom-select__list {
    top: auto;
    bottom: calc(100% + var(--custom-select-list-offset));
}

.custom-select__list[hidden] {
    display: none;
}

.custom-select__option {
    width: 100%;
    min-height: var(--custom-select-option-min-height);
    padding: var(--custom-select-option-padding);
    border: 0;
    border-radius: var(--custom-select-option-radius);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: var(--custom-select-option-weight);
    line-height: 1.25;
    text-align: left;
    white-space: normal;
    cursor: pointer;
}

.custom-select__option:hover {
    background: var(--custom-select-option-hover-background);
    color: var(--custom-select-option-hover-color);
}

.custom-select__option:focus-visible {
    outline: 3px solid #0b5f55;
    outline-offset: -3px;
    background: var(--custom-select-option-hover-background);
    color: var(--custom-select-option-hover-color);
}

.custom-select__option.is-selected {
    background: var(--custom-select-selected-background);
    color: var(--custom-select-selected-color);
}

.custom-select__option.is-selected:hover,
.custom-select__option.is-selected:focus-visible {
    background: var(--custom-select-selected-hover-background);
    color: var(--custom-select-selected-hover-color);
}

.custom-select__validation-message {
    margin: 8px 2px 0;
    color: #9f1239;
    font-size: 0.86rem;
    font-weight: 750;
    line-height: 1.35;
}

.ui-busy-indicator {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(15, 118, 110, 0.2);
    border-top-color: var(--accent);
    border-radius: var(--radius-pill);
    animation: ui-busy-spin 720ms linear infinite;
}

@keyframes ui-busy-spin {
    to {
        transform: rotate(1turn);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ui-busy-indicator {
        border-color: var(--accent);
        border-right-color: transparent;
        animation: none;
    }
}
