.icon-button {
    width: var(--tap-size);
    height: var(--tap-size);
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    transition: border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.icon-button:active { transform: scale(.97); }
.icon-button:hover { background: var(--surface-soft); border-color: var(--line-strong); }
.icon { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.button {
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-weight: 800;
    transition: transform .18s var(--ease), background .18s var(--ease), opacity .18s var(--ease);
}
.button:active { transform: translateY(1px) scale(.995); }
.button-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 10px 28px color-mix(in srgb, var(--primary) 20%, transparent); }
.button-primary:hover { opacity: .94; }
.button-secondary { background: var(--surface-soft); color: var(--text); border: 1px solid var(--line); }
.button-block { width: 100%; }

.field { display: grid; gap: 8px; }
.field-label { font-size: 13px; font-weight: 750; color: var(--text); }
.field-control-wrap { position: relative; }
.field-control {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    outline: 0;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.field-control::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.field-control:hover { border-color: var(--line-strong); }
.field-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
select.field-control { appearance: none; padding-right: 42px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.field-error { color: var(--danger); font-size: 12px; line-height: 1.5; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.5; }

.alert { border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.55; }
.alert-error { color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.badge { min-height: 28px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge-success { color: var(--success); background: var(--success-soft); }
.theme-icon-light { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: none; }
html[data-theme="dark"] .theme-icon-light { display: block; }


.custom-select {
    position: relative;
}

.field-control-wrap[data-custom-select].is-enhanced > .field-control {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.custom-select-trigger {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
    outline: 0;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.custom-select-trigger:hover { border-color: var(--line-strong); background: color-mix(in srgb, var(--surface) 82%, var(--surface-soft)); }
.custom-select-trigger:focus-visible,
.custom-select.is-open .custom-select-trigger { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.custom-select-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: var(--muted);
    transition: transform .18s var(--ease), color .18s var(--ease);
}
.custom-select.is-open .custom-select-icon { transform: rotate(90deg); color: var(--primary); }
.custom-select-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 40;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
    transform-origin: top center;
    animation: customSelectIn .16s var(--ease);
}
.custom-select-menu[hidden] { display: none; }
.custom-select-option {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    text-align: left;
    transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.custom-select-option:hover,
.custom-select-option:focus-visible {
    background: var(--surface-soft);
}
.custom-select-option.is-selected {
    background: color-mix(in srgb, var(--primary-soft) 88%, var(--surface));
    color: var(--primary-strong);
    font-weight: 700;
}
.custom-select-check {
    width: 16px;
    height: 16px;
    color: currentColor;
    opacity: 0;
}
.custom-select-option.is-selected .custom-select-check { opacity: 1; }
html[data-theme="dark"] .custom-select-menu {
    background: color-mix(in srgb, var(--surface) 88%, #07101f);
}
@keyframes customSelectIn {
    from { opacity: 0; transform: translateY(-4px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
