/*
 * Delysium ERP 1.0.197 - Pantalla completa global adaptativa
 * Objetivo: que TODO el sistema use el ancho real disponible segun resolucion.
 * Solo layout: ancho, max-width, margenes, overflow y distribucion responsive.
 * No cambia colores, fondos, temas, fuentes, botones ni logica.
 */
:root{
  --erp-fluid-pad-x: clamp(10px, 1.15vw, 24px);
  --erp-fluid-pad-y: clamp(10px, 1.05vw, 22px);
  --erp-fluid-gap: clamp(12px, 1.35vw, 22px);
  --erp-fluid-content-max: none;
}

html,
body{
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  overflow-x:hidden !important;
}

body,
body.erp-ui-global-1-0-18{
  margin-left:0 !important;
  margin-right:0 !important;
}

/* Header: ocupar toda la pantalla, no quedar dentro de una caja centrada. */
body header,
body header.bg-dark,
body header.erp-header-always-dark,
body.erp-ui-global-1-0-18 header,
body.erp-ui-global-1-0-18 header.bg-dark,
body.erp-ui-global-1-0-18 header.erp-header-always-dark{
  width:100% !important;
  max-width:none !important;
  margin-left:0 !important;
  margin-right:0 !important;
  left:auto !important;
  right:auto !important;
}

body header > .container,
body header > .container-fluid,
body header .erp-header-menu-box,
body.erp-ui-global-1-0-18 header > .container,
body.erp-ui-global-1-0-18 header > .container-fluid,
body.erp-ui-global-1-0-18 header .erp-header-menu-box{
  width:100% !important;
  max-width:none !important;
  margin-left:0 !important;
  margin-right:0 !important;
  padding-left:var(--erp-fluid-pad-x) !important;
  padding-right:var(--erp-fluid-pad-x) !important;
}

/* Layout base de todas las paginas internas. */
body .layout,
body .main,
body main,
body .main-content,
body .content,
body .page-content,
body .erp-page,
body .erp-container,
body .page-wrapper,
body .admin-wrapper,
body .admin-content,
body .dashboard-wrapper,
body .dashboard-content,
body.erp-ui-global-1-0-18 .layout,
body.erp-ui-global-1-0-18 .main-content,
body.erp-ui-global-1-0-18 main.main-content,
body.erp-ui-global-1-0-18 .content,
body.erp-ui-global-1-0-18 .page-content{
  width:100% !important;
  max-width:none !important;
  min-width:0 !important;
  margin-left:0 !important;
  margin-right:0 !important;
}

body .main-content,
body main,
body .content,
body .page-content,
body.erp-ui-global-1-0-18 .main-content,
body.erp-ui-global-1-0-18 main.main-content,
body.erp-ui-global-1-0-18 .content,
body.erp-ui-global-1-0-18 .page-content{
  padding-left:var(--erp-fluid-pad-x) !important;
  padding-right:var(--erp-fluid-pad-x) !important;
  padding-top:var(--erp-fluid-pad-y) !important;
  padding-bottom:var(--erp-fluid-pad-y) !important;
}

/* Bootstrap y contenedores propios: quitar limites fijos de 1180/1280/1540. */
body .main-content > .container,
body .main-content > .container-fluid,
body main > .container,
body main > .container-fluid,
body .container,
body .container-fluid,
body .container-form,
body .container-main,
body .page-container,
body .content-wrap,
body .admin-page-wrap,
body .ventas-report-wrap,
body .ventas-report-page,
body .inv-sub-wrap,
body .inventory-kardex-pro,
body .cliente360,
body .sedes-wrap,
body .trazabilidad-wrap,
body .mm-wrap,
body .social-central-wrap,
body .orden-add-wrap,
body .tasks-history-shell,
body .chat-admin-shell,
body .chat-admin-top,
body .erp-admin-config,
body .erp-favicon-page,
body .actualizaciones-page,
body .diagnostico-page,
body .diagnostico-wrap,
body .diagnostico-container,
body .diagnostico-main,
body .diag-container,
body .diag-wrap,
body .erp-form-wide,
body.erp-ui-global-1-0-18 .main-content > .container,
body.erp-ui-global-1-0-18 .main-content > .container-fluid,
body.erp-ui-global-1-0-18 main > .container,
body.erp-ui-global-1-0-18 main > .container-fluid,
body.erp-ui-global-1-0-18 .container,
body.erp-ui-global-1-0-18 .container-fluid{
  width:100% !important;
  max-width:none !important;
  min-width:0 !important;
  margin-left:0 !important;
  margin-right:0 !important;
  padding-left:var(--erp-fluid-pad-x) !important;
  padding-right:var(--erp-fluid-pad-x) !important;
}

/* Contenedores con max-width inline en paginas administrativas. */
body .container[style*="max-width"],
body .container-fluid[style*="max-width"],
body .container-form[style*="max-width"],
body .page-container[style*="max-width"],
body .content-wrap[style*="max-width"],
body .admin-page-wrap[style*="max-width"],
body .erp-form-wide[style*="max-width"]{
  max-width:none !important;
  width:100% !important;
}

/* Filas y grids: ocupar todo el contenedor disponible. */
body .row,
body .g-0,
body .g-1,
body .g-2,
body .g-3,
body .g-4,
body .g-5,
body .grid,
body .erp-grid,
body .cards-grid,
body .dashboard-grid,
body .modules-grid,
body .home-grid{
  max-width:none !important;
  min-width:0 !important;
}

body .row{
  width:auto !important;
}

/* Inicio: que las tarjetas se estiren al ancho real de la pantalla. */
body.home-page .layout,
body.home-page .main-content,
body.home-page .main-content > .container-fluid,
body.home-page .main-content > .container-fluid > .row,
body.home-page .main-content .row{
  width:100% !important;
  max-width:none !important;
  margin-left:0 !important;
  margin-right:0 !important;
}

body.home-page .main-content > .container-fluid > .row > [class*="col-"],
body.home-page .main-content .row > [class*="col-"]{
  min-width:0 !important;
}

body.home-page .card{
  width:100% !important;
  max-width:none !important;
}

/* Tablas y modulos anchos: mantenerlos dentro de pantalla con scroll horizontal si hace falta. */
body .table-responsive,
body .table-wrap,
body .table-scroll,
body .social-table-scroll,
body .inventory-table-wrap,
body .ventas-report-table-card,
body .result-table,
body table{
  max-width:100% !important;
}

body .table-responsive,
body .table-wrap,
body .table-scroll,
body .social-table-scroll,
body .inventory-table-wrap,
body .ventas-report-table-card{
  overflow-x:auto !important;
  -webkit-overflow-scrolling:touch !important;
}

body table{
  width:100% !important;
}

/* Formularios: no dejar campos o grupos fuera del ancho disponible. */
body form,
body fieldset,
body .form-row,
body .filters-row,
body .filter-row,
body .search-row,
body .actions,
body .btn-toolbar,
body .button-row,
body .d-flex{
  min-width:0 !important;
}

body input,
body select,
body textarea,
body .form-control,
body .form-select,
body .input-group,
body .btn-group{
  max-width:100% !important;
}

body img,
body video,
body iframe,
body canvas,
body svg{
  max-width:100%;
}

/* En pantallas grandes se mantiene todo fluido; en pantallas muy grandes no se encajona. */
@media (min-width: 1400px){
  body .container,
  body .container-sm,
  body .container-md,
  body .container-lg,
  body .container-xl,
  body .container-xxl,
  body .container-fluid{
    max-width:none !important;
  }
}

@media (min-width: 1600px){
  :root{
    --erp-fluid-pad-x: clamp(14px, 1.05vw, 28px);
  }
}

@media (min-width: 1900px){
  :root{
    --erp-fluid-pad-x: clamp(16px, 1vw, 32px);
  }
}

@media (max-width: 991.98px){
  :root{
    --erp-fluid-pad-x: min(12px, 3vw);
    --erp-fluid-pad-y: min(12px, 3vw);
  }

  body header > .container,
  body header > .container-fluid,
  body header .erp-header-menu-box,
  body .main-content,
  body main,
  body .content,
  body .page-content,
  body .container,
  body .container-fluid,
  body .container-form,
  body .container-main,
  body .page-container,
  body .content-wrap{
    padding-left:var(--erp-fluid-pad-x) !important;
    padding-right:var(--erp-fluid-pad-x) !important;
  }

  body .row{
    margin-left:0 !important;
    margin-right:0 !important;
  }

  body .row > [class*="col-"]{
    padding-left:0 !important;
    padding-right:0 !important;
  }
}

/* Excepciones funcionales: no abrir elementos que deben seguir compactos. */
body.login-page .login-container,
body.login-page .login-card,
body.chat-client-page .chat-wrapper,
body.factura-page .receipt-wrap,
body.cierre-caja-page .receipt-wrap,
body.cierre-caja-page .receipt,
body .modal-dialog,
body .dropdown-menu,
body .erp-switch-user-card,
body .registro-info-card{
  max-width:var(--bs-modal-width, revert) !important;
}

body.factura-page .receipt-wrap,
body.cierre-caja-page .receipt-wrap{
  width:min(980px, calc(100vw - 2 * var(--erp-fluid-pad-x))) !important;
  margin-left:auto !important;
  margin-right:auto !important;
}

body.login-page .login-container,
body.login-page .login-card,
body.chat-client-page .chat-wrapper{
  width:min(520px, calc(100vw - 2 * var(--erp-fluid-pad-x))) !important;
  margin-left:auto !important;
  margin-right:auto !important;
}

/* El panel de informacion de registro sigue bloqueando el fondo y queda al frente. */
body.registro-info-open{
  overflow:hidden !important;
}
body .registro-info-panel{
  z-index:2147483000 !important;
}
body .registro-info-card{
  width:min(520px, calc(100vw - 24px)) !important;
}
