/* Layout Principal */
.app-shell { display: flex; height: 100vh; overflow: hidden; background: var(--bg-main); }
.main-wrapper { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow: hidden; }
.main-content { flex: 1; overflow-y: auto; padding: 24px; position: relative; }

/* Header */
.top-header { 
    height: 70px; display: flex; align-items: center; justify-content: space-between; 
    padding: 0 24px; background: var(--bg-card); border-bottom: 1px solid var(--border-color); 
    backdrop-filter: blur(12px); z-index: 40;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.hamburger-btn { background: transparent; border: none; color: var(--text-main); cursor: pointer; display: none; }

/* Sidebar */
.sidebar { 
    width: 260px; background: var(--bg-card); border-right: 1px solid var(--border-color); 
    display: flex; flex-direction: column; transition: transform 0.3s var(--ease); z-index: 50; 
}
.sidebar-logo { height: 70px; display: flex; align-items: center; padding: 0 24px; border-bottom: 1px solid var(--border-color); font-weight: 800; font-size: 1.2rem; letter-spacing: 1px; }
.sidebar-logo span { color: var(--accent); }
.sidebar-menu { flex: 1; overflow-y: auto; padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item { 
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; 
    color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.85rem; 
    cursor: pointer; transition: all 0.2s; border: 1px solid transparent; 
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.nav-item.active { background: linear-gradient(90deg, hsl(var(--hue1) 70% 50% / 0.1), transparent); color: var(--accent); border-left: 3px solid var(--accent); }
/* =========================================
   Submenú Desplegable (Acordeón)
   ========================================= */
.nav-item.has-dropdown {
    justify-content: space-between;
    padding-right: 16px;
}

.dropdown-arrow {
    transition: transform 0.3s var(--ease, ease);
    color: var(--text-muted);
}

.nav-item-group.open .dropdown-arrow {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--ease, ease), opacity 0.3s ease;
    opacity: 0;
    margin-left: 28px;
    border-left: 1px solid var(--border-color);
}

.nav-item-group.open .submenu {
    max-height: 150px; 
    opacity: 1;
    margin-top: 4px;
    margin-bottom: 8px;
}

.submenu-item {
    padding: 10px 16px;
    font-size: 0.80rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 0 8px 8px 0;
    position: relative;
    margin-bottom: 2px;
}

.submenu-item::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.submenu-item:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.03);
}

.submenu-item:hover::before {
    transform: scaleY(1);
}
/* Vistas SPA */
.view-section { display: none; animation: fadeIn 0.4s var(--ease); }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile Responsivo */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 45; backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.3s; }
.sidebar-overlay.show { display: block; opacity: 1; }

@media (max-width: 900px) {
    .sidebar { position: fixed; height: 100vh; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .hamburger-btn { display: block; }
    .sidebar-logo { display: none; }
}

/* Toast Notifications */
#toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--bg-card); color: var(--text-main); padding: 12px 24px;
    border-radius: 30px; font-weight: 700; font-size: 0.9rem; z-index: 9999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); opacity: 0; transition: all 0.3s var(--ease);
    border: 1px solid var(--border-color); backdrop-filter: blur(12px);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.ok { border-color: #10b981; color: #10b981; }
#toast.bad { border-color: #ef4444; color: #ef4444; }
#toast.warn { border-color: #f59e0b; color: #f59e0b; }
