/* Ajustes de distribución móvil. Se conserva la estética de cada módulo. */
@media (max-width: 991.98px) {
    .config-layout { grid-template-columns: minmax(0, 1fr); }
    .config-layout > *, .config-layout .card, .config-layout .card-body { min-width: 0; max-width: 100%; }
    .config-menu-heading { grid-column: 1 / -1; }
    .config-menu a { min-width: 0; padding: .65rem .5rem; overflow-wrap: anywhere; }
    .config-layout > section > .row { margin-inline: 0; }
    .config-layout .profile-summary { padding: 1rem; }
    .config-layout .profile-summary-copy, .config-layout .profile-summary-meta > span { overflow-wrap: anywhere; }
    .config-layout .profile-account-list > div { flex-wrap: wrap; gap: .3rem .7rem; }
    .config-layout .profile-account-list dd { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
    .config-layout .processor-console-header > div { min-width: 0; }
    .config-layout .processor-console-meta span { white-space: normal; overflow-wrap: anywhere; }
    .config-layout .processor-console-topline { flex-wrap: wrap; gap: .3rem .7rem; }
    .config-layout .processor-console-topline > span { min-width: 0; overflow-wrap: anywhere; }
    .config-layout .processor-console-output { min-width: 0; white-space: normal; }
    .config-layout .processor-log-row { grid-template-columns: 1rem 5rem minmax(0, 1fr); gap: .3rem; }
    .config-layout .processor-log-message { grid-column: 2 / -1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
    .config-layout .processor-console-scroll { min-height: 12rem; max-height: 55vh; }
}
@media (max-width: 767.98px) {
    .modern-detail-page--cliente .modern-detail-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; }
    .modern-detail-page--cliente .modern-detail-hero__content { width: 100%; min-width: 0; }
    .modern-detail-page--cliente .modern-detail-hero__title { overflow-wrap: anywhere; }
    .modern-detail-page--cliente .modern-detail-hero__meta { flex-wrap: wrap; }
    .modern-detail-page--cliente .modern-detail-hero__meta > span { min-width: 0; overflow-wrap: anywhere; }
    .modern-detail-page--cliente .modern-detail-back { grid-column: 1 / -1; justify-self: end; }
    .modern-detail-page--cliente .modern-detail-kpis { grid-template-columns: minmax(0, 1fr); }
    .modern-detail-page--cliente .modern-detail-kpi__meta { flex-wrap: wrap; }
    .modern-detail-page--cliente .modern-detail-kpi__meta span,
    .modern-detail-page--cliente .modern-detail-kpi__meta b { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
    .modern-detail-page--cliente .encargo-header .header-left { min-width: 0; max-width: 100%; flex-shrink: 1; }
    .modern-detail-page--cliente .encargo-header .header-title { white-space: normal; }
    .modern-detail-page--cliente .tabla-notas { width: 100% !important; min-width: 0 !important; max-width: 100%; }
    .modern-detail-page--cliente .tabla-notas colgroup { display: none; }
    .modern-detail-page--cliente .tabla-notas tbody,
    .modern-detail-page--cliente .tabla-notas tbody tr { width: 100%; min-width: 0; }
    .modern-detail-page--cliente .tabla-notas tbody td { width: auto !important; min-width: 0; }

    /* Los controles mantienen su ancho útil dentro de los formularios modales. */
    #formGasto, #formFestivoPlataforma, .economia-trabajo-panel { min-width: 0; max-width: 100%; }
    #formGasto .bootstrap-select, #formFestivoPlataforma .bootstrap-select { width: 100% !important; }
    #formGasto .dropdown-toggle, #formFestivoPlataforma .dropdown-toggle { min-height: 44px; }
    #formGasto > .text-right, #formFestivoPlataforma > .text-right { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
    .economia-trabajo-panel .input-group { display: flex; flex-direction: row; flex-wrap: nowrap; }
    .economia-trabajo-panel .input-group > .form-control { width: 1% !important; min-width: 0; flex: 1 1 auto; }
    .economia-trabajo-panel .input-group > .input-group-append { width: auto; flex: 0 0 auto; }
    .economia-trabajo-panel .economia-movement-form .form-row > [class*="col-"] { min-width: 0; max-width: 100%; }
    .economia-trabajo-panel .economia-movement-form .bootstrap-select { width: 100% !important; }
    /* La tabla también puede estar dentro del contenedor del filtro general. */
    .economia-trabajo-panel .economia-movement-table { display: block; width: 100% !important; min-width: 0 !important; max-width: 100%; }
    .economia-trabajo-panel .economia-movement-table > colgroup { display: none; }
    .economia-trabajo-panel .economia-movement-table tbody,
    .economia-trabajo-panel .economia-movement-table tbody tr { width: 100%; min-width: 0; }
    .economia-trabajo-panel .economia-movement-table tbody td { width: auto !important; min-width: 0; }

    .gastos-page > .d-flex > .mt-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; width: 100%; }
    .gastos-page > .d-flex > .mt-2 > .btn { margin: 0; min-width: 0; }
    .gastos-page .control-card { min-width: 0; }

    /* Filas completas en móvil; las tablas y filtros de escritorio siguen iguales. */
    #vacacionesFestivos .interactive-table-wrap,
    .gastos-page .control-obra-table-wrap { max-height: none; overflow: visible; }
    #tablaFestivos, #tablaGastos { display: block; width: 100% !important; min-width: 0 !important; max-width: 100%; table-layout: auto; }
    #tablaFestivos > colgroup, #tablaFestivos > thead,
    #tablaGastos > colgroup, #tablaGastos > thead { display: none; }
    #tablaFestivos > tbody, #tablaGastos > tbody { display: block; width: 100%; }
    #tablaFestivos > tbody > tr, #tablaGastos > tbody > tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; padding: .8rem; width: 100%; min-width: 0; height: auto !important; border-bottom: 1px solid #dee2e6; }
    #tablaFestivos > tbody > tr[hidden], #tablaGastos > tbody > tr[hidden] { display: none; }
    #tablaFestivos td, #tablaGastos td { min-width: 0; width: auto !important; max-width: none !important; height: auto !important; padding: 0; border: 0; white-space: normal !important; text-align: left !important; overflow-wrap: anywhere; }
    #tablaFestivos td[data-label], #tablaGastos td[data-label] { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; }
    #tablaFestivos td[data-label]::before, #tablaGastos td[data-label]::before { content: attr(data-label); font-weight: 700; font-size: .72rem; }
    #tablaFestivos td[data-label="Nombre"], #tablaFestivos td[data-label="Observaciones"],
    #tablaGastos td[data-label="Concepto"], #tablaGastos td[data-label="Proveedor"],
    #tablaFestivos td[colspan], #tablaGastos td[colspan] { grid-column: 1 / -1; }
    #tablaFestivos td[data-label="Acciones"], #tablaGastos td[data-label="Acciones"] { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: .4rem; }
    #tablaFestivos td[data-label="Acciones"]::before, #tablaGastos td[data-label="Acciones"]::before { width: 100%; }
    #tablaFestivos td .btn, #tablaGastos td .btn { max-width: 100%; min-height: 44px; margin: 0; }
    #tablaFestivos td > *, #tablaGastos td > * { max-width: 100%; white-space: normal; }
}
@media (max-width: 359.98px) {
    body.regal-app-layout .layout-actions-list { gap: 3px; }
    body.regal-app-layout .layout-actions-list .nav-item { flex: 0 0 38px; width: 38px; }
    body.regal-app-layout .layout-top-actions :is(.layout-action-button, .layout-menu-toggle, #btnNotificationsBell) { min-width: 38px !important; width: 38px !important; padding-inline: 0 !important; }
}
