.catalog-ribbon {
    position: fixed !important;
    width: 76px;
    height: auto;
    max-height: 85vh;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px) saturate(160%);
    -webkit-backdrop-filter: blur(15px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 38px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 0 !important;
    box-shadow: 0 25px 50px rgba(0,0,0,0.1), inset 0 0 0 1px rgba(255,255,255,0.5);
    touch-action: none;
    cursor: default; /* El cursor de agarre ahora es solo para el handle */
    user-select: none; /* Evita que el contenido se seleccione al arrastrar */
    /* Se eliminan width/height transitions para evitar el lag al arrastrar */
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
    overflow: visible; /* CRÍTICO: Permitir que la corona superior sobresalga */
}

.catalog-ribbon.is-expanded {
    border-color: #6366f1;
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.25);
}

/* Botón Cabeza del Ribbon: Llamativo y Brillante */
.ribbon-header-button {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
    border: 3px solid white;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0; /* Evita que se encoja */
    z-index: 10;
}

.ribbon-header-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.5);
}

.ribbon-header-text {
    color: white;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 2;
}

/* Efecto de Brillo (Shiny Animation) */
.ribbon-header-button::after {
    content: "";
    position: absolute;
    top: -50%; left: -100%;
    width: 50%; height: 200%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.6), transparent);
    transform: rotate(30deg);
    animation: ribbon-shine 4s infinite;
}

@keyframes ribbon-shine {
    0% { left: -100%; }
    15% { left: 150%; }
    100% { left: 150%; }
}

.catalog-tree {
    display: flex;
    flex-direction: column;
    gap: 10px; /* 54px rubro + 10px gap = 64px paso de scroll */
    max-height: 200px; /* Limitamos el área de iconos a ~3 unidades */
    height: auto;
    min-height: 0; /* CRÍTICO para habilitar scroll en flex */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px 0;
    scrollbar-width: none;
}

/* Feedback de arrastre (Drop Zones) */
.ribbon-drop-indicator {
    position: fixed;
    background: rgba(102, 126, 234, 0.15);
    border: 2px dashed #667eea;
    border-radius: 20px;
    z-index: 1500;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Estilo para los botones cuando están colapsados */
.catalog-tree-collapsed {
    display: flex;
    justify-content: center;
    width: 100%;
}

.plus-btn .tree-category-icon { font-size: 1.8em !important; font-weight: bold; }

.tree-category-header {
    width: 54px !important; height: 54px !important;
    border-radius: 50% !important;
    border: 2px solid #34495e !important;
    background: #f8fafc !important;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 54px !important; /* Tamaño fijo garantizado */
    cursor: pointer; transition: all 0.2s ease;
}

.tree-category-header.plus-btn { 
    border: 2px dashed #34495e !important; 
    background: transparent !important; 
}

.tree-category-header.active {
    background: #667eea !important; border-color: #667eea !important;
    transform: scale(1.15); color: white;
}

.floating-rubro-list {
    position: fixed !important;
    left: 100px !important;
    width: 340px !important;
    background: white;
    border-radius: 12px;
    box-shadow: 10px 10px 40px rgba(0,0,0,0.3);
    padding: 15px !important;
    z-index: 4000;
    animation: slideInLeft 0.2s ease-out;
}

.floating-list-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.2);
    z-index: 3500;
    backdrop-filter: blur(2px);
}

.ribbon-arrow {
    width: 40px; height: 40px;
    background: #f1f5f9; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #34495e;
}