/* Capa responsive compartida. Las reglas de escritorio permanecen en custom.css. */

.gw-mobile-table-scroll {
    max-width: 100%;
    overflow: visible;
}

.gw-mobile-filter-toggle {
    display: none;
}

.gw-provider-card-label {
    display: none;
}

/* La columna de datos puede encogerse sin empujar el icono en escritorio. */
@media screen {
    .gw-resumen-stock-card .col {
        min-width: 0;
        margin-right: 0 !important;
    }
}

/* En pantallas compactas el icono decorativo compite con el detalle de stock.
   Escritorio e impresión conservan el formato original. */
@media screen and (max-width: 991.98px) {
    .gw-resumen-stock-card .col-auto {
        display: none;
    }
}

@media screen and (max-width: 991.98px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
        overflow-x: clip;
    }

    body {
        min-height: 100dvh;
    }

    body > .container-fluid {
        max-width: 100%;
        padding-right: max(0.75rem, env(safe-area-inset-right));
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
        padding-left: max(0.75rem, env(safe-area-inset-left));
    }

    .top-empresa-banner {
        padding-right: max(0.5rem, env(safe-area-inset-right));
        padding-left: max(0.5rem, env(safe-area-inset-left));
    }

    .top-empresa-demo-badge-left {
        left: max(0.75rem, env(safe-area-inset-left));
    }

    .top-empresa-demo-badge-right {
        right: max(0.75rem, env(safe-area-inset-right));
    }

    .mensajes-panel {
        right: env(safe-area-inset-right);
        width: min(430px, calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right)));
        height: 100dvh;
    }

    .mensajes-panel-header {
        padding-top: max(0.85rem, env(safe-area-inset-top));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-left: max(1rem, env(safe-area-inset-left));
    }

    .mensajes-panel-body {
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
    }

    .navbar {
        padding-top: max(0.25rem, env(safe-area-inset-top));
        padding-right: env(safe-area-inset-right);
        padding-left: env(safe-area-inset-left);
    }

    .navbar > .container-fluid {
        min-width: 0;
    }

    .navbar-collapse {
        max-height: calc(100dvh - 54px - env(safe-area-inset-top));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .navbar .navbar-nav {
        flex-wrap: nowrap !important;
        width: 100%;
    }

    .navbar .navbar-nav.ms-auto {
        width: 100%;
        margin: 0 !important;
        padding: 0.5rem 0 0 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.3);
        border-left: 0 !important;
    }

    .navbar .navbar-nav.ms-auto .nav-item,
    .navbar .navbar-nav.ms-auto .d-flex {
        width: 100%;
        height: auto;
    }

    .navbar-nav .dropdown-menu {
        position: static !important;
        width: 100%;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none !important;
    }

    .navbar-nav > .dropdown > .dropdown-menu {
        padding: 0.25rem 0 0.5rem 0.75rem;
        background: rgba(255, 255, 255, 0.98);
    }

    .dropdown-submenu {
        position: static !important;
    }

    .dropdown-submenu > .dropdown-menu,
    .dropdown-submenu:hover > .dropdown-menu {
        display: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 0 0.25rem 0.75rem;
        background-color: rgba(13, 110, 253, 0.06);
    }

    .dropdown-submenu.show > .dropdown-menu {
        display: block !important;
    }

    .dropdown-submenu > a > .bi-chevron-right {
        transition: transform 0.2s ease;
    }

    .dropdown-submenu.show > a > .bi-chevron-right {
        transform: rotate(90deg);
    }

    .page-header,
    .page-header.d-flex,
    .page-header > .d-flex,
    .gw-route-cajas .mb-2 > .d-flex:first-child,
    .gw-route-reportes .mb-4 > .d-flex:first-child {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-header h1,
    .page-header h2,
    .gw-route-reportes h1,
    .modal-title {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .page-header > .d-flex,
    .gw-route-cajas .mb-2 > .d-flex:first-child > .d-flex,
    .gw-route-reportes .mb-4 > .d-flex:first-child > .d-flex {
        max-width: 100%;
        flex-wrap: wrap;
    }

    .gw-costos-filter-summary,
    .gw-costos-filter-tools {
        min-width: 0;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .gw-costos-filter-summary > div:first-child {
        flex: 1 1 110px;
        min-width: 0;
    }

    .gw-costos-filter-tools {
        flex: 1 1 220px;
        justify-content: flex-end;
    }

    .gw-costos-filter-tools .form-check {
        flex: 1 1 160px;
        min-width: 0;
        margin-right: 0 !important;
    }

    .form-control,
    .form-select,
    .input-group,
    .select2-container,
    canvas,
    svg,
    img {
        max-width: 100%;
    }

    select.select2-hidden-accessible + .select2-container {
        width: 100% !important;
    }

    .table-responsive,
    .table-responsive-custom,
    .table-container,
    .table-body-wrapper,
    .modal-tabla-container,
    .gw-mobile-table-scroll {
        max-width: 100%;
        overflow-x: auto !important;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .gw-mobile-table-scroll > table,
    .table-responsive > table,
    .table-responsive-custom > table,
    .table-container > table,
    .modal-tabla-container > table {
        width: max(100%, var(--gw-mobile-table-min-width, 100%));
        margin-bottom: 0;
    }

    table.gw-mobile-table-wide,
    #dataTable.gw-mobile-table-wide {
        width: max(100%, var(--gw-mobile-table-min-width, 680px)) !important;
        min-width: var(--gw-mobile-table-min-width, 680px) !important;
        max-width: none !important;
    }

    .gw-listado.gw-listado-tabla-partida .table-container {
        overflow-x: auto !important;
        overflow-y: hidden !important;
    }

    .gw-listado.gw-listado-tabla-partida .table-container .table-header,
    .gw-listado.gw-listado-tabla-partida .table-container .table-body-wrapper table {
        width: max(100%, var(--gw-mobile-table-min-width, 760px));
        min-width: 760px;
    }

    .gw-listado.gw-listado-tabla-partida .table-container .table-body-wrapper {
        overflow-x: visible !important;
    }

    .modal-dialog {
        width: auto;
        max-width: calc(100vw - 1rem - env(safe-area-inset-left) - env(safe-area-inset-right));
        margin: max(0.5rem, env(safe-area-inset-top)) auto max(0.5rem, env(safe-area-inset-bottom));
    }

    .modal-content {
        max-height: calc(100dvh - 1rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow: hidden;
    }

    .modal-body {
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 2;
        flex: 0 0 auto;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
        background: var(--bs-modal-bg, #fff);
    }

    .modal-tabla-container,
    .modal .table-responsive,
    .modal .gw-mobile-table-scroll {
        max-height: 58dvh;
    }

    .gw-route-cajas > .container-fluid,
    .gw-route-reportes > .container-fluid {
        min-width: 0;
    }

    .gw-route-cajas .mb-2 > .d-flex:first-child {
        align-items: flex-start !important;
    }

    .gw-route-cajas .mb-2 > .d-flex:first-child > .d-flex {
        width: 100%;
        margin-left: 0 !important;
    }

    .gw-route-cajas .mb-2 > .d-flex:first-child > .d-flex:last-child > div[style*="min-width"] {
        min-width: 0 !important;
        flex: 1 1 150px;
    }

    .gw-route-cajas .table-container,
    .gw-route-compras .table-container,
    .gw-route-comprobantes .table-container,
    .gw-route-reportes .table-container {
        max-height: 62dvh;
    }

    .gw-route-cajas table,
    .gw-route-compras table,
    .gw-route-comprobantes table,
    .gw-route-reportes .modal table {
        --gw-mobile-table-min-width: 860px;
    }

    .gw-route-reportes .mb-4 > .d-flex:first-child {
        align-items: flex-start !important;
    }

    .gw-route-reportes .mb-4 > .d-flex:first-child > .d-flex {
        justify-content: flex-start !important;
    }

    .gw-route-reportes .card-body,
    .gw-route-reportes .row > * {
        min-width: 0;
    }

    .gw-resumen-stock-card .text-xs > table {
        display: block;
        width: 100% !important;
        max-width: 100%;
    }

    .gw-resumen-stock-card .text-xs > table tbody {
        display: block;
    }

    .gw-resumen-stock-card .text-xs > table tr {
        display: grid;
        grid-template-columns: minmax(96px, auto) repeat(2, minmax(0, 1fr));
        column-gap: 0.2rem;
        width: 100%;
    }

    .gw-resumen-stock-card .text-xs > table td {
        display: block;
        width: auto !important;
        min-width: 0 !important;
        padding-right: 0.2rem !important;
        overflow-wrap: anywhere;
    }

    .gw-resumen-stock-card .text-xs > table td:first-child {
        padding-right: 0.35rem !important;
        overflow-wrap: normal;
        white-space: nowrap;
    }

    .gw-resumen-stock-card .text-xs > table td > span {
        display: flex;
        min-width: 0;
        align-items: center;
        gap: 0.15rem;
        white-space: nowrap;
    }

    .gw-resumen-stock-card .text-xs > table td > span > i {
        flex: 0 0 0.7rem;
        margin-right: 0 !important;
        text-align: center;
    }

    #tablaLineasWrapper.gw-mobile-table-scroll {
        overflow-x: auto !important;
    }

    #tablaLineas.gw-mobile-table-wide {
        width: max(100%, 520px) !important;
        min-width: 520px !important;
    }

    #tablaLineas .col-codigo {
        width: 15% !important;
    }

    #tablaLineas .col-descripcion {
        width: 58% !important;
    }

    #tablaLineas .col-cantidad {
        width: 15% !important;
    }

    #tablaLineas .col-accion {
        width: 12% !important;
    }

    .gw-route-config-factura-rapida .config-search-focus > .d-flex.justify-content-between {
        min-width: 0;
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem;
    }

    .gw-route-config-factura-rapida .config-search-focus .config-list-item-text,
    .gw-route-config-factura-rapida .config-search-focus .config-list-item-title {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .gw-route-config-factura-rapida .config-search-focus .btn-group-toggle {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        min-width: 0;
    }

    .gw-route-config-factura-rapida .config-search-focus .btn-group-toggle .btn {
        min-width: 0 !important;
        padding-right: 0.35rem;
        padding-left: 0.35rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media screen and (max-width: 767.98px) {
    .gw-route-comprobantes #seccion_datos > .card-header .d-flex {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 0.125rem;
    }

    .gw-route-comprobantes #header_punto_venta_info {
        position: static !important;
        transform: none !important;
        max-width: 100%;
        font-size: 0.78rem;
        overflow-wrap: anywhere;
    }

    body > .container-fluid {
        margin-top: 0.75rem !important;
    }

    .gw-listado {
        height: auto;
        min-height: calc(100dvh - 74px);
        overflow: visible;
    }

    .gw-listado .page-content,
    .gw-listado .table-card,
    .gw-listado .table-card .card-body {
        min-height: 0;
        overflow: visible;
    }

    .gw-listado .table-container {
        max-height: 64dvh;
        min-height: 12rem;
    }

    .page-header,
    .page-header.d-flex {
        align-items: flex-start !important;
    }

    .page-header > .d-flex,
    .page-header.d-flex > .d-flex {
        width: 100%;
        justify-content: flex-start !important;
    }

    .gw-mobile-filter-toggle {
        display: flex;
        width: 100%;
        min-height: 44px;
        margin-bottom: 0.25rem;
        align-items: center;
        justify-content: space-between;
    }

    .gw-mobile-filters-collapsed {
        display: none;
    }

    .page-filters .row {
        row-gap: 0.5rem;
    }

    .page-filters [class*="col-"] {
        min-width: 0;
    }

    .page-filters .ms-auto {
        margin-left: 0 !important;
    }

    .card-body,
    .card-header,
    .card-footer {
        min-width: 0;
    }

    .modal-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
    }

    .gw-route-proveedores .page-filters .row > *,
    .gw-route-cajas .cajas-filtros-card .row > * {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }

    .gw-route-cajas .periodo-campo,
    .gw-route-cajas .periodo-campo .form-control,
    .gw-route-cajas .periodo-campo .form-select,
    .gw-route-cajas #periodoSelect {
        width: 100% !important;
        max-width: 100%;
    }

    .gw-route-config-encabezado .listado-container > .d-flex:first-child {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .gw-route-config-encabezado .listado-container > .d-flex:first-child > .d-flex {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .gw-route-config-encabezado .listado-container > .d-flex:first-child .btn {
        min-width: 0;
        white-space: normal;
    }

    .gw-route-config-encabezado #vistaListado > .card > .card-body {
        max-width: 100%;
        padding: 0.75rem;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .gw-route-config-encabezado .table-encabezados {
        width: 640px;
        min-width: 640px;
    }

    .gw-route-config-encabezado .editor-container > .d-flex:first-child {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .gw-route-config-encabezado .canvas-wrapper {
        height: auto;
        min-height: 0;
        flex-direction: column;
    }

    .gw-route-config-encabezado .editor-tools {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
    }

    .gw-route-config-encabezado .canvas-container {
        max-width: 100%;
        max-height: 62dvh;
        padding: 0.5rem;
        justify-content: flex-start;
        overflow: auto;
    }

    .gw-route-config-encabezado .design-canvas {
        flex: 0 0 794px;
    }

    .gw-route-config-encabezado .properties-panel {
        width: 100%;
        height: auto;
        max-height: 55dvh;
    }
}

/* En tablet vertical el dato del punto de venta comparte la línea sin pisar el título. */
@media screen and (min-width: 768px) and (max-width: 819.98px) and (orientation: portrait) {
    .gw-route-comprobantes #seccion_datos > .card-header .d-flex {
        flex-wrap: wrap;
        column-gap: 0.5rem;
        row-gap: 0.125rem;
    }

    .gw-route-comprobantes #header_punto_venta_info {
        position: static !important;
        transform: none !important;
    }
}

/* En vertical los formularios y filtros priorizan una sola columna, incluso en tablet. */
@media screen and (max-width: 991.98px) and (orientation: portrait) {
    .gw-mobile-filter-toggle {
        display: flex;
        width: 100%;
        min-height: 44px;
        margin-bottom: 0.25rem;
        align-items: center;
        justify-content: space-between;
    }

    .gw-mobile-filters-collapsed {
        display: none;
    }

    form .row > [class*="col-md-"],
    .page-filters .row > [class*="col-md-"] {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }

    form .form-control[style*="width"],
    form .form-select[style*="width"] {
        width: 100% !important;
    }

}

/* Los listados maestros se convierten en tarjetas sólo en teléfono vertical. */
@media screen and (max-width: 575.98px) and (orientation: portrait) {
    .gw-route-config-factura-rapida .container-fluid > .row:first-child .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .gw-route-config-factura-rapida .container-fluid > .row:first-child h1 {
        font-size: 1.45rem;
        overflow-wrap: anywhere;
    }

    .gw-route-config-factura-rapida .container-fluid > .row:first-child .btn {
        width: 100%;
    }

    .gw-route-config-factura-rapida .row.justify-content-center > .col-12 > .card > .card-body {
        padding: 0.75rem;
    }

    .gw-route-config-factura-rapida .config-section {
        max-width: 100%;
        padding: 0.75rem;
    }

    .gw-route-config-factura-rapida .config-list-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .gw-route-config-factura-rapida .config-list-item-text {
        min-width: 0;
        padding-right: 0;
        gap: 0.25rem;
    }

    .gw-route-config-factura-rapida .config-list-item-title {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .gw-route-config-factura-rapida .btn-group-toggle {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .gw-route-config-factura-rapida .config-list-item > .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem;
    }

    .gw-route-config-factura-rapida .btn-group-toggle .btn {
        min-width: 0 !important;
        padding-right: 0.35rem;
        padding-left: 0.35rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .gw-route-cajas #nuevoMovimientoForm .btn-group[role="group"] {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .gw-route-cajas #nuevoMovimientoForm .btn-group[role="group"] .btn {
        min-width: 0;
        padding-right: 0.25rem;
        padding-left: 0.25rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable tbody,
    .gw-route-proveedores table.gw-mobile-cards#dataTable tbody tr {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable tbody tr > td:not([colspan]) {
        display: flex !important;
        float: none !important;
        clear: both;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        gap: 0.75rem;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable tbody tr > td::before {
        content: attr(data-label) ":";
        flex: 0 0 38% !important;
        width: 38% !important;
        min-width: 38% !important;
        max-width: 38% !important;
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable .columna-razon-social,
    .gw-route-proveedores table.gw-mobile-cards#dataTable .columna-nombre {
        overflow-wrap: anywhere;
    }

    .gw-route-cajas .card-footer .btn.w-100 {
        display: flex;
        min-width: 0 !important;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        padding-right: 0.25rem !important;
        padding-left: 0.25rem !important;
        font-size: 0.75rem !important;
        line-height: 1.2;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .gw-route-cajas .card-footer .btn.w-100 .bi {
        flex: 0 0 auto;
        margin-right: 0 !important;
    }

    .gw-route-cajas .graficos-section .card-body {
        max-width: 100%;
        padding-right: 0.75rem;
        padding-left: 0.75rem;
        overflow: hidden;
    }

    .gw-route-cajas .graficos-section .chart-container,
    .gw-route-cajas .graficos-section canvas {
        width: 100% !important;
        max-width: 100% !important;
    }

    .gw-route-cajas .graficos-section .chart-container {
        overflow: hidden;
    }

    table.gw-mobile-cards {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        border: 0;
        background: transparent;
    }

    table.gw-mobile-cards thead {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }

    table.gw-mobile-cards tbody,
    table.gw-mobile-cards tr,
    table.gw-mobile-cards td {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
    }

    table.gw-mobile-cards tbody {
        padding: 0.25rem;
    }

    table.gw-mobile-cards tbody tr {
        margin-bottom: 0.75rem;
        overflow: hidden;
        border: 1px solid #d7dee7;
        border-radius: 0.625rem;
        background: #fff;
        box-shadow: 0 0.125rem 0.35rem rgba(0, 0, 0, 0.08);
    }

    table.gw-mobile-cards tbody tr:last-child {
        margin-bottom: 0;
    }

    table.gw-mobile-cards td {
        min-height: 44px;
        padding: 0.55rem 0.625rem !important;
        border: 0 !important;
        border-bottom: 1px solid #edf0f3 !important;
        overflow-wrap: anywhere;
    }

    table.gw-mobile-cards td:not([colspan]) {
        display: flex;
        align-items: flex-start;
        gap: 0.625rem;
    }

    table.gw-mobile-cards td:last-child {
        border-bottom: 0 !important;
    }

    table.gw-mobile-cards td::before {
        content: attr(data-label);
        flex: 0 0 38%;
        max-width: 38%;
        color: #495057;
        font-weight: 700;
        text-align: left;
    }

    table.gw-mobile-cards td[data-label=""]::before,
    table.gw-mobile-cards td:not([data-label])::before {
        display: none;
    }

    table.gw-mobile-cards td > .d-flex,
    table.gw-mobile-cards td > .btn-group {
        min-width: 0;
        flex: 1 1 auto;
        flex-wrap: wrap;
        justify-content: flex-start !important;
    }

    table.gw-mobile-cards .btn-compact {
        margin: 0.125rem;
    }

    /* El modo tarjeta no debe conservar el ancho mínimo que se usa para las
       tablas desplazables. El encabezado sigue disponible para lectores de
       pantalla, pero deja de participar en el cálculo de columnas. */
    table.gw-mobile-cards.gw-mobile-table-wide,
    #dataTable.gw-mobile-cards.gw-mobile-table-wide {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    table.gw-mobile-cards colgroup {
        display: none;
    }

    table.gw-mobile-cards thead,
    table.gw-mobile-cards thead tr,
    table.gw-mobile-cards thead th {
        display: block !important;
    }

    table.gw-mobile-cards tbody tr > td {
        min-width: 0 !important;
    }

    /* Proveedores conserva anchos mínimos de columnas configurables. Una grilla
       de una sola columna evita que el motor reconstruya celdas de tabla. */
    .gw-route-proveedores table.gw-mobile-cards#dataTable {
        table-layout: auto !important;
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable tbody tr {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable tbody tr > td:not([colspan]) {
        display: grid !important;
        grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
        align-items: center;
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable tbody tr > td::before {
        display: none !important;
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable .gw-provider-card-line {
        display: grid;
        grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
        gap: 0.75rem;
        width: 100%;
        min-width: 0;
        align-items: center;
        text-align: left;
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable .gw-provider-card-label {
        display: block;
        color: #495057;
        font-weight: 700;
    }

    .gw-route-proveedores table.gw-mobile-cards#dataTable .gw-provider-card-value,
    .gw-route-proveedores table.gw-mobile-cards#dataTable .gw-provider-card-actions {
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

/* Teléfonos y tablets mantienen targets táctiles incluso si el navegador no
   publica correctamente el tipo de puntero. */
@media screen and (max-width: 1199.98px) {
    .mensajes-panel:not(.is-open) {
        width: 0 !important;
        min-width: 0 !important;
        overflow: hidden;
        visibility: hidden;
        border: 0;
        box-shadow: none;
        transform: none !important;
    }

    .mensajes-panel.is-open {
        visibility: visible;
    }

    .btn,
    button,
    .nav-link,
    .dropdown-item,
    .page-link,
    .form-control,
    .form-select,
    .select2-selection,
    .select2-dropdown .select2-search__field,
    [role="button"] {
        min-height: 44px !important;
    }

    .btn,
    button,
    .page-link,
    [role="button"] {
        min-width: 44px !important;
    }

    .form-check,
    .form-check-label {
        min-height: 44px !important;
    }

    .form-check-label {
        display: flex;
        min-width: 44px !important;
        align-items: center;
    }

    form input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
    form select,
    form textarea,
    .input-group-text {
        min-height: 44px !important;
    }

    .btn-check {
        width: 44px !important;
        height: 44px !important;
    }
}

/* Todas las acciones táctiles mantienen un área operable de al menos 44 px. */
@media screen and (pointer: coarse) {
    .dropdown-submenu > .dropdown-menu,
    .dropdown-submenu:hover > .dropdown-menu {
        display: none !important;
    }

    .dropdown-submenu.show > .dropdown-menu {
        display: block !important;
    }

    .btn,
    button,
    .nav-link,
    .dropdown-item,
    .page-link,
    .form-control,
    .form-select,
    .select2-selection,
    [role="button"] {
        min-height: 44px !important;
    }

    .btn-compact {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
    }

    .form-check {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .form-check-label {
        display: flex;
        min-width: 44px !important;
        min-height: 44px;
        align-items: center;
    }

    .dragdrop-column,
    .grip-column,
    .drag-handle,
    .sortable-handle,
    .handle,
    .fav-drag-handle,
    .drag-handle-caracteristica,
    [data-drag-handle] {
        min-width: 44px !important;
        min-height: 44px !important;
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
    }

    .btn:hover,
    .btn-compact:hover,
    .card:hover,
    .table tbody tr:hover,
    .dropdown-item:hover {
        transform: none !important;
    }
}

@media screen and (pointer: coarse) {
    .toggle-label-cli,
    .toggle-label-art,
    .toggle-label-prov,
    .toggle-label-vend {
        flex: 0 0 44px;
        width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
    }

    .toggle-inner-cli,
    .toggle-inner-art,
    .toggle-inner-prov,
    .toggle-inner-vend {
        inset: 13px 4px;
    }

    .toggle-switch-cli,
    .toggle-switch-art,
    .toggle-switch-prov,
    .toggle-switch-vend {
        top: 15px;
        left: 6px;
    }
}

@media screen and (pointer: coarse) and (max-width: 1199.98px) {
    .dropdown-submenu > .dropdown-menu,
    .dropdown-submenu:hover > .dropdown-menu {
        position: static !important;
        display: none !important;
        width: 100%;
        margin: 0 !important;
    }

    .dropdown-submenu.show > .dropdown-menu {
        display: block !important;
    }
}

/* En tablet horizontal táctil se reserva espacio suficiente para ambas acciones. */
@media screen and (pointer: coarse) and (min-width: 992px) and (max-width: 1199.98px) {
    .gw-route-precios-modificacion .precios-modificacion-origen,
    .gw-route-precios-modificacion .precios-modificacion-destino {
        flex: 0 0 24%;
        width: 24%;
    }

    .gw-route-precios-modificacion .precios-modificacion-operacion {
        flex: 0 0 16%;
        width: 16%;
    }

    .gw-route-precios-modificacion .precios-modificacion-valor {
        flex: 0 0 17%;
        width: 17%;
    }

    .gw-route-precios-modificacion .precios-modificacion-acciones {
        flex: 0 0 19%;
        width: 19%;
        min-width: 0;
    }
}

/* En teléfono horizontal se recupera densidad para aprovechar el ancho útil. */
@media screen and (max-width: 991.98px) and (max-height: 500px) and (orientation: landscape) {
    .gw-route-precios-modificacion .precios-modificacion-origen,
    .gw-route-precios-modificacion .precios-modificacion-destino {
        flex: 0 0 22.5%;
        width: 22.5%;
    }

    .gw-route-precios-modificacion .precios-modificacion-operacion {
        flex: 0 0 16%;
        width: 16%;
    }

    .gw-route-precios-modificacion .precios-modificacion-valor {
        flex: 0 0 17%;
        width: 17%;
    }

    .gw-route-precios-modificacion .precios-modificacion-acciones {
        flex: 0 0 22%;
        width: 22%;
        min-width: 0;
    }

    .gw-route-comprobantes .emision-col-cliente {
        flex: 0 0 30%;
        width: 30%;
    }

    .gw-route-comprobantes .emision-col-tipo {
        flex: 0 0 16.666667%;
        width: 16.666667%;
    }

    .gw-route-comprobantes .emision-col-numeracion {
        flex: 0 0 33.333333%;
        width: 33.333333%;
    }

    .gw-route-comprobantes .emision-col-fecha {
        flex: 0 0 20%;
        width: 20%;
        min-width: 0;
    }

    .gw-route-compras .compra-col-proveedor {
        width: 37.5%;
        flex: 0 0 37.5%;
    }

    .gw-route-compras .compra-col-fecha {
        width: 20.833333%;
        flex: 0 0 20.833333%;
    }

    .navbar {
        padding-top: env(safe-area-inset-top);
        padding-bottom: 0;
    }

    .navbar-brand,
    .navbar-toggler {
        min-height: 44px;
    }

    .navbar-collapse {
        max-height: calc(100dvh - 44px - env(safe-area-inset-top));
    }

    body > .container-fluid {
        margin-top: 0.375rem !important;
    }

    .page-header,
    .gw-route-cajas .mb-2,
    .gw-route-reportes .mb-4 {
        margin-bottom: 0.375rem !important;
    }

    .page-header h1,
    .page-header h2,
    .gw-route-reportes h1 {
        font-size: 1.1rem;
    }

    .gw-listado .table-container,
    .gw-route-cajas .table-container,
    .gw-route-compras .table-container,
    .gw-route-comprobantes .table-container {
        max-height: calc(100dvh - 132px);
    }

    .modal-dialog {
        margin-top: 0.25rem;
        margin-bottom: 0.25rem;
    }

    .modal-content {
        max-height: calc(100dvh - 0.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }

    .modal-header,
    .modal-footer {
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
    }
}

@media print {
    .gw-mobile-filter-toggle {
        display: none !important;
    }

    .gw-mobile-table-scroll {
        overflow: visible !important;
    }

    table.gw-mobile-cards {
        display: table !important;
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: collapse;
        background: transparent;
    }

    table.gw-mobile-cards thead {
        position: static !important;
        display: table-header-group !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
    }

    table.gw-mobile-cards tbody {
        display: table-row-group !important;
        padding: 0 !important;
    }

    table.gw-mobile-cards tr {
        display: table-row !important;
        box-shadow: none !important;
    }

    table.gw-mobile-cards td {
        display: table-cell !important;
        width: auto !important;
        min-height: 0 !important;
        padding: 0.2rem 0.5rem !important;
        border: 1px solid var(--bs-border-color, #dee2e6) !important;
    }

    table.gw-mobile-cards td::before {
        display: none !important;
        content: none !important;
    }

    .gw-mobile-table-scroll > table,
    .table-responsive > table,
    .table-responsive-custom > table,
    .table-container > table,
    .modal-tabla-container > table {
        width: 100% !important;
        min-width: 0 !important;
    }

    .gw-listado,
    .gw-listado .page-content,
    .gw-listado .table-card,
    .gw-listado .table-card .card-body,
    .gw-listado .table-container {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .gw-listado.gw-listado-tabla-partida .table-container,
    .gw-listado.gw-listado-tabla-partida .table-container .table-body-wrapper {
        overflow: visible !important;
    }

    .gw-listado.gw-listado-tabla-partida .table-container .table-header,
    .gw-listado.gw-listado-tabla-partida .table-container .table-body-wrapper table {
        width: 100% !important;
        min-width: 0 !important;
    }
}
