/* =========================================================
   CONTRIX - CAPA RESPONSIVE GLOBAL
   Mantiene el escritorio intacto y adapta la aplicación a
   tabletas y teléfonos sin cambiar la lógica funcional.
   ========================================================= */

.cx-mobile-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.cx-mobile-table-scroll > table {
    margin-bottom: 0;
}

@media (max-width: 991.98px) {
    html,
    body,
    .cx-admin-shell,
    .cx-main,
    .cx-content {
        width: 100%;
        max-width: 100%;
    }

    html,
    body {
        overflow-x: hidden;
    }

    .cx-main {
        min-width: 0 !important;
        margin-left: 0 !important;
    }

    .cx-sidebar {
        width: min(86vw, 320px) !important;
        max-width: 320px;
    }

    .cx-sidebar-header {
        min-height: 78px;
        padding: 12px 14px;
    }

    .cx-brand {
        padding: 8px 10px;
    }

    .cx-brand img {
        height: 40px;
    }

    .cx-sidebar-close {
        display: grid !important;
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        font-size: 1.35rem;
    }

    .cx-nav-link {
        min-height: 48px;
        padding: 11px 16px;
        font-size: .92rem;
    }

    .cx-submenu a {
        min-height: 42px;
        display: flex;
        align-items: center;
    }

    .cx-topbar {
        min-width: 0;
        min-height: 70px !important;
        padding: 9px 12px !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .cx-topbar-left {
        min-width: 0;
        flex: 1 1 auto;
        gap: 10px;
    }

    .cx-menu-button {
        display: grid !important;
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        place-items: center;
    }

    .cx-topbar-left > div:last-child {
        min-width: 0;
    }

    .cx-topbar h1 {
        max-width: min(55vw, 420px) !important;
        font-size: 1.05rem !important;
        line-height: 1.18;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
    }

    .cx-breadcrumb {
        max-width: min(55vw, 420px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cx-topbar-actions {
        min-width: 0;
        flex: 0 0 auto;
        gap: 6px !important;
    }

    .cx-account-context {
        min-height: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .cx-account-context .cx-branch-context {
        display: none !important;
    }

    .cx-user-button {
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px;
        height: 44px;
        padding: 3px !important;
        justify-content: center;
        border: 1px solid #dce3ed !important;
        border-radius: 12px !important;
        background: #fff !important;
    }

    .cx-user-avatar {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .cx-user-copy,
    .cx-user-button .cx-context-arrow {
        display: none !important;
    }

    .cx-user-menu {
        width: min(290px, calc(100vw - 20px)) !important;
        max-width: calc(100vw - 20px) !important;
    }

    .cx-content {
        min-width: 0;
        padding: 14px 12px 30px !important;
    }

    .cx-content > *,
    .cx-content .container,
    .cx-content .container-fluid,
    .cx-content .row,
    .cx-content [class*="col-"] {
        min-width: 0;
        max-width: 100%;
    }

    .cx-content .container,
    .cx-content .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }

    .cx-content img,
    .cx-content svg,
    .cx-content canvas,
    .cx-content video {
        max-width: 100%;
        height: auto;
    }

    .cx-content .table-responsive,
    .cx-mobile-table-scroll,
    .cx-admin-table-wrap,
    .cx-ind-table-wrap,
    .cx-close-table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .cx-content .table-responsive > table,
    .cx-mobile-table-scroll > table {
        min-width: 680px;
    }

    .cx-content .table th,
    .cx-content .table td {
        white-space: nowrap;
    }

    .cx-content .table td .text-wrap,
    .cx-content .table td p,
    .cx-content .table td small {
        white-space: normal;
    }

    .cx-content .btn-group,
    .cx-content .btn-toolbar {
        max-width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }

    .cx-content .nav-tabs,
    .cx-content .nav-pills {
        max-width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .cx-content .nav-tabs .nav-link,
    .cx-content .nav-pills .nav-link {
        white-space: nowrap;
    }

    .cx-content .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .cx-content .modal-dialog {
        max-width: calc(100vw - 20px);
        margin: 10px auto;
    }

    .cx-content .modal-content {
        max-height: calc(100dvh - 20px);
    }

    .cx-content .modal-body {
        overflow-y: auto;
    }

    .erp-page,
    .cx-module-page,
    .cx-admin-page,
    .cx-ind-page,
    .cx-close-page,
    .cx-dashboard-page,
    .cx-feature-page,
    .cx-recipe-page,
    .cx-procurement-page,
    .cx-purchase-orders-page {
        width: 100%;
        min-width: 0;
        gap: 14px !important;
    }

    .erp-hero,
    .cx-admin-hero,
    .cx-ind-hero,
    .cx-module-hero,
    .cx-orders-hero,
    .cx-procurement-hero,
    .cx-close-hero,
    .cx-dashboard-hero,
    .cx-feature-hero,
    .cx-recipe-hero {
        min-width: 0;
        padding: 18px !important;
    }

    .erp-toolbar,
    .erp-toolbar.compact,
    .vm-toolbar,
    .cx-admin-filter,
    .cx-ind-filter,
    .cx-close-filter,
    .cx-filter-panel,
    .cx-filter-panel-main {
        width: 100%;
        min-width: 0;
    }

    .cx-dashboard-kpis,
    .cx-dashboard-modules-grid,
    .cx-admin-kpis,
    .cx-ind-kpis,
    .cx-close-kpis,
    .cx-kpi-grid,
    .cx-payment-summary {
        min-width: 0;
    }

    .cx-form-footer,
    .cx-sale-checkout {
        max-width: 100%;
    }
}

@media (max-width: 767.98px) {
    .cx-topbar {
        position: sticky;
        top: 0;
    }

    .cx-breadcrumb {
        display: none !important;
    }

    .cx-topbar h1 {
        max-width: calc(100vw - 118px) !important;
        font-size: 1rem !important;
    }

    .cx-content {
        padding: 12px 9px 28px !important;
    }

    .vm-card,
    .erp-panel,
    .cx-data-card,
    .cx-admin-card,
    .cx-ind-card,
    .cx-close-note-card,
    .cx-close-side-card,
    .cx-close-save-card,
    .cx-dashboard-module-card,
    .cx-dashboard-side-card,
    .cx-workflow-card,
    .cx-upload-card {
        padding: 14px !important;
        border-radius: 14px !important;
    }

    .card .card-body {
        padding: 14px;
    }

    .card .card-header,
    .card .card-footer {
        padding: 12px 14px;
    }

    .cx-content h1,
    .cx-content .h1 {
        font-size: clamp(1.45rem, 7vw, 1.8rem);
    }

    .cx-content h2,
    .cx-content .h2 {
        font-size: clamp(1.2rem, 6vw, 1.48rem);
    }

    .cx-content h3,
    .cx-content .h3 {
        font-size: clamp(1.02rem, 5vw, 1.25rem);
    }

    .cx-content p,
    .cx-content .text-muted,
    .cx-content .vm-muted {
        overflow-wrap: anywhere;
    }

    .cx-content .row {
        --bs-gutter-x: .75rem;
        --bs-gutter-y: .75rem;
    }

    .cx-content .form-control,
    .cx-content .form-select,
    .cx-content .input-group-text,
    .cx-content .btn {
        min-height: 44px;
        font-size: .9rem;
    }

    .cx-content textarea.form-control {
        min-height: 96px;
    }

    .cx-content .d-flex.justify-content-between,
    .cx-content .d-flex.align-items-center.justify-content-between,
    .cx-content .d-flex.justify-content-between.align-items-center {
        flex-wrap: wrap;
        gap: 10px;
    }

    .cx-content .input-group {
        min-width: 0;
        max-width: 100%;
    }

    .cx-content .input-group > .form-control,
    .cx-content .input-group > .form-select {
        min-width: 0;
    }

    .cx-module-hero,
    .cx-dashboard-hero,
    .cx-admin-hero,
    .cx-ind-hero,
    .cx-close-hero,
    .cx-feature-hero,
    .cx-recipe-hero,
    .erp-hero {
        align-items: stretch !important;
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
    }

    .cx-module-hero-actions,
    .cx-dashboard-hero-actions,
    .cx-admin-hero-actions,
    .cx-ind-hero-actions,
    .cx-close-hero-actions,
    .cx-feature-hero-actions,
    .erp-hero-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .cx-module-hero-actions .btn,
    .cx-dashboard-hero-actions .btn,
    .cx-admin-hero-actions .btn,
    .cx-ind-hero-actions .btn,
    .cx-close-hero-actions .btn,
    .cx-feature-hero-actions .btn,
    .erp-hero-actions .btn {
        flex: 1 1 150px;
    }

    .cx-dashboard-kpis,
    .cx-dashboard-modules-grid,
    .cx-admin-kpis,
    .cx-ind-kpis,
    .cx-close-kpis,
    .cx-kpi-grid,
    .cx-payment-summary,
    .vm-grid-2,
    .vm-grid-3,
    .vm-grid-4,
    .vm-preview {
        grid-template-columns: 1fr !important;
    }

    .cx-form-footer,
    .cx-sale-checkout,
    .cx-data-card-header,
    .cx-inventory-table-header {
        align-items: stretch !important;
        flex-direction: column !important;
    }

    .cx-form-footer-actions,
    .cx-sale-checkout-actions,
    .cx-table-header-actions {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .cx-form-footer-actions .btn,
    .cx-sale-checkout-actions .btn,
    .cx-table-header-actions .btn {
        width: 100%;
    }

    .cx-content .table-responsive > table,
    .cx-mobile-table-scroll > table {
        min-width: 620px;
    }

    .cx-content .table th,
    .cx-content .table td {
        padding: 10px 9px !important;
        font-size: .78rem !important;
    }

    .cx-content .table thead th {
        font-size: .66rem !important;
    }

    .cx-row-actions,
    .cx-row-actions-wrap {
        min-width: 0 !important;
        flex-wrap: nowrap;
    }

    .cx-filter-panel-actions,
    .erp-toolbar-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .cx-filter-panel-actions > *,
    .erp-toolbar-actions > * {
        flex: 1 1 140px;
    }

    /* Venta */
    .cx-sale-hero,
    .cx-sale-payment-grid,
    .vm-sale-builder,
    .vm-sale-summary {
        grid-template-columns: 1fr !important;
    }

    .cx-sale-hero,
    .cx-sale-section,
    .cx-sale-product-box,
    .vm-credit-panel {
        padding: 14px !important;
        border-radius: 14px !important;
    }

    .cx-sale-section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .cx-sale-customer-wrap .input-group {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .cx-sale-customer-wrap .input-group > .form-select {
        width: 100%;
        border-radius: 8px 0 0 8px !important;
    }

    .cx-sale-customer-wrap .input-group > .btn {
        min-width: 88px;
        border-radius: 0 8px 8px 0 !important;
    }

    .cx-sale-checkout {
        position: static !important;
        margin-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Formularios de gestión y ERP */
    .erp-toolbar,
    .erp-toolbar.compact,
    .cx-admin-filter-grid,
    .cx-ind-filter-grid,
    .cx-close-filter-grid {
        grid-template-columns: 1fr !important;
    }

    .cx-workflow-steps {
        grid-template-columns: 1fr !important;
    }

    .cx-inventory-workspace {
        grid-template-columns: 1fr !important;
    }

    .vm-warehouse-user-grid {
        grid-template-columns: 1fr !important;
    }

    .dropdown-menu {
        max-width: calc(100vw - 18px);
    }
}

@media (max-width: 575.98px) {
    .cx-sidebar {
        width: min(92vw, 310px) !important;
    }

    .cx-content {
        padding-inline: 8px !important;
    }

    .cx-topbar {
        padding-inline: 8px !important;
    }

    .cx-menu-button {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .cx-user-button {
        width: 40px;
        height: 40px;
        min-width: 40px !important;
        min-height: 40px !important;
    }

    .cx-user-avatar {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .cx-topbar h1 {
        max-width: calc(100vw - 106px) !important;
        font-size: .96rem !important;
    }

    .cx-content .btn:not(.btn-sm):not(.btn-close),
    .cx-content .form-control,
    .cx-content .form-select {
        min-height: 46px;
    }

    .cx-content .btn-sm {
        min-height: 36px;
    }

    .cx-content .input-group:has(> .btn) {
        flex-wrap: nowrap;
    }

    .cx-sale-customer-wrap .input-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .cx-sale-customer-wrap .input-group > .form-select,
    .cx-sale-customer-wrap .input-group > .btn {
        width: 100%;
        border-radius: 8px !important;
    }

    .cx-content .table-responsive > table,
    .cx-mobile-table-scroll > table {
        min-width: 580px;
    }

    .cx-user-menu {
        position: fixed !important;
        top: 58px !important;
        right: 8px !important;
        left: auto !important;
        transform: none !important;
        width: calc(100vw - 16px) !important;
        max-width: 320px !important;
    }

    .cx-mobile-full-actions,
    .cx-mobile-full-actions > * {
        width: 100%;
    }

    .modal-dialog {
        margin: 6px !important;
        max-width: calc(100vw - 12px) !important;
    }

    .modal-content {
        max-height: calc(100dvh - 12px);
        border-radius: 14px !important;
    }

    .vm-auth-right {
        min-height: 100dvh;
        padding: 22px 16px !important;
    }

    .vm-auth-card {
        max-width: 100%;
    }

    .vm-auth-card h2 {
        font-size: 1.65rem !important;
    }
}

@media (max-width: 380px) {
    .cx-content {
        padding-inline: 6px !important;
    }

    .cx-topbar h1 {
        font-size: .9rem !important;
    }

    .cx-content .btn,
    .cx-content .form-control,
    .cx-content .form-select {
        font-size: .86rem;
    }
}

@supports (padding: max(0px)) {
    @media (max-width: 991.98px) {
        .cx-content {
            padding-bottom: max(28px, env(safe-area-inset-bottom)) !important;
        }

        .cx-sidebar {
            padding-left: env(safe-area-inset-left);
        }
    }
}


/* =========================================================
   CONTRIX - AJUSTE MOVIL REAL
   Refina navegación, panel principal y usuarios en pantallas
   pequeñas sin modificar lógica, rutas ni comportamiento desktop.
   ========================================================= */

@media (max-width: 767.98px) {
    /* Barra superior: un solo avatar limpio y contenido sin desbordes. */
    .cx-account-context {
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .cx-user-button {
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 2px !important;
    }

    .cx-user-avatar {
        border: 1px solid #d9e2ef !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
    }

    /* Drawer móvil: deja visible una franja de contexto y reduce el logo. */
    .cx-sidebar {
        width: min(84vw, 300px) !important;
        max-width: calc(100vw - 54px) !important;
    }

    .cx-sidebar-header {
        min-height: 82px !important;
        padding: 12px !important;
        gap: 10px !important;
    }

    .cx-brand {
        padding: 8px 10px !important;
        border-radius: 12px !important;
    }

    .cx-brand img {
        height: 38px !important;
    }

    .cx-sidebar-close {
        width: 38px !important;
        height: 38px !important;
        flex-basis: 38px !important;
    }

    /* Usuarios: cabecera vertical, botón cómodo y sin texto apretado. */
    .cx-users-toolbar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        align-items: stretch !important;
        gap: 14px !important;
        padding: 16px !important;
        margin-bottom: 14px !important;
    }

    .cx-users-toolbar > div {
        min-width: 0;
    }

    .cx-users-toolbar .vm-card-title {
        margin-bottom: 7px !important;
        font-size: 1.2rem !important;
        line-height: 1.2 !important;
    }

    .cx-users-toolbar p {
        margin: 0 !important;
        line-height: 1.52 !important;
        font-size: .92rem !important;
    }

    .cx-users-toolbar > .btn {
        width: 100% !important;
        min-height: 46px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* La tabla de usuarios deja de ser una tabla desktop desplazable.
       Cada fila se convierte en una tarjeta legible en celular. */
    .cx-users-card {
        padding: 10px !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .cx-users-table-wrap {
        overflow: visible !important;
        width: 100% !important;
    }

    .cx-users-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }

    .cx-users-table thead {
        display: none !important;
    }

    .cx-users-table tbody {
        display: grid !important;
        width: 100% !important;
        gap: 12px !important;
    }

    .cx-users-table tbody tr {
        display: grid !important;
        width: 100% !important;
        min-width: 0 !important;
        border: 1px solid #e3e9f2 !important;
        border-radius: 16px !important;
        background: #fff !important;
        box-shadow: 0 8px 24px rgba(15, 23, 42, .055) !important;
        overflow: hidden !important;
    }

    .cx-users-table tbody td {
        display: grid !important;
        grid-template-columns: minmax(108px, .8fr) minmax(0, 1.35fr) !important;
        align-items: start !important;
        gap: 10px !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 11px 12px !important;
        border: 0 !important;
        border-bottom: 1px solid #eef2f7 !important;
        white-space: normal !important;
        text-align: left !important;
        overflow-wrap: anywhere !important;
        font-size: .86rem !important;
        line-height: 1.35 !important;
    }

    .cx-users-table tbody td:last-child {
        border-bottom: 0 !important;
    }

    .cx-users-table tbody td::before {
        content: attr(data-label);
        color: #667085;
        font-size: .68rem;
        font-weight: 800;
        letter-spacing: .055em;
        line-height: 1.3;
        text-transform: uppercase;
    }

    .cx-users-table tbody td[data-label="Acciones"] {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .cx-users-table tbody td[data-label="Acciones"]::before {
        display: none !important;
    }

    .cx-users-table tbody td[data-label="Acciones"] .btn {
        width: 100% !important;
        min-height: 42px !important;
    }

    .cx-users-empty-row {
        display: block !important;
    }

    .cx-users-empty-row td {
        display: block !important;
        text-align: center !important;
    }

    .cx-users-empty-row td::before {
        display: none !important;
    }
}

@media (max-width: 479.98px) {
    /* En teléfonos estrechos, acciones principales a una sola columna. */
    .cx-dashboard-hero-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 9px !important;
    }

    .cx-dashboard-hero-actions .btn {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 46px !important;
    }

    .cx-dashboard-hero {
        gap: 14px !important;
    }

    .cx-dashboard-hero-copy p {
        font-size: .95rem !important;
        line-height: 1.55 !important;
    }

    .cx-users-table tbody td {
        grid-template-columns: 1fr !important;
        gap: 5px !important;
        padding: 11px 12px !important;
    }

    .cx-users-table tbody td::before {
        margin-bottom: 1px;
    }
}

/* Clientes / proveedores: experiencia móvil específica ------------------- */
@media (max-width: 767.98px) {
    .third-party-page {
        gap: 10px !important;
    }

    .third-party-page .erp-hero {
        padding: 14px !important;
        border-radius: 16px !important;
        gap: 12px !important;
    }

    .third-party-page .erp-hero h2 {
        margin: 7px 0 5px !important;
        font-size: clamp(1.25rem, 6vw, 1.55rem) !important;
        line-height: 1.15;
    }

    .third-party-page .erp-hero p {
        font-size: .86rem;
        line-height: 1.45;
    }

    .third-party-page .erp-eyebrow {
        padding: 5px 9px;
        font-size: .62rem;
    }

    .third-party-hero-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 7px !important;
    }

    .third-party-hero-actions .btn {
        width: 100% !important;
        min-height: 42px;
    }

    .third-party-page .erp-stats,
    .third-party-page .third-party-import-stats {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .third-party-page .erp-stat {
        min-height: 106px !important;
        padding: 11px 12px !important;
        border-radius: 14px !important;
        gap: 3px !important;
    }

    .third-party-page .erp-stat small {
        font-size: .62rem !important;
    }

    .third-party-page .erp-stat span {
        font-size: .76rem !important;
        line-height: 1.25;
    }

    .third-party-page .erp-stat strong {
        margin-top: auto;
        font-size: 1.35rem !important;
    }

    .third-party-page .erp-panel {
        padding: 0 !important;
        border-radius: 16px !important;
        overflow: hidden;
    }

    .third-party-page .erp-panel-head {
        padding: 14px !important;
        gap: 8px !important;
        align-items: flex-start !important;
        flex-direction: column !important;
    }

    .third-party-page .erp-panel-head h3 {
        font-size: 1.05rem !important;
    }

    .third-party-page .erp-panel-head p {
        font-size: .82rem !important;
        line-height: 1.4;
    }

    .third-party-page .erp-panel-body {
        padding: 14px !important;
    }

    .third-party-page .erp-toolbar,
    .third-party-page .erp-toolbar.compact {
        padding: 14px !important;
        gap: 11px !important;
    }

    .third-party-page .erp-field label,
    .third-party-page .form-label {
        margin-bottom: 5px !important;
        font-size: .78rem !important;
    }

    .third-party-page .erp-toolbar-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .third-party-page .erp-toolbar-actions > * {
        width: 100% !important;
        min-width: 0 !important;
    }

    .third-party-required-note {
        margin-bottom: 13px;
        padding: 10px 11px;
        border-radius: 12px;
        font-size: .82rem;
    }

    .third-party-form-grid {
        gap: 11px !important;
    }

    .third-party-form-page .erp-checks {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px 10px !important;
        padding: 12px !important;
    }

    .third-party-form-page .erp-checks .form-check {
        min-width: 0;
        margin: 0;
        font-size: .82rem;
    }

    .third-party-form-page .input-group #PhoneCountryCode {
        flex: 0 0 70px;
        max-width: 70px !important;
        padding-inline: 8px;
    }

    .third-party-form-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        width: 100%;
    }

    .third-party-form-actions .btn {
        width: 100%;
        margin: 0 !important;
    }

    .third-party-upload-box {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 14px !important;
        border-radius: 14px !important;
    }

    .third-party-upload-copy strong {
        font-size: .92rem;
    }

    .third-party-upload-copy span {
        font-size: .8rem;
        line-height: 1.4;
    }

    /* El directorio deja de ser una tabla horizontal y pasa a tarjetas. */
    .third-party-directory-table,
    .third-party-import-result-table,
    .third-party-activity-table {
        display: block !important;
        min-width: 0 !important;
        width: 100% !important;
        border: 0 !important;
    }

    .third-party-directory-table thead,
    .third-party-import-result-table thead,
    .third-party-activity-table thead {
        display: none !important;
    }

    .third-party-directory-table tbody,
    .third-party-import-result-table tbody,
    .third-party-activity-table tbody {
        display: grid !important;
        gap: 10px !important;
        width: 100%;
    }

    .third-party-directory-table tbody > tr,
    .third-party-import-result-table tbody > tr,
    .third-party-activity-table tbody > tr {
        display: block !important;
        width: 100%;
        overflow: hidden;
        border: 1px solid #e2e8f0 !important;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(15, 23, 42, .045);
    }

    .third-party-directory-table tbody > tr > td,
    .third-party-import-result-table tbody > tr > td,
    .third-party-activity-table tbody > tr > td {
        display: grid !important;
        grid-template-columns: minmax(88px, 31%) minmax(0, 1fr);
        gap: 10px;
        width: 100% !important;
        min-width: 0 !important;
        padding: 10px 11px !important;
        border: 0 !important;
        border-bottom: 1px solid #eef2f7 !important;
        text-align: left !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    .third-party-directory-table tbody > tr > td:last-child,
    .third-party-import-result-table tbody > tr > td:last-child,
    .third-party-activity-table tbody > tr > td:last-child {
        border-bottom: 0 !important;
    }

    .third-party-directory-table tbody > tr > td::before,
    .third-party-import-result-table tbody > tr > td::before,
    .third-party-activity-table tbody > tr > td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: .66rem;
        font-weight: 900;
        letter-spacing: .035em;
        text-transform: uppercase;
    }

    .third-party-directory-table td.wrap {
        display: block !important;
    }

    .third-party-directory-table td.wrap::before {
        display: block;
        margin-bottom: 7px;
    }

    .third-party-directory-table .erp-role-list {
        min-width: 0;
    }

    .third-party-directory-table .erp-role {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .third-party-directory-table .third-party-actions-cell > div {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px !important;
        width: 100%;
    }

    .third-party-directory-table .third-party-actions-cell form,
    .third-party-directory-table .third-party-actions-cell .btn {
        width: 100%;
        min-width: 0;
    }

    .third-party-directory-table .third-party-actions-cell form .btn {
        width: 100%;
    }

    .third-party-page .erp-table-wrap:has(.third-party-directory-table),
    .third-party-page .erp-table-wrap:has(.third-party-import-result-table),
    .third-party-page .erp-table-wrap:has(.third-party-activity-table) {
        padding: 0 10px 12px !important;
        overflow: visible !important;
    }

    .third-party-directory-table td[colspan],
    .third-party-import-result-table td[colspan],
    .third-party-activity-table td[colspan] {
        display: block !important;
    }

    .third-party-directory-table td[colspan]::before,
    .third-party-import-result-table td[colspan]::before,
    .third-party-activity-table td[colspan]::before {
        display: none;
    }
}

@media (max-width: 420px) {
    .third-party-page .erp-stat {
        min-height: 112px !important;
    }

    .third-party-page .erp-toolbar-actions,
    .third-party-directory-table .third-party-actions-cell > div,
    .third-party-form-page .erp-checks {
        grid-template-columns: 1fr !important;
    }

    .third-party-directory-table tbody > tr > td,
    .third-party-import-result-table tbody > tr > td,
    .third-party-activity-table tbody > tr > td {
        grid-template-columns: 82px minmax(0, 1fr);
    }
}
