/* Shared responsive form and field behavior. */
:where(form, .responsive-form-scope),
:where(form, .responsive-form-scope) :where(.se-input-wrap, .se-searchable-select, .crm-fu-form-field) {
    min-width: 0;
    max-width: 100%;
}

:where(form, .responsive-form-scope) :where(input, select, textarea, .se-field, .se-input, .se-searchable-select__trigger) {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}

:where(form, .responsive-form-scope) :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
:where(form, .responsive-form-scope) .se-searchable-select__trigger {
    width: 100%;
}

:where(form, .responsive-form-scope) textarea {
    resize: vertical;
}

:where(form, .responsive-form-scope) :where(input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"]) {
    inline-size: 100%;
    min-inline-size: 0;
}

:where(form, .responsive-form-scope) input[type="file"] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:where(form, .responsive-form-scope) input[type="file"]::file-selector-button {
    min-height: 40px;
    margin-inline-end: 10px;
    border: 0;
    border-radius: 10px;
    padding-inline: 12px;
    font: inherit;
    cursor: pointer;
}

:where(form, .responsive-form-scope) input[type="search"] {
    appearance: none;
}

:where(form, .responsive-form-scope) .se-searchable-select__trigger {
    width: 100% !important;
}

:where(form, .responsive-form-scope) .se-searchable-select__panel {
    width: 100%;
    min-width: 100%;
    max-width: min(100%, calc(100vw - 32px));
    overflow-x: hidden;
}

:where(form, .responsive-form-scope) .se-searchable-select__option {
    overflow-wrap: anywhere;
    white-space: normal;
}

.responsive-auto-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 12px;
}

.responsive-two-column-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.responsive-form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media screen and (max-width: 1024px) {
    form .crm-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media screen and (max-width: 640px) {
    :where(form, .responsive-form-scope) :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .se-field, .se-input, .se-searchable-select__trigger) {
        font-size: 16px !important;
    }

    form .se-grid-2,
    form .crm-form-grid,
    form [class*="-form-grid"],
    form [class*="__form-grid"],
    form .tv1-employee-modal__grid,
    form .tv1-employee-show-modal__salary-grid,
    form .tv1-employee-show-modal__withdraw-grid,
    form .tv1-employee-side-modal__report-grid,
    form .tv1-employee-side-modal__bulk-salary-grid,
    form .tv1-employee-side-modal__bulk-withdraw-grid,
    form .regions-followup-grid,
    form .regions-form-grid,
    form .se-company-profile-grid,
    form .se-company-profile-assets,
    #employee-report-modal .tv1-employee-side-modal__report-grid,
    #employee-bulk-salary-modal .tv1-employee-side-modal__bulk-salary-grid,
    #employee-bulk-withdraw-modal .tv1-employee-side-modal__bulk-withdraw-grid,
    .responsive-auto-form-grid,
    .responsive-two-column-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-areas: none !important;
    }

    form .tv1-employee-side-modal__report-grid > *,
    form .tv1-employee-side-modal__bulk-salary-grid > *,
    form .tv1-employee-side-modal__bulk-withdraw-grid > * {
        grid-area: auto !important;
    }

    #employee-report-modal .tv1-employee-side-modal__report-grid > *,
    #employee-bulk-salary-modal .tv1-employee-side-modal__bulk-salary-grid > *,
    #employee-bulk-withdraw-modal .tv1-employee-side-modal__bulk-withdraw-grid > * {
        grid-area: auto !important;
    }

    .responsive-form-spacer {
        display: none !important;
    }

    .responsive-form-actions {
        align-items: stretch;
        width: 100%;
    }

    .responsive-form-actions > :where(button, a, .se-btn),
    .responsive-form-actions > a > :where(button, .se-btn) {
        width: 100%;
        justify-content: center;
    }

    :where(form, .responsive-form-scope) input[type="file"]::file-selector-button {
        min-height: 44px;
    }
}

