 /* :root {
        --primary: #4e8fbaf6;
        --secondary: #3498db;
        --success: #27ae60;
        --danger: #e74c3c;
        --warning: #f39c12;
        --light: #f4f6f9;
    } */
 :root {
    --primary: #0e6251;      /* Verde esmeralda oscuro para elementos destacados */
    --secondary: #16a085;    /* Verde más claro para botones primarios, hover */
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --light: #f8f9fa;        /* Fondo general muy claro (casi blanco) */
    --white: #ffffff;
    --text-dark: #2c3e50;    /* Texto principal oscuro */
    --border-light: #dee2e6;
}
    /* body { 
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
        margin: 0; background: var(--light); color: #333; 
    } */

    body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; background: var(--light); color: #333; 
}
    
    /* LOGIN */
    #login-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: var(--primary); display: flex; justify-content: center; align-items: center; z-index: 9999;
    }
    .login-card {
        background: white; padding: 40px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.3);
        text-align: center; width: 350px;
    }
    .login-card h2 { margin: 0 0 20px 0; color: var(--primary); }
    .login-card input { width: 100%; padding: 12px; margin: 10px 0; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; }
    .login-btn { width: 100%; padding: 12px; background: var(--secondary); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; }

    /* APP ESTRUCTURA */
    #main-app { display: none; }
    /* .sidebar { width: 250px; background: var(--primary); color: white; height: 100vh; padding: 20px 10px; position: fixed; box-shadow: 2px 0 10px rgba(0,0,0,0.1); }
    .sidebar h2 { text-align: center; border-bottom: 1px solid #34495e; padding-bottom: 15px; margin-bottom: 10px; } */
    .sidebar {
    width: 250px;
    background: var(--white);
    color: var(--text-dark);
    height: 100vh;
    padding: 20px 10px;
    position: fixed;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    border-right: 1px solid var(--border-light);
}
    .sidebar h2 {
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 15px;
    margin-bottom: 10px;
    color: var(--primary);
}
    
    /* .user-info { font-size: 13px; text-align: center; margin-bottom: 25px; color: #bdc3c7; background: rgba(255,255,255,0.05); padding: 10px; border-radius: 5px; } */
.user-info {
    font-size: 13px;
    text-align: center;
    margin-bottom: 25px;
    color: var(--secondary);
    background: rgba(0,0,0,0.02);
    padding: 10px;
    border-radius: 5px;
}

.menu-btn {
    display: none;
    width: 100%;
    padding: 14px 15px;
    margin: 4px 0;
    background: transparent;
    color: var(--text-dark);
    border: none;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    border-radius: 6px;
    transition: 0.2s;
}

    /* .menu-btn { 
        display: none; width: 100%; padding: 14px 15px; margin: 4px 0; background: transparent; 
        color: #ecf0f1; border: none; text-align: left; font-size: 15px; cursor: pointer; border-radius: 6px; transition: 0.2s;
    } */
    /* .menu-btn:hover, .active-btn { background: #34495e; border-left: 4px solid var(--secondary); color: white; } */
    /* .logout-btn { position: absolute; bottom: 20px; left: 20px; color: #e74c3c; cursor: pointer; background: none; border: none; font-weight: bold; } */
.menu-btn:hover, .active-btn {
    background: #e9f7f2;                /* Fondo verde muy claro */
    border-left: 4px solid var(--secondary);
    color: var(--primary);
    font-weight: 500;
}
.logout-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: var(--danger);
    cursor: pointer;
    background: none;
    border: none;
    font-weight: bold;
}
    .content { margin-left: 270px; padding: 30px; }
    .view { display: none; animation: fadeIn 0.4s; }
    .active { display: block; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

    /* ELEMENTOS VISUALES (conservados tal cual) */
    .card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin-bottom: 25px; }
    .btn { padding: 10px 18px; border: none; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: 14px; }
    .btn-primary { background: var(--secondary); color: white; }
    .btn-success { background: var(--success); color: white; }
    .btn-danger { background: var(--danger); color: white; }
    .btn-warning { background: var(--warning); color: white; }
    
    table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 14px; }
    th { background: #f8f9fa; color: var(--primary); font-weight: 600; padding: 12px; border-bottom: 2px solid #eee; text-align: left; }
    td { padding: 12px; border-bottom: 1px solid #eee; }
    tr:hover { background: #fafafa; }
    
    .badge { padding: 4px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; color: white; }
    .bg-red { background: var(--danger); }
    .bg-orange { background: var(--warning); }
    .bg-green { background: var(--success); }

    /* MODAL */
    .modal { display: none; position: fixed; z-index: 9000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); justify-content: center; align-items: center; }
    .close-modal { position: absolute; top: 10px; right: 15px; cursor: pointer; font-size: 24px; color: #999; }
    
    .search-item {
        padding: 8px;
        border-bottom: 1px solid #eee;
        cursor: pointer;
    }
    .search-item:hover {
        background: #f0f0f0;
    }

    /* Estilos del ticket en pantalla (oculto) */
    #ticket-print {
        position: fixed;
        top: 0;
        left: 0;
        background: white;
        z-index: 9999;
        width: 100%;
        height: 100%;
        overflow: auto;
        font-family: 'Courier New', monospace;
    }

    /* Estilos para impresión (ticket térmico 80mm) */
    @media print {
    body * { visibility: hidden; }
    #ticket-print, #ticket-print * { visibility: visible; }
    #ticket-print {
        position: absolute; left: 0; top: 0;
        width: 80mm; margin: 0; padding: 3mm;
        font-family: 'Courier New', monospace;
        font-size: 11px;
        background: white;
    }
    .ticket-wrapper { width: 100%; }
    .center { text-align: center; }
    .divider { text-align: center; font-size: 9px; margin: 3px 0; }
    .item { display: flex; justify-content: space-between; }
    .total { font-weight: bold; font-size: 13px; }
}

    .modal-content {
        background: white;
        padding: 30px;
        border-radius: 10px;
        width: 90%;
        max-width: 500px;
        text-align: center;
        position: relative;
        box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    }

    /* ========== NUEVAS CLASES PARA EL FORMULARIO DE RECEPCIÓN (sin conflictos) ========== */
    .form-row {
        display: flex;
        gap: 1rem;
        flex-wrap: wrap;
        align-items: flex-end;
    }
    .form-group {
        flex: 1;
        min-width: 160px;
        display: flex;
        flex-direction: column;
    }
    .form-group label {
        font-size: 0.85rem;
        font-weight: 500;
        color: #495057;
        margin-bottom: 0.3rem;
    }
    .form-group input,
    .form-group select {
        padding: 0.6rem 0.8rem;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        font-size: 0.9rem;
        width: 100%;
        box-sizing: border-box;
        transition: border-color 0.2s;
    }
    .form-group input:focus,
    .form-group select:focus {
        outline: none;
        border-color: var(--secondary);
        box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
    }

    /* Buscador con icono y resultados */
    .search-box {
        position: relative;
    }
    .search-box input {
        padding-left: 2.2rem;
    }
    .search-icon {
        position: absolute;
        left: 0.7rem;
        top: 50%;
        transform: translateY(-50%);
        color: #adb5bd;
        font-size: 1rem;
        pointer-events: none;
    }
    .results-box {
        position: absolute;
        width: 100%;
        max-height: 160px;
        overflow-y: auto;
        border: 1px solid #dee2e6;
        border-top: none;
        border-radius: 0 0 8px 8px;
        background: #fff;
        margin-top: -2px;
        display: none;
        z-index: 10;
        box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    }
    .results-box.active {
        display: block;
    }
    .result-item {
        padding: 0.6rem 0.8rem;
        cursor: pointer;
        border-bottom: 1px solid #f1f3f5;
        font-size: 0.9rem;
    }
    .result-item:hover {
        background: #f8f9fa;
    }
    .result-item:last-child {
        border-bottom: none;
    }

    /* Tabla envolvente con scroll horizontal */
    .table-wrapper {
        overflow-x: auto;
        border-radius: 8px;
        border: 1px solid #e9ecef;
    }
    .empty-message {
        text-align: center;
        color: #868e96;
        padding: 2rem 1rem;
        font-style: italic;
    }

    /* Insignia para distribución (nueva clase sin conflicto) */
    .dist-badge {
        display: inline-block;
        padding: 0.25rem 0.7rem;
        background: #e9ecef;
        color: #495057;
        border-radius: 20px;
        font-size: 0.8rem;
        margin: 0.15rem;
    }

    /* Sección del botón guardar */
    .save-section {
        display: flex;
        justify-content: flex-end;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #f1f3f5;
    }

    /* Mejora visual del login con Bootstrap */
#login-overlay .form-control:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 0.2rem rgba(52,152,219,0.25);
}

#login-overlay .btn-primary {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

#login-overlay .btn-primary:hover {
    background-color: #2471a3;
    border-color: #2471a3;
}

#genericModal {
    z-index: 10000 !important;
}

#modalConfirm {
    z-index: 10001 !important;
}

/* ========== RESPONSIVIDAD ========== */
@media (max-width: 991.98px) {
    .sidebar {
        left: -280px;          /* Oculto por defecto */
        transition: left 0.3s;
        z-index: 1050;
    }
    .sidebar.mobile-open {
        left: 0;
        box-shadow: 4px 0 15px rgba(0,0,0,0.2);
    }
    .content {
        margin-left: 0;        /* Quitar el margen izquierdo */
        padding: 20px;
    }
    .mobile-menu-btn {
        display: inline-block !important;
        margin-bottom: 1rem;
        background: white;
        border-color: var(--border-light);
    }
    /* Overlay oscuro detrás del sidebar */
    .content::before {
        content: '';
        position: fixed;
        top: 0; left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        z-index: 1040;
        display: none;
    }
    .sidebar.mobile-open ~ .content::before {
        display: block;
    }
    /* Hacer tablas con scroll horizontal automático */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .table-wrapper {
        overflow-x: auto;
    }
}

@media (max-width: 575.98px) {
    .form-row {
        gap: 0.5rem;
    }
    .form-group {
        min-width: 100%;       /* Cada campo ocupa todo el ancho */
    }
    .save-section {
        flex-direction: column;
        align-items: stretch;
    }
    .save-section .btn {
        width: 100%;
        margin-left: 0 !important;
        margin-top: 8px;
    }
    .card {
        padding: 15px;
    }
    .content {
        padding: 15px;
    }
}

/* Fila de stock cero en reportes */
.stock-zero td {
    color: red !important;
    font-weight: bold !important;
    background-color: #fce4e4 !important;  /* rojo muy claro */
}