/* ========================================================
   SANESCA PRO - ESTILOS DE INTERFAZ Y WORKFLOW DE EMPAQUE
   Archivo: css/empaque_ui.css
   ======================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

:root {
    /* Identidad Sanesca */
    --sanesca-navy: #0f2b48;
    --sanesca-navy-dark: #0b192c;
    --sanesca-navy-light: #163d66;

    /* Superficies */
    --sanesca-canvas: #0b192c;
    --sanesca-surface-dark: #0f172a;
    --sanesca-surface-card: #1e293b;
    --sanesca-surface-nested: #334155;
    --sanesca-surface-light: #f8fafc;
    --sanesca-surface-white: #ffffff;

    /* Bordes */
    --sanesca-border-subtle: #334155;
    --sanesca-border-medium: #475569;
    --sanesca-border-light: #e2e8f0;
    --sanesca-border-card: #cbd5e1;

    /* Tipografía */
    --sanesca-font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --sanesca-font-print: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Acentos Semánticos */
    --sanesca-emerald-500: #10b981;
    --sanesca-emerald-600: #059669;
    --sanesca-amber-500: #f59e0b;
    --sanesca-amber-600: #d97706;
    --sanesca-sky-400: #38bdf8;
    --sanesca-sky-600: #0284c7;
    --sanesca-rose-500: #ef4444;
    --sanesca-rose-600: #dc2626;
    --sanesca-pill-bg: #fef08a;
    --sanesca-pill-text: #854d0e;
    --sanesca-pill-border: #eab308;
}

body {
    font-family: var(--sanesca-font-ui);
    background-color: var(--sanesca-canvas);
    color: #1e293b;
    min-height: 100vh;
    overflow: hidden;
}

/* Layout General */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Barra Lateral Izquierda (Sidebar) */
.sidebar {
    width: 500px;
    min-width: 500px;
    max-width: 500px;
    background: #ffffff;
    border-right: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    z-index: 10;
}

.sidebar-header {
    background: #0f2b48;
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
}

.sidebar-header h1 {
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-system {
    background: #1e40af;
    color: #93c5fd;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.sidebar-brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-contrast-plate {
    background: #ffffff;
    padding: 3px 8px;
    border-radius: 6px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-logo {
    height: 20px;
    max-width: 95px;
    object-fit: contain;
    display: block;
}

.btn-close-sidebar {
    display: none;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}

.btn-close-sidebar:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.btn-toggle-sidebar {
    display: none;
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #475569;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-toggle-sidebar:hover {
    background: #334155;
    border-color: #64748b;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 25, 44, 0.7);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
    pointer-events: none;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

.sidebar-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Tarjetas de Sección del Wizard */
.step-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-card.active {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.step-title {
    font-size: 11.5px;
    font-weight: 900;
    text-transform: uppercase;
    color: #0f2b48;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.step-title span.badge-num {
    background: #0f2b48;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    margin-right: 6px;
}

/* Controles de Formulario */
label {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 4px;
    display: block;
}

select, input[type="number"], input[type="text"] {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s;
}

select:focus, input:focus {
    border-color: #0f2b48;
}

/* Lista de Productos del Pedido */
.products-list-container {
    max-height: 160px;
    overflow-y: auto;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    background: white;
}

.product-list-item {
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s;
}

.product-list-item:hover {
    background: #f1f5f9;
}

.product-list-item.selected {
    background: #eff6ff;
    border-left: 4px solid #0f2b48;
}

.product-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
}

.product-item-info {
    flex: 1;
    overflow: hidden;
}

.product-item-code {
    font-size: 11px;
    font-weight: 900;
    color: #0f2b48;
}

.product-item-title {
    font-size: 11px;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-item-stock {
    font-size: 11px;
    font-weight: 800;
    color: #059669;
}

.badge-in-batch {
    font-size: 9.5px;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 800;
    white-space: nowrap;
}

/* Estado Ítem Completado y Badges de Saldos (Fase C) */
.product-list-item.completado {
    background: #f0fdf4 !important;
    border-left: 4px solid #10b981;
    opacity: 0.75;
}

.product-list-item.completado:hover {
    background: #dcfce7 !important;
}

.product-item-balances {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 95px;
    text-align: right;
}

.badge-saldo {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}

.badge-saldo-total {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.badge-saldo-pendiente {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
    font-weight: 800;
}

.badge-saldo-empacado {
    background: #fefce8;
    color: #854d0e;
    border: 1px solid #fef08a;
}

.badge-item-completado {
    background: #059669;
    color: white;
    font-size: 9.5px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.aviso-hard-ceiling {
    position: fixed;
    top: 75px;
    right: 20px;
    background: #78350f;
    border: 1.5px solid #f59e0b;
    color: #fef3c7;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    z-index: 99999;
    box-shadow: 0 10px 20px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Detalle Producto Seleccionado */
.selected-product-box {
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.selected-prod-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    padding: 2px;
}

/* Tabla de Bultos en Wizard */
.packages-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 6px;
}

.packages-table th {
    background: #0f2b48;
    color: white;
    padding: 8px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.packages-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    vertical-align: middle;
}

.packages-table input[type="number"],
.package-qty-input {
    width: 80px;
    min-height: 44px;
    height: 44px;
    padding: 4px 8px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
}

.btn-action-sm {
    background: #b91c1c; /* Red-700 para contraste >= 4.5:1 con texto blanco */
    color: white;
    border: none;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}

.btn-action-sm:hover {
    background: #991b1b;
}

.btn-action-sm:active {
    transform: scale(0.92);
}

.btn-add-package {
    background: #f1f5f9;
    color: #0f2b48;
    border: 1.5px dashed #cbd5e1;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    width: 100%;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.btn-add-package:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.btn-suggest {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.btn-suggest:hover {
    background: #e0f2fe;
    color: #075985;
    border-color: #0284c7;
}

/* Botón de Agregar / Actualizar en Lote */
.btn-add-to-batch {
    background: #047857; /* Emerald-700 para contraste >= 4.5:1 */
    color: white;
    border: none;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-add-to-batch:hover {
    background: #065f46;
}

.btn-add-to-batch.btn-update-mode {
    background: #0369a1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-add-to-batch.btn-update-mode:hover {
    background: #075985;
}

/* BANDEJA DEL LOTE ACTUAL (CARRITO MULTI-PRODUCTO) */
.batch-tray-card {
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.batch-tray-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.batch-tray-header h2,
.batch-tray-header h3 {
    font-size: 12.5px;
    font-weight: 900;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.batch-items-list {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.batch-item-card {
    background: white;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 8px 12px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.batch-item-card strong {
    color: #0f2b48;
}

.btn-clear-batch {
    background: transparent;
    border: 1.5px solid #b91c1c;
    color: #b91c1c;
    font-size: 11.5px;
    font-weight: 700;
    min-height: 38px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-clear-batch:hover {
    background: #fee2e2;
    border-color: #991b1b;
}

/* Selector de Formato */
.format-toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.format-card {
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 8px;
    min-height: 52px;
    text-align: center;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
}

.format-card.selected {
    border-color: #0f2b48;
    background: #f0f7ff;
}

.format-card h3,
.format-card h4 {
    font-size: 12.5px;
    font-weight: 900;
    color: #0f2b48;
    margin-bottom: 2px;
}

.format-card p {
    font-size: 11.5px;
    color: #475569;
}

/* Área Central de Previsualización */
.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1e293b;
}

.preview-header {
    background: #0f172a;
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #334155;
    z-index: 10;
}

.preview-title {
    font-size: 13.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-print-action {
    background: #15803d; /* Green-700 para ratio WCAG AA >= 4.5:1 con blanco */
    color: #ffffff;
    border: none;
    min-height: 44px;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn-print-action:hover {
    background: #166534; /* Green-800 */
    transform: translateY(-1px);
}

.btn-save-batch-action {
    background: #0369a1; /* Sky-700 para ratio WCAG AA >= 4.5:1 con blanco */
    color: #ffffff;
    border: none;
    min-height: 44px;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn-save-batch-action:hover {
    background: #075985;
    transform: translateY(-1px);
}

.btn-dispatch-action {
    background: #4f46e5; /* Indigo-600 para ratio WCAG AA >= 4.5:1 con blanco */
    color: #ffffff;
    border: none;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn-dispatch-action:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.preview-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* ========================================================
   FASE B: BOTONES Y MODAL DE INGESTA HÍBRIDA DE PEDIDOS
   ======================================================== */

.ingesta-actions-bar {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.btn-ingesta-local {
    flex: 1;
    background: #0369a1; /* Sky-700 para contraste >= 4.5:1 con blanco */
    color: white;
    border: none;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-ingesta-local:hover {
    background: #075985;
    transform: translateY(-1px);
}

.btn-ingesta-nube {
    flex: 1;
    background: #475569;
    color: white;
    border: none;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-ingesta-nube:hover {
    background: #334155;
    transform: translateY(-1px);
}

.btn-ingesta-nube.loading {
    background: #d97706;
    cursor: wait;
}

/* Modal Overlay & Box */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box-ingesta {
    background: #ffffff;
    width: 580px;
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border: 1.5px solid #94a3b8;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header-ingesta {
    background: #0f2b48;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header-ingesta h3 {
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.btn-cerrar-modal {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.15s;
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-cerrar-modal:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.modal-body-ingesta {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    max-height: calc(88vh - 130px);
}

/* Dropzone */
.dropzone-area {
    border: 2px dashed #94a3b8;
    background: #f8fafc;
    border-radius: 10px;
    padding: 26px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dropzone-area:hover,
.dropzone-area.dragover {
    border-color: #0284c7;
    background: #f0f9ff;
    transform: scale(1.01);
}

.dropzone-icon {
    font-size: 32px;
}

.dropzone-text strong {
    display: block;
    color: #0f2b48;
    font-size: 13px;
    font-weight: 800;
}

.dropzone-text span {
    color: #64748b;
    font-size: 11px;
}

.dropzone-formats {
    font-size: 11px;
    color: #475569;
    font-weight: 600;
    margin-top: 4px;
}

/* Modal Footer */
.modal-footer-ingesta {
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secundario {
    background: #e2e8f0;
    color: #475569;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-secundario:hover {
    background: #cbd5e1;
    color: #1e293b;
}

.btn-primario {
    background: #047857; /* Emerald-700 para contraste >= 4.5:1 */
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-primario:hover {
    background: #065f46;
    transform: translateY(-1px);
}

/* ========================================================
   RESPONSIVIDAD INDUSTRIAL Y DRAWER TÁCTIL (<= 1024px)
   ======================================================== */
@media (max-width: 1024px) {
    body {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .app-layout {
        display: block !important;
        height: auto !important;
        min-height: 100vh;
        width: 100vw;
        overflow: visible !important;
        position: relative;
    }

    .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 86vw !important;
        max-width: 480px !important;
        min-width: 0 !important;
        z-index: 1000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 6px 0 30px rgba(0, 0, 0, 0.5) !important;
        border-right: 1px solid var(--sanesca-border-subtle);
    }

    .sidebar.drawer-open {
        transform: translateX(0) !important;
    }

    .btn-toggle-sidebar {
        display: inline-flex !important;
        min-height: 44px !important;
        padding: 8px 14px !important;
        font-size: 13px !important;
    }

    .btn-close-sidebar {
        display: inline-flex !important;
        min-width: 44px !important;
        min-height: 44px !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 20px !important;
    }

    .preview-area {
        width: 100% !important;
        min-height: 100vh !important;
        height: auto !important;
        overflow: visible !important;
    }

    .preview-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 50 !important;
        flex-wrap: wrap;
        gap: 10px;
    }

    .preview-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .preview-viewport {
        padding: 16px 8px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 640px) {
    .sidebar {
        width: 92vw !important;
        max-width: none !important;
    }

    .sidebar-header {
        padding: 10px 14px !important;
    }

    .sidebar-header h1 {
        font-size: 13px !important;
        gap: 6px !important;
    }

    .badge-system {
        display: none !important; /* Ocultar en móvil para priorizar título y botón cerrar */
    }

    .btn-close-sidebar {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        font-size: 20px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .preview-header {
        padding: 8px 10px !important;
    }

    .preview-title {
        font-size: 12px !important;
        flex-wrap: wrap;
        gap: 6px !important;
    }

    .btn-print-action,
    .btn-save-batch-action,
    .btn-dispatch-action {
        min-height: 44px !important;
        padding: 6px 12px !important;
        font-size: 11.5px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}



