/* =====================================================================
   Capa visual comun DISTRO (2026-11-19)
   Va despues de modern.css. Usa sus variables (--m-*), funciona en
   modo claro y oscuro. Solo estilos: no cambia datos ni eventos.
   ===================================================================== */

/* ---------- Buscador con autocompletado (tAutoComplete: clientes, productos) ---------- */
html body .adropdown {
    background: var(--m-card, #fff) !important;
    border: 1px solid var(--m-line, #e3e7ee);
    border-radius: 10px;
    box-shadow: var(--m-shadow-lg, 0 12px 32px rgba(16, 24, 40, .16)) !important;
}
html body .adropdown table { color: var(--m-ink, #1f2933) !important; border-bottom: 0 !important; }
html body .adropdown th { background: var(--m-bg, #f3f5f9) !important; color: var(--m-ink-2, #52606d) !important; font-size: 11px; letter-spacing: .04em; }
html body .adropdown tr td {
    color: var(--m-ink, #1f2933) !important;
    background: transparent;
    border-bottom: 1px solid var(--m-line-2, #eef1f5) !important;
    font-size: 13px;
    padding: 9px 12px;
    line-height: 1.35;
}
html body .adropdown tr:hover,
html body .adropdown tr.selectedxx,
html body .adropdown .selectedxx { background: var(--m-acc-soft, #e8efff) !important; }
html body .adropdown tr:hover td,
html body .adropdown .selectedxx td { color: var(--m-ink, #1f2933) !important; }

/* ---------- Grillas: detalles de escritorio ---------- */
html body table.fullgrid > tbody > tr > td { vertical-align: middle; }
/* botones de accion de cada fila en una sola linea (filas mas bajas y faciles de leer) */
@media (min-width: 768px) {
    html body table.fullgrid > tbody > tr > td > .btn-group { display: inline-flex; flex-wrap: nowrap; }
    html body table.fullgrid > tbody > tr > td > .btn-group > .btn { float: none; }
}
/* boton "Filtros" de las grillas: solo existe en celular */
html body .dui-btn-filtros { display: none; }

/* =====================================================================
   COMPONENTES para pantallas rediseñadas (usar dentro de .dui-page)
   ===================================================================== */
.dui-page { --dui-soft: #f7f9fc; --dui-input-bd: #d5dbe3; color: var(--m-ink, #1f2933); padding: 4px 0 16px; }
html.m-dark .dui-page { --dui-soft: rgba(255, 255, 255, .04); --dui-input-bd: #33415c; }
.dui-page .dui-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.dui-page .dui-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--m-ink, #1f2933); }
.dui-page .dui-subtitle { margin: 4px 0 0; font-size: 13px; color: var(--m-ink-2, #52606d); }

/* pasos del proceso */
.dui-page .dui-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.dui-page .dui-steps > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--m-card, #fff); border: 1px solid var(--m-line, #e3e7ee); }
.dui-page .dui-step-num { flex: 0 0 auto; display: inline-flex; width: 28px; height: 28px; border-radius: 8px; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--m-acc-soft, #e8efff); color: var(--m-acc, #2563eb); }
.dui-page .dui-step-title { display: block; font-size: 14px; font-weight: 600; color: var(--m-ink, #1f2933); }
.dui-page .dui-step-help { display: block; font-size: 12px; color: var(--m-ink-2, #52606d); margin-top: 2px; line-height: 1.4; }

/* tarjetas */
.dui-page .dui-card { background: var(--m-card, #fff); border: 1px solid var(--m-line, #e3e7ee); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.dui-page .dui-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.dui-page .dui-card-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 16px; font-weight: 600; color: var(--m-ink, #1f2933); }
.dui-page .dui-help { margin: 2px 0 0; font-size: 12px; color: var(--m-ink-2, #52606d); }
.dui-page .dui-section-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--m-ink-2, #52606d); text-transform: uppercase; letter-spacing: .04em; }

/* avisos */
.dui-page .dui-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin-bottom: 16px; border-radius: 10px; font-size: 14px; }
.dui-page .dui-alert-warn { background: #fef3e2; border: 1px solid #f8d8a8; color: #6b3a05; }
html.m-dark .dui-page .dui-alert-warn { background: rgba(245, 158, 11, .14); border-color: rgba(245, 158, 11, .35); color: #fcd34d; }
.dui-page .dui-alert .btn { margin-top: 8px; }

/* boton principal grande */
html body .dui-page .dui-btn-main .btn { width: 100%; height: 48px !important; padding: 0 18px !important; font-size: 16px !important; font-weight: 600; border-radius: 10px; float: none; margin: 0; }

/* =====================================================================
   CELULAR (vendedores, transportistas): hasta 767 px
   ===================================================================== */
@media (max-width: 767px) {

    /* pasos del proceso compactos (2 x 2, solo titulo) */
    .dui-page .dui-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .dui-page .dui-steps > li { padding: 10px; gap: 8px; align-items: center; }
    .dui-page .dui-step-help { display: none; }
    .dui-page .dui-step-title { font-size: 13px; }
    .dui-page .dui-card { padding: 14px; }

    /* textos de 16px en campos: evita que el telefono haga zoom al escribir */
    html body input[type="text"], html body input[type="number"], html body input[type="search"],
    html body input[type="tel"], html body input[type="email"], html body input[type="date"],
    html body input[type="password"], html body select, html body textarea { font-size: 16px !important; }

    /* botones y controles faciles de tocar */
    html body .btn { min-height: 40px; }
    html body .btn.btn-xs { min-height: 32px; }

    /* pestañas del sistema (Panel, modulos abiertos): se desplazan en una fila */
    html body .ui-tabs .ui-tabs-nav { display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    html body .ui-tabs .ui-tabs-nav li { flex: 0 0 auto; white-space: nowrap; }

    /* tarjetas: menos margen, barra de herramientas que se acomoda */
    html body .jarviswidget > header { height: auto !important; min-height: 40px; display: flex; flex-wrap: wrap; align-items: center; }
    html body .jarviswidget > header .widget-toolbar { float: none; }

    /* formularios smart-form: una columna */
    html body .smart-form .row { margin: 0 !important; }
    html body .smart-form .col { float: none !important; width: 100% !important; padding-left: 0 !important; padding-right: 0 !important; }

    /* ventanas emergentes a lo ancho de la pantalla */
    html body .modal-dialog { width: auto !important; margin: 8px !important; }
    html body .modal-body { max-height: calc(100vh - 170px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
    html body .modal-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
    html body .modal-footer:before, html body .modal-footer:after { display: none; }
    html body .modal-footer > .lv-modalrequired { flex: 1 0 100%; float: none !important; margin: 0 !important; text-align: left; }
    html body .modal-footer > span, html body .modal-footer > div:not(.lv-modalrequired) { display: inline-flex; flex-wrap: wrap; gap: 8px; float: none !important; margin: 0 !important; }
    html body .modal-footer .btn { float: none !important; margin: 0 !important; }

    /* listas desplegables con buscador (chosen) del mismo alto que los campos */
    html body .chosen-container-single .chosen-single { height: 40px !important; line-height: 38px !important; }
    html body .chosen-container-single .chosen-single div b { background-position: 0 10px !important; }

    /* tablas simples: se desplazan horizontalmente en vez de cortarse */
    html body .widget-body .table:not(.fullgrid):not(.np-items),
    html body .modal-body .table:not(.fullgrid) { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* ---------- GRILLAS (fullgrid) como tarjetas ---------- */
    html body table.dui-grilla { display: block; clear: both; width: 100% !important; border: 0 !important; background: transparent !important; }
    html body table.dui-grilla > thead,
    html body table.dui-grilla > tbody,
    html body table.dui-grilla > tfoot { display: block; width: 100%; }

    /* cabecera: solo queda visible la casilla de "seleccionar todo" si existe */
    html body table.dui-grilla > thead > tr:first-child { display: flex; justify-content: flex-end; padding: 0; background: transparent !important; }
    html body table.dui-grilla > thead > tr:first-child > th { display: none !important; }
    html body table.dui-grilla > thead > tr:first-child > th:has(input[type="checkbox"]) {
        display: flex !important; align-items: center; gap: 8px; border: 0 !important; background: transparent !important; width: auto !important; padding: 4px 0 !important;
    }
    html body table.dui-grilla > thead > tr:first-child > th:has(input[type="checkbox"])::after { content: "Todos"; font-size: 12px; font-weight: 600; color: var(--m-ink-2, #52606d); }

    /* boton para mostrar/ocultar filtros */
    html body .dui-btn-filtros {
        display: inline-flex; align-items: center; gap: 8px; clear: both; float: none;
        margin: 8px 0 10px; height: 40px; padding: 0 14px; border-radius: 8px;
        border: 1px solid var(--m-line, #e3e7ee); background: var(--m-card, #fff); color: var(--m-ink, #1f2933);
        font-size: 14px; font-weight: 600;
    }
    html body .dui-btn-filtros.dui-activos { border-color: var(--m-acc, #2563eb); color: var(--m-acc, #2563eb); background: var(--m-acc-soft, #e8efff); }
    html body table.dui-grilla:not(.dui-filtros-abiertos) > thead > tr:nth-child(2) { display: none !important; }

    /* filtros: rejilla de 2 columnas, cada uno con su nombre */
    html body table.dui-grilla > thead > tr:nth-child(2) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 8px 0 12px; background: transparent !important; }
    html body table.dui-grilla > thead > tr:nth-child(2) > th { display: block; border: 0 !important; padding: 0 !important; width: auto !important; min-width: 0; background: transparent !important; }
    html body table.dui-grilla > thead > tr:nth-child(2) > th.dui-sin-filtro { display: none !important; }
    html body table.dui-grilla > thead > tr:nth-child(2) > th[data-label]::before {
        content: attr(data-label); display: block; margin-bottom: 4px; font-size: 11px; font-weight: 600; color: var(--m-ink-2, #52606d); text-align: left;
    }

    /* cada fila es una tarjeta */
    html body table.dui-grilla > tbody > tr {
        display: block; margin: 0 0 10px; padding: 6px 12px;
        border: 1px solid var(--m-line, #e3e7ee); border-radius: 12px;
        background: var(--m-card, #fff) !important; box-shadow: var(--m-shadow, 0 1px 3px rgba(16, 24, 40, .06));
    }
    html body table.dui-grilla > tbody > tr > td {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        width: auto !important; min-height: 0; padding: 7px 0 !important;
        border: 0 !important; border-bottom: 1px solid var(--m-line-2, #eef1f5) !important;
        background: transparent !important; text-align: right !important; word-break: break-word;
    }
    html body table.dui-grilla > tbody > tr > td:last-child { border-bottom: 0 !important; }
    html body table.dui-grilla > tbody > tr > td[data-label]::before {
        content: attr(data-label); flex: 0 0 38%; max-width: 38%; text-align: left;
        font-size: 12px; font-weight: 600; color: var(--m-ink-2, #52606d);
    }
    html body table.dui-grilla > tbody > tr > td[data-label=""]::before { content: none; }
    html body table.dui-grilla > tbody > tr > td > * { max-width: 62%; }
    html body table.dui-grilla > tbody > tr > td > .btn-group { display: inline-flex; flex-wrap: nowrap; max-width: none; }
    html body table.dui-grilla > tbody > tr > td > .btn-group > .btn { float: none; }
    html body table.dui-grilla > tbody > tr.dui-fila-mensaje,
    html body table.dui-grilla > tbody > tr.dui-fila-total { text-align: center; }
    html body table.dui-grilla > tbody > tr.dui-fila-mensaje > td,
    html body table.dui-grilla > tbody > tr.dui-fila-total > td { display: block; text-align: center !important; }
    html body table.dui-grilla > tbody > tr.dui-fila-mensaje > td::before,
    html body table.dui-grilla > tbody > tr.dui-fila-total > td::before { content: none; }
}

/* (2026-11-25) Etiquetas con letra blanca en linea (style="color: #fff") sobre los fondos suaves de modern.css
   se veian casi transparentes (boleta / nota de venta en Liquidacion, Cobranza, Despacho, Deuda Vendedor,
   Nota de Pedido). Si la etiqueta fuerza blanco, se le da fondo solido. */
html body .label.label-success[style*="#fff"] { background: #16a34a; }
html body .label.label-default[style*="#fff"] { background: #64748b; }
html body .label.label-danger[style*="#fff"]  { background: #dc2626; }
html body .label.label-warning[style*="#fff"] { background: #d97706; }
html body .label.label-info[style*="#fff"]    { background: #0891b2; }
html body .label.label-primary[style*="#fff"] { background: #2563eb; }
