/* Shared AmanPay fields. Values, input types and mask logic remain component-owned. */
.aman-field-control:not(.phone-mask-visible),
.aman-phone-field {
    box-sizing: border-box;
    min-height: 3.75rem !important;
    height: auto;
    border: 1px solid transparent;
    border-radius: 14px !important;
    background-color: #f5f6f8;
    color: #151c2b;
    padding: 1rem;
    font-size: 1rem;
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
.aman-field-control:not(.phone-mask-visible):focus,
.aman-phone-field:focus-within {
    border-color: #8172f4;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgb(88 69 237 / 10%);
}
.aman-floating-field { position: relative; }
.aman-floating-field > .aman-floating-label,
.aman-floating-field[data-aman-caption]::before {
    position: absolute !important;
    z-index: 32;
    left: 1rem;
    top: .6rem;
    margin: 0 !important;
    max-width: calc(100% - 2rem);
    color: #697386;
    font-size: 1rem;
    line-height: 1.2;
    font-weight: 400 !important;
    transform: translateY(.65rem);
    transform-origin: left top;
    pointer-events: none;
    transition: transform 180ms ease, color 180ms ease;
}
.aman-floating-field[data-aman-caption]::before { left: var(--aman-caption-left, 1rem); top: var(--aman-caption-top, .6rem); max-width: var(--aman-caption-width, calc(100% - 2rem)); content: attr(data-aman-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aman-floating-field .aman-field-control:not(.phone-mask-visible) {
    padding: var(--aman-label-padding, 1.6rem) 1rem .5rem !important;
}
.aman-floating-field[data-aman-caption].aman-label-raised::before,
.aman-floating-field[data-aman-caption]:focus-within::before,
.aman-floating-field[data-aman-caption]:has(input:not(:placeholder-shown), textarea:not(:placeholder-shown))::before,
.aman-floating-field:focus-within > .aman-floating-label,
.aman-floating-field:has(input:not(:placeholder-shown), textarea:not(:placeholder-shown)) > .aman-floating-label,
.aman-floating-field.aman-label-raised > .aman-floating-label {
    transform: scale(.78);
}
.aman-floating-field[data-aman-caption]:focus-within::before,
.aman-floating-field:focus-within > .aman-floating-label { color: #5845ed; }
.aman-floating-field .aman-caption-placeholder::placeholder { color: transparent; }
/* Keep existing mask examples, but reveal them only after the label has risen. */
.aman-floating-field:not(:focus-within) .aman-field-control::placeholder { color: transparent; }
.aman-floating-field .app-select__trigger {
    padding-right: 3.25rem !important;
}
.aman-field-control.app-select__trigger { padding-right: 3.25rem; }
.app-select:has(> .aman-field-control) .app-select__chevron {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
}
select.aman-field-control {
    appearance: none;
    padding-right: 3.25rem !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23697386' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 18px 18px;
    background-position: right 1.25rem center;
}
select.aman-field-control.is-invalid, select.aman-field-control.invalid {
    padding-right: 4.5rem !important;
    background-position: right 1.25rem center, right 3rem center;
}
.aman-phone-field { padding: 0; overflow: hidden; }
.aman-phone-field .phone-mask-country-flag { min-width: 2.75rem; border-right: 0; }
.aman-phone-field .phone-mask-visible { box-sizing: border-box; min-height: calc(3.75rem - 2px); height: auto; padding: 1rem; font-size: 1rem; }
.aman-floating-phone > .aman-floating-label { left: 3.75rem; max-width: calc(100% - 4.75rem); }
.aman-floating-phone .phone-mask-visible { padding: var(--aman-label-padding, 1.6rem) 1rem .5rem; }
.aman-floating-field .app-search-input__field { padding-right: 3rem !important; }
.aman-floating-field .password-input > .aman-field-control { padding-right: 3rem !important; }
textarea.aman-field-control { min-height: 6.5rem !important; resize: vertical; }
.aman-field-control:disabled, .aman-field-control[readonly] { color: #697386; background-color: #f0f1f4; }
.aman-field-control.invalid, .aman-field-control.is-invalid, .aman-field-control[aria-invalid="true"] { border-color: #dc3545; }
.aman-floating-field:has(.invalid, .is-invalid, [aria-invalid="true"]) > .aman-floating-label { color: #c82e40; }
/* Joined controls retain the group's shape and its shared label. */
.input-group > .aman-field-control { border-radius: 0 !important; }
.input-group > .aman-field-control:first-child { border-radius: 14px 0 0 14px !important; }
.input-group > .aman-field-control:last-child { border-radius: 0 14px 14px 0 !important; }
@media (prefers-reduced-motion: reduce) {
    .aman-field-control, .aman-phone-field, .aman-floating-field > .aman-floating-label, .aman-floating-field[data-aman-caption]::before { transition: none !important; }
}

/* Product search has an icon in its own flex cell; skin its outer shell. */
.aman-icon-field.item-search-field {
    min-height: 3.75rem !important;
    height: auto !important;
    border-radius: 14px;
    background-color: #f5f6f8;
}
.aman-icon-field .aman-field-control {
    min-height: 3.75rem !important;
    height: auto !important;
    padding-block: var(--aman-label-padding, 1.6rem) .5rem !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.aman-icon-field[data-aman-caption]::before { left: var(--aman-caption-left, 3rem); max-width: var(--aman-caption-width, calc(100% - 4rem)); }
.aman-floating-phone[data-aman-caption]::before { left: var(--aman-caption-left, 3.75rem); max-width: var(--aman-caption-width, calc(100% - 4.75rem)); }
.aman-floating-field .stock-nom-picker__input { padding-right: 3rem !important; }

/* The fill defines idle fields; keep borders for focus and validation only. */
.aman-field-control:not(.phone-mask-visible):not(:focus):not(.invalid):not(.is-invalid):not([aria-invalid="true"]),
.aman-phone-field:not(:focus-within):not(:has(.invalid, .is-invalid, [aria-invalid="true"])),
.aman-icon-field:not(:focus-within):not(:has(.invalid, .is-invalid, [aria-invalid="true"])) {
    border-color: transparent !important;
}

/* White fields on a gray page, card or gradient. .aman-on-gray forces that on a chosen block. */
.aman-field-control.aman-field-on-gray:not(.phone-mask-visible),
.aman-phone-field.aman-field-on-gray,
.aman-icon-field.aman-field-on-gray,
.aman-on-gray .aman-field-control:not(.phone-mask-visible),
.aman-on-gray .aman-phone-field,
.aman-on-gray .aman-icon-field {
    background-color: #fff;
}

/* Labeled form dates use the whole date control, never the inner mask alone. */
.aman-date-caption-source {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip-path: inset(50%);
    white-space: nowrap;
}
div.app-date.aman-date-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1.75rem;
    row-gap: 0;
    column-gap: .5rem;
    width: 100% !important;
    min-height: 3.75rem !important;
    height: auto !important;
    max-height: none !important;
    padding: .6rem 1rem .5rem !important;
    border: 1px solid transparent;
    border-radius: 14px;
    background: #f5f6f8;
    font-size: 1rem;
    font-weight: 400;
}
.app-date.aman-date-field::before {
    content: attr(data-date-caption);
    position: static;
    grid-column: 1;
    grid-row: 1;
    max-width: 100%;
    font-size: .78rem;
    line-height: 1.2;
    color: #697386;
    pointer-events: none;
}
.app-date.aman-date-field .app-date__input {
    grid-column: 1;
    grid-row: 2;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: auto;
    background: transparent;
}
.app-date.aman-date-field .app-date__icon {
    position: static;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    transform: none;
}
.app-date.aman-date-field.aman-field-on-gray,
.aman-on-gray .app-date.aman-date-field { background: #fff; }
.app-date.aman-date-field:focus-within { border-color: #8172f4; background: #fff; }
.app-date.aman-date-field:focus-within::before { color: #5845ed; }
.app-date.aman-date-field:is(.invalid, .is-invalid) { border-color: #dc3545; }
/* Blazor adds .valid.modified after a date change; keep the idle fill, same as other fields. */
.app-date.aman-date-field:not(:focus-within):not(.invalid):not(.is-invalid) {
    border-color: transparent !important;
}

/* Селекты фильтров ДДС и бух. книги — обычная высота поля, не карточка формы. */
.balance-ops-history-filters-panel :is(select, .app-select__trigger).aman-field-control,
.balance-ledger-filters-panel :is(select, .app-select__trigger).aman-field-control {
    box-sizing: border-box;
    height: var(--field-control-h) !important;
    min-height: var(--field-control-h) !important;
    max-height: var(--field-control-h);
    padding: 0 2.25rem 0 0.75rem !important;
    border-radius: var(--radius-md, 0.5rem) !important;
    font-size: var(--fs-ui, 0.95rem);
}

/* Autofill may paint a value before placeholder state/input events settle. */
.aman-floating-field:has(input:autofill) > .aman-floating-label,
.aman-floating-field[data-aman-caption]:has(input:autofill)::before {
    transform: scale(.78);
}
.aman-floating-field:has(input:-webkit-autofill) > .aman-floating-label,
.aman-floating-field[data-aman-caption]:has(input:-webkit-autofill)::before {
    transform: scale(.78);
}

/* Entity pickers are styled as a unit, leaving dropdowns and handlers intact. */
.client-search-picker .input-group.entity-picker-field,
.product-item-selector .entity-picker-field.item-search-field,
.product-item-selector .entity-picker-field.selected-product-card {
    position: relative !important;
    box-sizing: border-box;
    width: 100%;
    min-height: 3.75rem !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    border: 1px solid transparent;
    border-radius: 14px;
    background: #f5f6f8;
    overflow: visible;
}
.client-search-picker .entity-picker-field.entity-picker-on-gray,
.product-item-selector .entity-picker-field.entity-picker-on-gray,
.aman-on-gray .entity-picker-field { background: #fff; }
.entity-picker-field .entity-picker-caption {
    position: absolute;
    top: .6rem;
    left: 3rem;
    max-width: calc(100% - 6rem);
    margin: 0;
    font-size: .78rem;
    font-weight: 400;
    line-height: 1.2;
    color: #697386;
    pointer-events: none;
}
.client-search-picker .input-group.entity-picker-field input.form-control,
.product-item-selector .item-search-field.entity-picker-field input.item-search-field__input,
.product-item-selector .selected-product-card.entity-picker-field .selected-product-link {
    display: block !important;
    box-sizing: border-box;
    flex: 1 1 auto;
    width: 100% !important;
    min-width: 0;
    min-height: calc(3.75rem - 2px) !important;
    height: auto !important;
    padding: var(--entity-value-top, 1.6rem) 3rem .5rem 3rem !important;
    margin: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 1rem;
    line-height: 1.5;
    text-align: left;
}
.entity-picker-field .input-group-text,
.entity-picker-field .item-search-field__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 !important;
    z-index: 1;
    border: 0;
    background: transparent;
}
.entity-picker-field .client-search-picker__clear,
.entity-picker-field .selected-product-clear {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    background: transparent;
    z-index: 2;
}
.entity-picker-field.selected-product-card .entity-picker-caption { left: 1rem; max-width: calc(100% - 4rem); }
.entity-picker-field.selected-product-card .selected-product-link { padding-left: 1rem !important; }
.entity-picker-field:focus-within { border-color: #8172f4; box-shadow: 0 0 0 3px rgb(88 69 237 / 10%); }
.entity-picker-field:focus-within .entity-picker-caption { color: #5845ed; }
