/* ==========================================================================
   DISEÑO DE SISTEMA - LOOK AND FEEL CLARO & PREMIUM (SGI)
   ========================================================================== */

:root {
    /* Paleta de Colores Curada (Claridad e Intencionalidad) */
    --primary: #2563eb;        /* Azul Slate Premium */
    --primary-hover: #1d4ed8;  
    --primary-light: #eff6ff;
    
    --bg-app: #f8fafc;         /* Fondo General */
    --bg-card: #ffffff;        /* Fondo Tarjetas */
    --bg-header: #ffffff;
    
    --text-main: #0f172a;      /* Slate 900 */
    --text-muted: #475569;     /* Slate 600 */
    --text-light: #94a3b8;     /* Slate 400 */
    
    --border-color: #e2e8f0;   /* Slate 200 */
    --border-focus: #93c5fd;   /* Azul claro */
    
    /* Colores Semánticos */
    --success: #10b981;        /* Esmeralda */
    --success-light: #ecfdf5;
    --success-text: #065f46;
    
    --warning: #f59e0b;        /* Ámbar */
    --warning-light: #fffbeb;
    --warning-text: #92400e;
    
    --danger: #ef4444;         /* Rojo */
    --danger-light: #fef2f2;
    --danger-text: #991b1b;
    
    --purple: #8b5cf6;         /* Púrpura (Visualizaciones) */
    --purple-light: #f5f3ff;
    --purple-text: #5b21b6;
    
    /* Sombras & Efectos */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --glass-border: 1px solid rgba(255, 255, 255, 0.7);
    
    /* Tipografía y Espaciado */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* ==========================================================================
   ESTILOS BASE
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Ocultar elementos */
.hidden {
    display: none !important;
}

/* SVG Iconos Base */
.icon {
    width: 20px;
    height: 20px;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    vertical-align: middle;
    transition: transform var(--transition-fast);
}

.inline-icon {
    margin-right: 8px;
}

/* ==========================================================================
   ESTRUCTURA DE DISEÑO (GRID PRINCIPAL)
   ========================================================================== */

.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* BARRA LATERAL (DESKTOP) */
.sidebar {
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
}

.sidebar-menu {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-btn, .bottom-btn, .mobile-menu-item {
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.nav-btn:hover {
    background-color: var(--bg-app);
    color: var(--primary);
}

.nav-btn.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-btn.active .icon {
    stroke: var(--primary);
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-light);
}

.status-indicator.online .dot {
    background-color: var(--success);
    box-shadow: 0 0 0 3px var(--success-light);
    animation: pulse 2s infinite;
}

.status-indicator.offline .dot {
    background-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-light);
}

/* CONTENIDO PRINCIPAL Y CABECERA */
.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
}

.mobile-only-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.role-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* VISTAS */
.view-container {
    flex: 1;
    padding: 32px;
    position: relative;
}

.app-view {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.app-view.active {
    display: block;
}

/* ==========================================================================
   COMPONENTES UI COMUNES
   ========================================================================== */

/* Tarjetas */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

/* Botones Premium */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.25);
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.15);
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.15);
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.btn-outline:hover {
    background-color: var(--bg-app);
    color: var(--text-main);
    border-color: var(--text-light);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    padding: 4px 8px;
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-toggle {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.btn-toggle.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-large {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon-only {
    padding: 8px;
    border-radius: 50%;
    border: none;
    background: none;
    color: var(--text-muted);
}

.btn-icon-only:hover {
    background-color: var(--bg-app);
    color: var(--text-main);
}

.text-danger {
    color: var(--danger) !important;
}

.text-danger:hover {
    background-color: var(--danger-light);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-active {
    background-color: var(--success-light);
    color: var(--success-text);
}

.badge-inactive {
    background-color: var(--danger-light);
    color: var(--danger-text);
}

.badge-delivery {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-transfer {
    background-color: var(--purple-light);
    color: var(--purple-text);
}

/* Alertas */
.alert {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-info {
    background-color: var(--primary-light);
    border-color: #bee3f8;
    color: #2b6cb0;
}

/* Controles de Formulario */
.styled-select, .styled-input, .styled-textarea {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    color: var(--text-main);
    transition: all var(--transition-fast);
    outline: none;
}

.styled-select:focus, .styled-input:focus, .styled-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.switch-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* ==========================================================================
   VISTA 1: DASHBOARD
   ========================================================================== */

.welcome-banner {
    background: linear-gradient(135deg, var(--primary-light) 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
}

.welcome-text h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-hover);
    margin-bottom: 8px;
}

.welcome-text p {
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon .icon {
    width: 24px;
    height: 24px;
}

.bg-blue-light { background-color: var(--primary-light); }
.color-blue { color: var(--primary); }

.bg-green-light { background-color: var(--success-light); }
.color-green { color: var(--success); }

.bg-purple-light { background-color: var(--purple-light); }
.color-purple { color: var(--purple); }

.bg-orange-light { background-color: var(--warning-light); }
.color-orange { color: var(--warning); }

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 4px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 32px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.quick-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-link-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.quick-link-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.ql-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ql-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Elementos Movimientos Recientes */
.recent-moves-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.move-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background-color: var(--bg-app);
    border-left: 4px solid transparent;
}

.move-item.reception { border-left-color: var(--success); }
.move-item.transfer { border-left-color: var(--warning); }
.move-item.delivery { border-left-color: var(--danger); }
.move-item.adjustment { border-left-color: var(--purple); }

.move-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.move-product {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.move-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.move-qty-box {
    text-align: right;
}

.move-qty {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.move-type-lbl {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ==========================================================================
   VISTA 2: OPERACIONES DE ESCANEO
   ========================================================================== */

.operations-layout {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr;
    gap: 32px;
    align-items: start;
}

.operation-mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background-color: var(--bg-app);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.operation-mode-selector .btn {
    border: none;
    padding: 10px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.large-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
}

.large-input {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 500;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background-color: var(--bg-app);
    width: 100%;
    outline: none;
    transition: all var(--transition-fast);
}

.large-input:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-with-button {
    display: flex;
    gap: 12px;
}

.input-with-button .btn {
    border-radius: var(--radius-lg);
    padding: 0 20px;
}

.help-text {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 8px;
}

.scan-alternatives {
    margin-top: 24px;
    border-top: 1px dashed var(--border-color);
    padding-top: 24px;
}

.mock-scanner-panel {
    margin-top: 24px;
    background-color: var(--bg-app);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.mock-scanner-panel h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.mock-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-light {
    background-color: #ffffff;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.btn-light:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Panel transaccional */
.transaction-status-card {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.empty-transaction {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background-color: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    margin-bottom: 20px;
}

.empty-icon .icon {
    width: 36px;
    height: 36px;
}

.empty-transaction h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.empty-transaction p {
    font-size: 0.85rem;
    max-width: 320px;
}

/* Transacción activa */
.tx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.tx-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

#tx-badge-flow {
    background-color: var(--primary-light);
    color: var(--primary);
}

/* Stepper Visual */
.tx-stepper {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--bg-app);
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.step-indicator.active .step-num {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.step-indicator.completed .step-num {
    background-color: var(--success);
    color: white;
    border-color: var(--success);
}

.step-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
}

.step-indicator.active .step-label {
    color: var(--text-main);
}

.step-indicator.completed .step-label {
    color: var(--success-text);
}

.step-divider {
    height: 2px;
    background-color: var(--border-color);
    flex: 0.5;
    margin: 0 8px;
}

.step-indicator.completed + .step-divider {
    background-color: var(--success);
}

/* Detalles del primer elemento escaneado */
.scan-details-box {
    background-color: var(--primary-light);
    border: 1px solid #bee3f8;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.scan-details-box .avatar {
    width: 48px;
    height: 48px;
    background-color: #ffffff;
    border-radius: 8px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.scan-details-info {
    display: flex;
    flex-direction: column;
}

.scan-details-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.scan-details-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Botones de Selección de Acción */
.action-selection-box h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.btn-action {
    display: grid;
    grid-template-columns: 48px 1fr;
    align-items: center;
    padding: 16px;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-icon {
    font-size: 1.75rem;
    display: flex;
    justify-content: center;
}

.action-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.action-desc {
    grid-column: 2;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.btn-reception:hover, .btn-reception.selected {
    border-color: var(--success);
    background-color: var(--success-light);
}
.btn-transfer:hover, .btn-transfer.selected {
    border-color: var(--warning);
    background-color: var(--warning-light);
}
.btn-delivery:hover, .btn-delivery.selected {
    border-color: var(--danger);
    background-color: var(--danger-light);
}

/* Espacio de Siguientes Escaneos */
.next-scans-box {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scan-prompt-field {
    border: 2px dashed var(--border-color);
    background-color: var(--bg-app);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.scan-prompt-field.scanning {
    border-color: var(--primary);
    background-color: var(--primary-light);
    color: var(--primary);
    animation: pulseBorder 1.5s infinite;
}

.scan-prompt-field.completed {
    border-style: solid;
    border-color: var(--success);
    background-color: var(--success-light);
    color: var(--success-text);
}

/* Captura de Cantidad Industrial */
.qty-capture-box {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.qty-label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.qty-control-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.btn-qty-adjust {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    user-select: none;
}

.btn-qty-adjust:active {
    transform: scale(0.9);
    background-color: var(--bg-app);
}

.qty-input {
    width: 120px;
    height: 60px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    text-align: center;
    font-family: var(--font-sans);
    font-size: 1.75rem;
    font-weight: 700;
    outline: none;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-stock-warning {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.confirm-box {
    margin-top: 24px;
}

/* ==========================================================================
   TABLAS DE DATOS & SECCIÓN DE CATÁLOGOS
   ========================================================================== */

.section-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.search-box input {
    padding-left: 44px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-app);
    width: 100%;
    height: 40px;
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th, .data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--bg-app);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    user-select: none;
}

.data-table tbody tr:hover {
    background-color: rgba(248, 250, 252, 0.7);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.btn-group {
    display: flex;
    gap: 4px;
}

/* ==========================================================================
   VISTA 5: REPORTES
   ========================================================================== */

.reports-header-menu {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.reports-header-menu .btn-toggle {
    border: none;
    background: none;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
}

.reports-header-menu .btn-toggle.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background-color: var(--bg-app);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 200px;
}

.filter-group.block-filter {
    flex: 1;
    min-width: 100%;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-select {
    height: 38px;
    padding: 0 12px;
    font-size: 0.85rem;
}

.date-input {
    height: 38px;
}

/* Detalle de stock por producto */
.product-stock-summary {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.summary-details h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.summary-total-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 24px;
    text-align: right;
    box-shadow: var(--shadow-sm);
}

.total-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.total-val {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

/* ==========================================================================
   VISTA 6: AJUSTE FISICO
   ========================================================================== */

.conteo-operativo-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr;
    gap: 32px;
}

.margin-top {
    margin-top: 16px;
}

.conteo-quantity-card {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.conteo-quantity-card h4 {
    font-size: 1rem;
    font-weight: 700;
}

.block-help {
    display: block;
    margin-top: 4px;
}

.conteo-table-container {
    max-height: 250px;
    overflow-y: auto;
    background-color: #ffffff;
}

.data-table.compact th, .data-table.compact td {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.empty-text {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

.dif-positive {
    color: var(--success);
    font-weight: 700;
}

.dif-negative {
    color: var(--danger);
    font-weight: 700;
}

.dif-zero {
    color: var(--text-light);
}

.input-group-reason {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group-reason label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.supervisor-only-text {
    color: var(--warning-text);
    margin-top: 12px;
}

/* ==========================================================================
   MODALES (VENTANAS EMERGENTES)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal-card {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    animation: modalSlideUp var(--transition-normal);
    overflow: hidden;
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-form {
    padding: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.half {
    flex: 1;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.checkbox-group label {
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Modal cámara stream */
.modal-camera-card {
    max-width: 600px;
}

.camera-stream-container {
    background-color: #000000;
    position: relative;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.camera-video {
    width: 100%;
    height: 100%;
    max-height: 400px;
    object-fit: cover;
}

.camera-loader {
    color: white;
    font-size: 0.9rem;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-laser {
    position: absolute;
    width: 80%;
    height: 2px;
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
    animation: scannerLine 2s ease-in-out infinite;
}

.scanner-target-box {
    width: 85%;
    height: 35%;
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

/* UI Simulada de escaneo en cámara */
.camera-simulated-ui {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.sim-alert {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.pulse-icon {
    animation: pulse 1s infinite;
}

.sim-instruction {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.sim-scannable-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.sim-camera-code-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
}

.sim-camera-code-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Previsualización de Etiquetas */
.print-preview-area {
    padding: 24px;
    max-height: 500px;
    overflow-y: auto;
    background-color: #cbd5e1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.label-card {
    background-color: #ffffff;
    border: 1px solid #94a3b8;
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    aspect-ratio: 1.5;
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

.label-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.label-sku {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
}

.label-barcode-svg {
    width: 100%;
    height: auto;
    max-height: 60px;
    margin: 8px 0;
}

.label-qr-image {
    width: 75px;
    height: 75px;
    margin: 8px 0;
    object-fit: contain;
}

.label-capacity {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-light);
}

/* ==========================================================================
   FEEDBACK VISUAL (DESTELOS)
   ========================================================================== */

.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.15s ease-out;
}

.feedback-overlay.success-flash {
    background-color: rgba(16, 185, 129, 0.25);
    opacity: 1;
}

.feedback-overlay.danger-flash {
    background-color: rgba(239, 68, 68, 0.25);
    opacity: 1;
}

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.5; }
}

@keyframes pulseBorder {
    0% { border-color: var(--border-color); }
    50% { border-color: var(--primary); }
    100% { border-color: var(--border-color); }
}

@keyframes scannerLine {
    0% { top: 25%; }
    50% { top: 75%; }
    100% { top: 25%; }
}

/* ==========================================================================
   NAVEGACIÓN MÓVIL (BOTTOM NAV)
   ========================================================================== */

.bottom-nav {
    display: none; /* Oculta en desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    grid-template-columns: repeat(5, 1fr);
}

.bottom-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    gap: 4px;
    height: 100%;
}

.bottom-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.bottom-btn.active .icon {
    stroke: var(--primary);
}

/* Menú más móvil */
.mobile-more-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    z-index: 150;
    display: flex;
    align-items: flex-end;
}

.mobile-more-content {
    background-color: #ffffff;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    animation: modalSlideUp 0.2s ease-out;
}

.mobile-more-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-main);
}

.mobile-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.mobile-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.mobile-menu-item .m-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.mobile-menu-item:hover .m-icon {
    background-color: var(--primary-light);
    color: var(--primary);
}

/* ==========================================================================
   MEDIAS QUERIES / RESPONSIVIDAD
   ========================================================================== */

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .operations-layout, .conteo-operativo-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        padding-bottom: 64px; /* Para no tapar bottom-nav */
    }
    
    .sidebar {
        display: none; /* Oculta barra lateral en móvil */
    }
    
    .app-header {
        padding: 12px 16px;
    }
    
    .view-container {
        padding: 16px;
    }
    
    .mobile-only-btn {
        display: flex;
    }
    
    .bottom-nav {
        display: grid;
    }
    
    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }
    
    .header-right {
        gap: 12px;
    }
    
    .offline-toggle-container .switch-label {
        display: none; /* Ocultar texto en móviles pequeños */
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-group.half {
        width: 100%;
    }
}

/* ==========================================================================
   ESTILOS DE IMPRESIÓN (Etiqutas en PDF/Impresora)
   ========================================================================== */

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }
    
    body * {
        visibility: hidden;
    }
    #modal-print, #print-labels-container, #print-labels-container * {
        visibility: visible;
    }
    #modal-print {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: none;
        backdrop-filter: none;
        padding: 0;
        box-shadow: none;
    }
    .modal-card {
        max-width: 100% !important;
        box-shadow: none;
        margin: 0;
        padding: 0;
    }
    .modal-header, .print-actions, .modal-footer {
        display: none !important;
    }
    .print-preview-area {
        background: none;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10mm;
        overflow: visible;
        max-height: none;
        width: 100%;
    }
    .label-card {
        border: 1px solid #000000;
        page-break-inside: avoid;
        aspect-ratio: 1.5;
        box-shadow: none;
        width: 100%;
        box-sizing: border-box;
    }
}

/* ==========================================================================
   ESTILOS DE ESCÁNER REAL (HTML5-QRCode)
   ========================================================================== */
#reader {
    width: 100% !important;
    height: 100% !important;
    min-height: 350px;
    background-color: #000000 !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden !important;
}

#reader video {
    width: 100% !important;
    height: 100% !important;
    max-height: 400px !important;
    object-fit: cover !important;
}

/* Ocultar botones y paneles automáticos de la librería para mantener estética limpia */
#reader img,
#reader button,
#reader__dashboard_section_csr,
#reader__status_span,
#reader__header_message {
    display: none !important;
}
