/*
 * Shared ERP form containers.
 *
 * Layout is opt-in through .erp-form-v2. Individual CRUD files decide the
 * grid/rows; this layer supplies only safe structural primitives.
 */
.app-shell .erp-form-v2 {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--erp-ui-field-gap);
    min-width: 0;
}

.app-shell .erp-form-v2 .erp-inline-control {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.app-shell .erp-form-v2 .erp-inline-control > :first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.app-shell .erp-form-v2 .erp-inline-control > .master-link-button {
    flex: 0 0 30px;
}

/* Barras de filtros de los listados ERP. */
.app-shell .erp-page .master-list-toolbar > .list-toolbar-search,
.app-shell .erp-page .master-list-toolbar > .list-toolbar-limit,
.app-shell .erp-page .master-list-toolbar > .sap-field {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 6px !important;
    row-gap: 3px !important;
    min-width: 0 !important;
}

.app-shell .erp-page .master-list-toolbar > .list-toolbar-search > label,
.app-shell .erp-page .master-list-toolbar > .list-toolbar-limit > label,
.app-shell .erp-page .master-list-toolbar > .sap-field > label {
    grid-column: 1 !important;
    width: 72px !important;
    min-width: 72px !important;
    margin: 0 !important;
    text-align: left !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-shell .erp-page .master-list-toolbar > .list-toolbar-search > :not(label),
.app-shell .erp-page .master-list-toolbar > .list-toolbar-limit > :not(label),
.app-shell .erp-page .master-list-toolbar > .sap-field > :not(label) {
    grid-column: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

@media (max-width: 720px) {
    .app-shell .erp-page .master-list-toolbar > .list-toolbar-search,
    .app-shell .erp-page .master-list-toolbar > .list-toolbar-limit,
    .app-shell .erp-page .master-list-toolbar > .sap-field {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
    }

    .app-shell .erp-page .master-list-toolbar > .list-toolbar-search > label,
    .app-shell .erp-page .master-list-toolbar > .list-toolbar-limit > label,
    .app-shell .erp-page .master-list-toolbar > .sap-field > label {
        width: auto !important;
        min-width: 0 !important;
    }
}

/* Mensajes modales persistentes y reutilizables de todo el ERP. */
.erp-message-popup .dxbl-popup,
.erp-message-popup .dxbl-modal {
    width: min(520px, 94vw) !important;
    max-width: 94vw !important;
}

.erp-message-popup-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-height: 72px;
    padding: 12px 4px;
}

.erp-message-popup-text {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 7px;
    color: #25324a;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.erp-message-popup-icon {
    display: inline-flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
}

.erp-message-popup-error .erp-message-popup-icon {
    color: #d92d3a;
}

.erp-message-popup-warning .erp-message-popup-icon {
    border-radius: 8px;
    color: #d97706;
}

.erp-message-popup-plain .erp-message-popup-content {
    min-height: 54px;
}

.erp-message-popup-plain .erp-message-popup-text {
    padding-top: 4px;
}
