/* --- VARIABLES Y CONFIGURACIÓN GLOBAL --- */
:root {
    /* Paleta de Colores (Dark Mode Clean) */
    --bg-body: #0f0a1e;
    /* Fondo principal muy oscuro */
    --bg-panel: #151024;
    /* Fondo de tarjetas/paneles */
    --bg-input: #1e1b2e;
    /* Fondo de inputs */

    --primary: #8b5cf6;
    /* Violeta Principal */
    --primary-hover: #7c3aed;
    /* Violeta Oscuro (Hover) */
    --primary-light: rgba(139, 92, 246, 0.1);
    /* Fondo sutil */

    --text-main: #ffffff;
    --text-muted: #94a3b8;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --border: rgba(255, 255, 255, 0.08);
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Space Grotesk', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    height: 100%;
    width: 100%;
    margin: 0;
    overflow: hidden;
    font-size: 16px;
}

/* --- SCROLLBAR PERSONALIZADO --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* --- SIDEBAR (Navegación Lateral) --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 50;
}

.brand {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--primary);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: white;
}

.nav-item.active {
    background-color: var(--primary-light);
    color: white;
    border-left-color: var(--primary);
}

.user-profile {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.logout-btn {
    margin-left: auto;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.logout-btn:hover {
    color: var(--danger);
}

/* --- CONTENIDO PRINCIPAL --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    /* Ancho del sidebar */
    padding: 2rem 3rem;
    width: calc(100% - 260px);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.school-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

h2 {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.8rem;
    color: white;
}

/* --- COMPONENTES UI: TARJETAS KPI --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.kpi-val {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    color: white;
}

.kpi-lbl {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* --- COMPONENTES UI: PANELES Y CAJAS --- */
.panel-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: var(--radius);
    height: 100%;
    /* Para que en grid ocupen lo mismo */
}

/* --- COMPONENTES UI: TABLAS --- */
.table-wrapper {
    background: var(--bg-panel);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    /* Para redondear bordes de tabla */
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.01);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* --- COMPONENTES UI: BOTONES --- */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--primary-light);
}

.btn-delete-mini {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 6px;
    font-size: 1.2rem;
    opacity: 0.7;
}

.btn-delete-mini:hover {
    opacity: 1;
}

/* --- COMPONENTES UI: FORMULARIOS --- */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    outline: none;
    transition: border-color 0.2s;
    font-size: 0.95rem;
}

.input:focus {
    border-color: var(--primary);
}

textarea.input {
    resize: vertical;
    min-height: 80px;
}

/* --- ELEMENTOS DE CURSOS Y TAGS (NUEVO) --- */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
}

.tag-item {
    background: var(--bg-body);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-item i {
    color: var(--danger);
    cursor: pointer;
    opacity: 0.6;
    font-size: 1rem;
}

.tag-item i:hover {
    opacity: 1;
}

.level-tag {
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 4px;
}

/* --- MODALES --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    /* Controlado por JS */
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal {
    background: var(--bg-panel);
    padding: 2rem;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    border: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* --- UTILIDADES --- */
.hidden {
    display: none !important;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}



/* Estilos para el Drag & Drop */
.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    margin-right: 8px;
    display: flex;
    align-items: center;
}

.drag-handle:hover {
    color: var(--primary);
}

.tag-item {
    /* Aseguramos que el tag-item se vea ordenado */
    transition: background 0.2s;
}

.sortable-ghost {
    opacity: 0.4;
    background: var(--bg-card);
    border: 1px dashed var(--primary);
}



/* --- SCROLLBARS GLOBALES (Diseño Slim) --- */
/* Aplica a todo el sitio */
* {
    scrollbar-width: thin;
    /* Para Firefox */
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Para Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: 6px;
    /* Vertical */
    height: 6px;
    /* Horizontal */
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    border: 2px solid transparent;
    /* Truco para que se vea "flotando" */
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Ajuste específico para cuando el scroll está sobre un fondo oscuro */
.dir-grid::-webkit-scrollbar-thumb,
.msg-contact-list::-webkit-scrollbar-thumb,
.tabs-container::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
}




/* ==========================================================================
   🚀 SIDEBAR 2.0 (ESTILOS BLINDADOS)
   Pega esto al final de main.css para sobrescribir cualquier conflicto
   ========================================================================== */

/* 1. TÍTULOS DE SECCIÓN (Núcleo Académico) */
.nav-section-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    /* Slate 500 - Color discreto */
    margin: 25px 0 10px 18px;
    font-weight: 800;
    white-space: nowrap;
    opacity: 1;
    pointer-events: none;
    transition: all 0.2s ease;
}

/* 2. DIVISORES */
.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 15px 20px;
    width: calc(100% - 40px);
    transition: all 0.2s ease;
}

/* 3. TEXTOS DE NAVEGACIÓN */
.nav-text {
    margin-left: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* =========================================================
   🙈 MODO COLAPSADO (.collapsed)
   Usamos !important para asegurarnos de que NADA se muestre
   ========================================================= */

.sidebar.collapsed {
    width: 80px !important;
}

/* Ocultar Textos: Opacidad 0 + Display None para que no ocupen espacio */
.sidebar.collapsed .nav-text {
    opacity: 0 !important;
    display: none !important;
}

/* Ocultar Títulos de Sección (Núcleo) */
.sidebar.collapsed .nav-section-header {
    opacity: 0 !important;
    display: none !important;
}

/* Ocultar Divisores (Limpieza visual) */
.sidebar.collapsed .nav-divider {
    display: none !important;
}

/* Centrar Iconos perfectamente */
.sidebar.collapsed .nav-item {
    justify-content: center !important;
    padding: 15px 0 !important;
}

.sidebar.collapsed .nav-item i {
    margin-right: 0 !important;
    font-size: 1.5rem !important;
}

/* Ocultar Badge "New" en modo colapsado para que no estorbe */
.sidebar.collapsed .badge-new {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    border-radius: 50%;
}












/* Contenedor de las pestañas */
.tab-pills {
    background: #1e1b2e;
    padding: 4px;
    border-radius: 12px;
    display: flex;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Estilo base de los botones */
.tab-btn {
    border: none;
    background: transparent;
    color: #94a3b8;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

/* Efecto Hover */
.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

/* Estado Activo (La pestaña seleccionada) */
.tab-btn.active {
    background: #8b5cf6 !important;
    /* El púrpura de la marca */
    color: white !important;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

/* Estilo para los iconos dentro del botón */
.tab-btn i {
    font-size: 1.1rem;
}



























/* =========================================
   🌌 ENTORNO BASE DEL SISTEMA (Teacher OS)
   ========================================= */
body.rubiku-os-environment {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at 50% -20%, #2d1b54, #0f0a1e 80%);
    color: white;
    font-family: 'Space Grotesk', sans-serif;
    position: relative;
}

/* Lienzo donde viven las ventanas */
.os-desktop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 65px);
    /* Deja espacio para la barra de tareas */
    overflow: hidden;
    z-index: 10;
}


/* EL CORAZÓN DE LAS VENTANAS VIRTUALES */
.window-body {
    flex: 1;
    /* Actúa como resorte: llena todo el espacio sobrante debajo del header */
    height: 100%;
    /* Toma la altura completa disponible */
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* CORTA cualquier desbordamiento. Esto fuerza a los scrolls internos a encenderse */
    position: relative;
}


/* =========================================
   🪟 VENTANAS FLOTANTES (Heredado y Mejorado)
   ========================================= */
.os-window {
    position: absolute;
    width: 65%;
    height: 72vh;
    min-width: 450px;
    min-height: 350px;
    pointer-events: auto;
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, .12);
    border-top: 1px solid rgba(255, 255, 255, .25);
    border-radius: 16px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    animation: windowPopIn .25s cubic-bezier(.175, .885, .32, 1.15);
}

.os-window::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, .18), transparent 35%),
        radial-gradient(circle at bottom right, rgba(120, 150, 255, .08), transparent 40%);
}

@keyframes windowPopIn {
    from {
        opacity: 0;
        transform: scale(0.93) translateY(15px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.os-window.minimized {
    transform: scale(0.2) translateY(800px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.6, -0.28, 0.735, 0.045);
}

.os-window.closing {
    animation: windowPopOut 0.2s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
}

@keyframes windowPopOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    to {
        opacity: 0;
        transform: scale(0.85) translateY(30px);
        filter: blur(5px);
    }
}

.window-header {
    touch-action: none;
    user-select: none;
    background: rgba(0, 0, 0, 0.25);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: grab;
    user-select: none;
    z-index: 2;
    touch-action: none;
    /* 🔥 ESTA ES LA MAGIA: Desactiva el scroll nativo al tocar la cabecera */
}


.window-header:active {
    cursor: grabbing;
}

.window-title {
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.win-btn {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.win-btn i {
    font-size: 7px;
    opacity: 0;
    transition: opacity 0.2s;
    color: rgba(0, 0, 0, 0.6);
}

.window-controls:hover .win-btn i {
    opacity: 1;
}

.btn-min {
    background: #f59e0b;
}

.btn-max {
    background: #10b981;
}

.btn-close {
    background: #ef4444;
}

/* =========================================
   ⚓ BARRA DE TAREAS INFERIOR (Taskbar)
   ========================================= */
.os-taskbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 400px;
    height: 70px;
    background: rgba(15, 10, 30, 0.75);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    box-sizing: border-box;
    z-index: 9000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.taskbar-left,
.taskbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
    /* Flexible width for iPad dock, fixed for compressed */
}

.taskbar-right {
    justify-content: flex-end;
}

.taskbar-center {
    display: flex;
    justify-content: center;
    flex: 1;
    margin: 0 20px;
}

/* Modo comprimido (estilo Windows) cuando hay ventanas abiertas */
.os-taskbar.compressed {
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 44px;
    padding: 0 15px;
    background: rgba(15, 10, 30, 0.95);
    border-radius: 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
    transition: all 0.25s ease;
}

.os-taskbar.compressed .taskbar-left,
.os-taskbar.compressed .taskbar-right {
    width: 200px;
}

.os-taskbar.compressed .dock-icon {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    border-radius: 8px;
    box-shadow: none;
}

.os-taskbar.compressed .hub-logo {
    height: 20px;
}

.os-taskbar.compressed .sys-btn {
    width: 30px;
    height: 30px;
    font-size: 1rem;
    border-radius: 8px;
}

.os-taskbar.compressed .profile-avatar-mini {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.os-taskbar.compressed .dock-item:hover {
    transform: translateY(-2px) scale(1.05);
}

.os-taskbar.compressed .dock-item::after {
    margin-top: 2px;
}

.os-taskbar.compressed~.os-desktop {
    height: calc(100% - 44px);
}

/* Transición suave para el taskbar */
.os-taskbar,
.dock-icon,
.hub-logo,
.sys-btn,
.profile-avatar-mini {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Botón Maestro del Hub */
.hub-trigger {
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hub-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.hub-logo {
    height: 28px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

/* Dock Central */
.os-dock {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 15px;
}

.dock-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dock-item:hover {
    transform: translateY(-5px) scale(1.1);
    z-index: 10;
}

.dock-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: 0.3s;
}

/* Tooltip al pasar el mouse */
.dock-tooltip {
    position: absolute;
    top: -40px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.2s;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dock-item:hover .dock-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* Puntos indicadores del Dock */
.dock-item::after {
    content: '';
    width: 4px;
    height: 4px;
    background: transparent;
    border-radius: 50%;
    margin-top: 5px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0);
}

.dock-item.app-running::after {
    background: #8b5cf6;
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 8px #8b5cf6;
}

.dock-item.app-running.app-focused .dock-icon {
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.4), 0 5px 20px rgba(0, 0, 0, 0.5);
    filter: brightness(1.2);
}

/* Área del Sistema (Derecha) */
.sys-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}

.sys-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 8px #ef4444;
}

.sys-profile {
    cursor: pointer;
    transition: 0.2s;
}

.sys-profile:hover {
    transform: scale(1.05);
}

.profile-avatar-mini {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* =========================================
   🚀 SÚPER HUB DE APLICACIONES (2 Columnas)
   ========================================= */
.os-hub {
    position: fixed;
    bottom: 85px;
    left: 50%;
    width: 85vw;
    /* Mucho más ancho para soportar ambas columnas */
    max-width: 1100px;
    /* Límite máximo para pantallas gigantes */
    height: 75vh;
    /* Altura fija para el layout interno */
    background: rgba(15, 10, 30, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    /* Por encima de las ventanas (#window-manager-container usa 9700) y debajo de los modales (9999).
       Antes era 999: al abrir el Hub con ventanas abiertas quedaba detrás de ellas. */
    z-index: 9800;
    overflow: hidden;
    /* Evita que el interior se desborde */

    /* Animación Centrada */
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(30px) scale(0.95);
    transform-origin: bottom center;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Fuerza la visibilidad sin importar qué */
.os-hub.open {
    opacity: 1 !important;
    pointer-events: auto !important;
    display: flex !important;
    visibility: visible !important;
}

/* 🧱 Layout de las dos columnas */
.hub-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.hub-left-col {
    flex: 1;
    min-width: 350px;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.hub-right-col {
    flex: 2;
    /* Toma el resto del espacio */
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Ajustes menores para el grid de la izquierda */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 15px;
    padding: 15px 20px 25px;
    overflow-y: auto;
}

.os-hub.open {
    opacity: 1;
    pointer-events: auto;
    /* Al abrirse, mantiene el centrado (-50%) */
    transform: translateX(-50%) translateY(0) scale(1);
}

.hub-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hub-search-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    gap: 10px;
}

.hub-search-box i {
    color: #8b5cf6;
    font-size: 1.2rem;
}

.hub-search-box input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
}

.hub-categories {
    padding: 15px 20px 5px;
}

.hub-subtitle {
    margin: 0;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hub-grid {
    padding: 10px 20px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Filas de Apps en el Hub */
.hub-app-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: 0.2s;
}

.hub-app-row:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.hub-app-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.hub-app-info {
    flex: 1;
}

.hub-app-name {
    font-weight: 700;
    color: white;
    font-size: 0.95rem;
}

.hub-app-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: 0.2s;
}

.hub-app-row:hover .hub-app-actions {
    opacity: 1;
}

.hub-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: 0.2s;
}

.hub-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hub-btn-open {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border-color: rgba(139, 92, 246, 0.3);
}

.hub-btn-open:hover {
    background: #8b5cf6;
    color: white;
}

.hub-btn-pin.pinned {
    color: #f59e0b;
}





/* =========================================
   🚀 HUB DE APLICACIONES (GRID STYLE)
   ========================================= */

.hub-grid {
    display: grid;
    /* Cuadrícula adaptable: 3 o 4 columnas dependiendo del ancho */
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 15px;
    padding: 15px 20px 25px;
    overflow-y: auto;
}

.hub-app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px 10px;
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.hub-app-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-3px);
}

.hub-app-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hub-app-card:hover .hub-app-icon {
    transform: scale(1.1);
}

.hub-app-name {
    font-size: 0.75rem;
    color: #e2e8f0;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 📌 Botón de Fijar al Dock (Estilo sutil) */
.hub-btn-pin {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s;
    cursor: pointer;
}

.hub-app-card:hover .hub-btn-pin {
    opacity: 1;
    transform: scale(1);
}

.hub-btn-pin:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Estado cuando ya está en el Dock */
.hub-btn-pin.pinned {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
    opacity: 1;
    /* Siempre visible para saber que ya está fijado */
}

/* =========================================
   ?? ELEMENTOS FLOTANTES EXPANDIBLES (TOP CORNERS)
   ========================================= */

.floating-glass-top-left,
.floating-glass-top-right {
    position: fixed;
    top: 25px;
    z-index: 9600;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    /* Para no bloquear clicks del layout, se reactiva en los hijos */
}

.floating-glass-top-left {
    left: 25px;
}

.floating-glass-top-right {
    right: 25px;
    justify-content: flex-end;
}

.floating-glass-top-left>*,
.floating-glass-top-right>* {
    pointer-events: auto;
}

/* --- Botï¿½n de Plan / Tienda --- */
.floating-glass-btn {
    background: rgba(15, 10, 30, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 100px;
    height: 46px;
    width: 46px;
    /* Cï¿½rculo perfecto por defecto */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.floating-glass-btn i {
    font-size: 1.3rem;
    color: #10b981;
    flex-shrink: 0;
}

.store-hidden-content {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 0;
    opacity: 0;
    white-space: nowrap;
    transition: max-width 0.4s ease, opacity 0.3s ease, margin-left 0.3s ease;
    font-weight: 600;
    font-size: 0.85rem;
}

.status-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.blocked {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Al pasar el mouse el botón NO crece (antes se ensanchaba, corría a los vecinos y se quedaba abriendo y
   cerrando): el nombre sale como etiqueta debajo, fuera del flujo, sin mover nada. */
.floating-glass-btn:hover {
    background: rgba(15, 10, 30, 0.8);
    border-color: rgba(167, 139, 250, 0.55);
    overflow: visible;
}

.floating-glass-btn .store-hidden-content {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    max-width: none;
    margin: 0;
    padding: 7px 11px;
    border-radius: 12px;
    background: rgba(15, 10, 30, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.floating-glass-top-right .floating-glass-btn {
    position: relative;
}

.floating-glass-top-right .floating-glass-btn .store-hidden-content {
    left: auto;
    right: 0;
}

.floating-glass-btn:hover .store-hidden-content {
    opacity: 1;
    transform: none;
}

/* --- Pï¿½ldora del Perfil --- */
.floating-profile-pill {
    background: rgba(15, 10, 30, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    height: 46px;
    width: 46px;
    /* Cï¿½rculo perfecto por defecto */
    padding: 3px;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    cursor: pointer;
}

.fp-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.fp-hidden-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 0;
    opacity: 0;
    white-space: nowrap;
    transition: max-width 0.4s ease, opacity 0.3s ease;
}

.fp-name {
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    margin-left: 8px;
}

.fp-logout {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.fp-logout:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

.floating-profile-pill:hover {
    width: auto;
    padding: 3px 6px 3px 3px;
    background: rgba(15, 10, 30, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}

.floating-profile-pill:hover .fp-hidden-content {
    max-width: 200px;
    opacity: 1;
}

/* =========================================
   ??? CONTROLES DE VISTA DEL HUB
   ========================================= */

/* --- 1. Modo Iconos + Texto (Default / .view-mode-icons-text) --- */
.hub-grid.view-mode-icons-text {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 15px;
}

.hub-grid.view-mode-icons-text .hub-app-card {
    flex-direction: column;
    text-align: center;
}

/* --- 2. Modo Lista (.view-mode-list) --- */
.hub-grid.view-mode-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hub-grid.view-mode-list .hub-app-card {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 15px;
    gap: 15px;
}

.hub-grid.view-mode-list .hub-app-name {
    flex: 1;
    text-align: left;
}

/* --- 3. Modo Solo Iconos (.view-mode-icons-only) --- */
.hub-grid.view-mode-icons-only {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 15px;
}

.hub-grid.view-mode-icons-only .hub-app-card {
    padding: 10px;
}

.hub-grid.view-mode-icons-only .hub-app-name {
    display: none;
}

/* Botones de control de vista */
.btn-icon-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    padding: 0;
}

.btn-icon-small:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.hub-grid.view-mode-icons-only .hub-btn-pin {
    display: none;
}

.hub-grid.view-mode-list .hub-btn-pin {
    position: relative;
    top: auto;
    right: auto;
    opacity: 1;
    /* always visible in list mode */
}

/* ==========================================================================
   📱 RUBIKU OS MOBILE (Adaptación Magistral e Inteligente)
   ========================================================================== */
/* Modo táctil (teléfonos y tablets): lo activa /go/js/core/device_profile.js con <html class="rk-touch">.
   Antes era @media (max-width:1600px) and (hover:none), que los iPad con Pencil/trackpad no cumplían.
   Cubre móviles y tablets en vertical/horizontal. */
    /* En el TELÉFONO cada app ocupa toda la pantalla (no caben dos).
       23-oct-2026: antes era html.rk-touch (teléfonos Y tablets) y en el iPad solo se podía ver una ventana a la
       vez. En tablets las ventanas flotan, se arrastran con el dedo y se acomodan en columnas (window_snap.js). */
    html.rk-phone .os-window {
        zoom: 0.8 !important; /* Zoom interno para que el contenido no estorbe y sea fácil de usar */
        width: 125vw !important; /* 100 / 0.8 = 125. Compensa el zoom para llenar el ancho */
        height: calc((100vh - 75px) * 1.25) !important; /* Compensa el alto descontando la barra */
        height: calc((100dvh - 75px) * 1.25) !important; /* Mejor soporte en iOS/Android modernos */
        min-width: 0 !important;
        min-height: 0 !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
        transform: none !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* La barra de tareas (Dock) se adapta al ancho total y se fija al fondo */
    html.rk-touch .os-taskbar {
        width: 100% !important; /* Mejor que 100vw para evitar scroll horizontal */
        box-sizing: border-box !important;
        height: auto !important; /* Para acomodar el safe-area */
        min-height: 75px !important;
        padding: 10px 15px calc(10px + env(safe-area-inset-bottom, 0px)) !important; /* Soporte para el notch inferior de iOS/Android */
        bottom: 0 !important;
        left: 0 !important;
        transform: none !important; /* CORRIGE EL BUG DEL DESPLAZAMIENTO A LA IZQUIERDA */
        position: fixed !important;
        border-radius: 0 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        background: rgba(15, 10, 30, 0.98) !important;
        backdrop-filter: blur(25px) !important;
        -webkit-backdrop-filter: blur(25px) !important;
        z-index: 9999 !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    html.rk-touch .taskbar-left,
    html.rk-touch .taskbar-right {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        flex-shrink: 0 !important;
    }

    html.rk-touch .taskbar-center {
        display: flex !important;
        justify-content: center !important;
        flex: 1 1 auto !important;
        min-width: 0 !important; /* Permite que el flex item se encoja sin desbordar */
        margin: 0 10px !important;
        overflow: hidden !important;
    }

    /* Ajustamos el espacio en el dock para que no colapse */
    html.rk-touch .os-dock {
        gap: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding-bottom: 0 !important;
        scrollbar-width: none !important; /* Firefox */
        -ms-overflow-style: none !important; /* IE/Edge */
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important; /* Para que al scrollear no se rompa */
    }
    
    html.rk-touch .os-dock::-webkit-scrollbar {
        display: none !important; /* Oculta barra de scroll en Chrome/Safari/iOS */
    }

    /* Hacemos los íconos un poco más cómodos para el dedo (touch targets) */
    html.rk-touch .dock-item {
        width: 55px !important;
        height: 55px !important;
        flex-shrink: 0 !important;
        object-fit: contain !important; /* Mantiene proporción perfecta */
    }

    html.rk-touch .hub-logo {
        width: auto !important;
        height: 35px !important; /* Ajuste para que mantenga proporción */
        max-width: 120px !important;
        object-fit: contain !important; /* Evita que se vea aplastado */
    }

    /* El Hub de apps (menú inicio) se vuelve pantalla completa (modal style) */
    html.rk-touch .os-hub {
        left: 0 !important;
        right: 0 !important;
        bottom: calc(75px + env(safe-area-inset-bottom, 0px)) !important;
        width: 100% !important;
        max-width: 100% !important;
        height: calc(100vh - 75px - env(safe-area-inset-bottom, 0px)) !important;
        height: calc(100dvh - 75px - env(safe-area-inset-bottom, 0px)) !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        padding-bottom: 20px !important;
        overflow-y: auto !important;
        box-sizing: border-box !important;
        /* Anula el centrado de escritorio (translateX(-50%)) que lo sacaba de pantalla */
        transform: translateY(30px) !important;
        transform-origin: bottom center !important;
    }

    html.rk-touch .os-hub.open {
        transform: translateY(0) !important;
    }
    
    /* Hub paginado: [Apps] ⇄ [Vistazo rápido]. Las apps se deslizan a la izquierda y el
       Vistazo aparece "detrás" (el efecto de profundidad lo pone /go/js/modules/rubikuos/hub_pager.js). */
    html.rk-touch .os-hub.open {
        flex-direction: column !important;
    }

    html.rk-touch .os-hub {
        overflow: hidden !important;
    }

    html.rk-touch .hub-layout {
        flex-direction: row !important;
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        position: relative;
    }

    html.rk-touch .hub-layout::-webkit-scrollbar {
        display: none;
    }

    html.rk-touch .hub-left-col {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        min-height: 0 !important;
        padding: 20px !important;
        box-sizing: border-box !important;
        border-right: none !important;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        position: relative;
        z-index: 2;
        /* Opaca: es la "capa de arriba" que se desliza dejando ver el Vistazo detrás */
        background: #120c22 !important;
        box-shadow: 18px 0 40px rgba(0, 0, 0, 0.55);
        will-change: opacity;
    }

    html.rk-touch .hub-grid {
        min-height: 0 !important;
        flex: 1 1 auto !important;
    }

    html.rk-touch .hub-right-col {
        display: block !important;
        flex: 0 0 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 12px 14px 0 !important;
        box-sizing: border-box !important;
        /* visible: el contenido se desplaza (parallax) hacia la zona de las apps, detrás de ellas.
           La caja de la columna no se transforma para no alterar el ancho desplazable ni el snap. */
        overflow: visible !important;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        z-index: 1;
        will-change: opacity;
    }

    html.rk-touch .hub-right-col > * {
        transform: translateX(var(--hub-shift, 0px)) scale(var(--hub-scale, 1));
        will-change: transform;
    }

    /* Selector Apps | Vistazo (lo inyecta hub_pager.js) */
    .hub-pager-tabs,
    .hub-pager-handle {
        display: none;
    }

    html.rk-touch .hub-pager-tabs {
        display: flex;
        position: relative;
        flex: 0 0 auto;
        margin: 14px 20px 0;
        padding: 4px;
        border-radius: 14px;
        background: rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .hub-pager-thumb {
        position: absolute;
        top: 4px;
        bottom: 4px;
        left: 4px;
        width: calc(50% - 4px);
        border-radius: 10px;
        background: rgba(139, 92, 246, 0.22);
        border: 1px solid rgba(139, 92, 246, 0.45);
        box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
        pointer-events: none;
    }

    .hub-pager-tab {
        position: relative;
        z-index: 1;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 8px;
        background: none;
        border: none;
        color: #94a3b8;
        font-size: 0.95rem;
        font-weight: 600;
        cursor: pointer;
        transition: color 0.2s;
        -webkit-tap-highlight-color: transparent;
    }

    .hub-pager-tab[aria-selected="true"] {
        color: #fff;
    }

    .hub-pager-tab i {
        font-size: 1.15rem;
    }

    /* Asa en el borde derecho: invita a deslizar y también funciona como botón */
    html.rk-touch .hub-pager-handle {
        display: flex;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 5;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 14px 6px 14px 8px;
        border-radius: 14px 0 0 14px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-right: none;
        background: rgba(139, 92, 246, 0.18);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        color: #fff;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        animation: hubPagerNudge 2.4s ease-in-out 0.6s 2;
    }

    .hub-pager-handle i {
        font-size: 1.2rem;
    }

    .hub-pager-handle span {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.75);
    }

    @keyframes hubPagerNudge {
        0%, 60%, 100% { transform: translateY(-50%) translateX(0); }
        70% { transform: translateY(-50%) translateX(-8px); }
        80% { transform: translateY(-50%) translateX(0); }
        90% { transform: translateY(-50%) translateX(-4px); }
    }

    /* Tablet en horizontal: hay espacio para ver ambas columnas a la vez, como en escritorio */
    @media (min-width: 1000px) and (orientation: landscape) {
        html.rk-tablet .hub-layout {
            overflow: hidden !important;
            scroll-snap-type: none;
        }

        html.rk-tablet .hub-left-col {
            flex: 1 1 0 !important;
            max-width: 460px !important;
            border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
        }

        html.rk-tablet .hub-right-col {
            flex: 2 1 0 !important;
            width: auto !important;
            padding: 12px !important;
        }

        html.rk-tablet .hub-pager-tabs,
        html.rk-tablet .hub-pager-handle {
            display: none;
        }
    }

    html.rk-touch .hub-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
        gap: 20px !important;
    }

    /* Elementos flotantes que estorban en celular se ocultan o ajustan */
    html.rk-touch .floating-glass-top-left {
        display: none !important;
    }

    html.rk-touch .floating-glass-top-right {
        top: 15px !important;
        right: 15px !important;
        transform: scale(0.9) !important;
        z-index: 9998 !important; /* Debajo de los modales pero sobre el escritorio */
    }

    /* Con una ventana abierta, el avatar se compacta en la esquina para caber dentro de la cabecera */
    html.rk-touch body:has(.os-window:not(.minimized)) .floating-glass-top-right {
        top: 6px !important;
        right: 8px !important;
        transform: scale(0.75) !important;
        transform-origin: top right !important;
    }

    /* Con una ventana abierta, el círculo de la tienda se oculta: quedaba sobre los botones de la
       ventana (y al tocarlo se expandía encima). La tienda sigue disponible en el menú de apps. */
    html.rk-touch body:has(.os-window:not(.minimized)) .floating-glass-top-right .floating-glass-btn {
        display: none !important;
    }

    /* Cabecera de ventana: reserva espacio a la derecha para el avatar y agranda los botones táctiles */
    html.rk-touch .window-header {
        min-height: 56px !important;
        padding: 8px 84px 8px 14px !important;
        box-sizing: border-box !important;
        gap: 10px !important;
    }

    html.rk-touch .window-title {
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    html.rk-touch .window-controls {
        gap: 14px !important;
        flex-shrink: 0 !important;
    }

    html.rk-touch .win-btn {
        width: 30px !important;
        height: 30px !important;
    }

    /* Sin hover en pantallas táctiles: los íconos deben verse siempre */
    html.rk-touch .win-btn i {
        font-size: 14px !important;
        opacity: 1 !important;
    }

    /* Adaptar botones del sistema para touch */
    html.rk-touch .sys-btn {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.6rem !important;
    }

    /* Modal ajustado a móvil */
    html.rk-touch .modal {
        zoom: 0.85 !important;
        width: 112% !important; /* Compensa el zoom (95% * 1.17) */
        max-width: 112% !important;
        padding: 1.5rem !important;
        border-radius: 16px !important;
        margin: auto !important;
    }


/* Teléfonos extremadamente angostos */
@media (max-width: 500px) {
    .hub-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }
    .os-dock {
        gap: 10px !important;
    }
    .dock-item {
        width: 50px !important;
        height: 50px !important;
    }
    .app-icon {
        width: 45px !important;
        height: 45px !important;
        object-fit: contain !important;
    }
    .app-name {
        font-size: 0.8rem !important;
    }
}


/* ==========================================================================
   RUBIKU HUB · identidad (2026-10-09)
   Franjas de los 5 colores, vidrio oscuro con brillos de marca, mosaicos de apps con luz,
   buscador y vistas con acento Rubiku. En teléfonos: 4 columnas cómodas al dedo, nombres a dos
   líneas, buscador fijo arriba y aparición desde abajo.
   ========================================================================== */
.os-hub {
    background: rgba(15, 10, 30, 0.92);
    border: 1px solid rgba(196, 181, 253, 0.18);
    font-family: 'Space Grotesk', system-ui, sans-serif;
}
.os-hub::before {
    content: '';
    position: absolute; left: 0; right: 0; top: 0; height: 4px; z-index: 6;
    background: linear-gradient(90deg, #fcd34d 0 20%, #fb923c 20% 40%, #ef4444 40% 60%, #a855f7 60% 80%, #6d28d9 80% 100%);
    pointer-events: none;
}
.hub-left-col { background: linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.12)); }
.hub-header { padding-top: 20px !important; }
.hub-applications-title {
    position: relative; display: inline-flex; flex-direction: column; gap: 6px;
    font-family: 'Space Grotesk', system-ui, sans-serif !important; font-weight: 800 !important; letter-spacing: -0.01em;
}
.hub-applications-title::after {
    content: ''; width: 76px; height: 4px; border-radius: 3px;
    background: linear-gradient(90deg, #fcd34d 0 20%, #fb923c 20% 40%, #ef4444 40% 60%, #a855f7 60% 80%, #6d28d9 80% 100%);
}
.hub-view-controls .btn-icon-small { border-radius: 9px; width: 32px; height: 32px; }
.hub-view-controls .btn-icon-small:hover { background: linear-gradient(135deg, #a855f7, #6d28d9); color: #fff; border-color: transparent; }

.hub-search-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(196, 181, 253, 0.22);
    border-radius: 14px;
    transition: border-color .2s, box-shadow .2s;
}
.hub-search-box:focus-within { border-color: #a855f7; box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.22); }
.hub-search-box i { color: #fcd34d; }

.hub-app-card { border-radius: 18px; -webkit-tap-highlight-color: transparent; }
.hub-app-card:hover { background: rgba(255, 255, 255, 0.06); }
.hub-app-card:active { transform: scale(0.95); }
/* Íconos planos: solo color de fondo y borde (sin sombras ni brillos) */
.hub-app-icon { border-radius: 18px; box-shadow: none; }
.hub-app-card:hover .hub-app-icon { transform: translateY(-3px); box-shadow: none; }
.hub-app-name {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700; color: #f1f5f9;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hub-btn-pin.pinned { color: #fcd34d; background: rgba(252, 211, 77, 0.16); border-color: rgba(252, 211, 77, 0.45); }

/* Botón del Hub: solo las 5 franjas planas, juntas, debajo del logo */
.hub-trigger { position: relative; }
.hub-trigger::after {
    content: ''; position: absolute; left: 50%; bottom: 1px; width: 40px; height: 3px; transform: translateX(-50%);
    border-radius: 2px; pointer-events: none;
    background: linear-gradient(90deg, #fcd34d 0 20%, #fb923c 20% 40%, #ef4444 40% 60%, #a855f7 60% 80%, #6d28d9 80% 100%);
    transition: width .25s;
}
.hub-trigger:hover::after, body:has(.os-hub.open) .hub-trigger::after { width: 56px; }

/* Selector Apps | Vistazo en color plano */
.hub-pager-thumb { background: rgba(168, 85, 247, 0.35); border-color: rgba(196, 181, 253, 0.5); box-shadow: none; }
html.rk-touch .hub-pager-handle { background: rgba(168, 85, 247, 0.3); }

/* ---------- Teléfonos y tablets ---------- */
html.rk-touch .os-hub { animation: rkHubUp .32s cubic-bezier(.2, .8, .2, 1) both; }
html.rk-touch .os-hub:not(.open) { animation: none; }
@keyframes rkHubUp { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
html.rk-touch .hub-left-col { padding: 14px 14px 0 !important; background: linear-gradient(180deg, #160e2a, #120c22) !important; }
html.rk-touch .hub-header { padding: 6px 4px 12px !important; border-bottom: none !important; }
html.rk-touch .hub-search-box {
    margin: 0 4px 10px !important; position: sticky; top: 0; z-index: 3;
    background: rgba(30, 20, 55, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
html.rk-touch .hub-search-box input { font-size: 16px; } /* evita el zoom automático de iOS */
html.rk-touch .hub-grid { padding: 4px 2px calc(24px + env(safe-area-inset-bottom, 0px)) !important; }
html.rk-touch .hub-grid.view-mode-icons-text,
html.rk-touch .hub-grid:not(.view-mode-list):not(.view-mode-icons-only) {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 14px 6px !important;
}
html.rk-touch .hub-grid.view-mode-icons-only { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 12px 6px !important; }
html.rk-touch .hub-app-card { padding: 8px 2px !important; gap: 7px !important; }
html.rk-touch .hub-app-icon { width: 56px !important; height: 56px !important; font-size: 1.75rem !important; border-radius: 18px !important; }
html.rk-touch .hub-app-name { font-size: 0.72rem !important; line-height: 1.2 !important; }
html.rk-touch .hub-grid.view-mode-list .hub-app-card { padding: 8px 10px !important; }
html.rk-touch .hub-grid.view-mode-list .hub-app-icon { width: 44px !important; height: 44px !important; font-size: 1.35rem !important; border-radius: 14px !important; }
html.rk-touch .hub-grid.view-mode-list .hub-app-name { font-size: 0.92rem !important; }
/* Sin hover en táctil: el pin solo se ve si está fijado */
html.rk-touch .hub-app-card .hub-btn-pin:not(.pinned) { display: none; }
html.rk-touch .hub-app-card .hub-btn-pin.pinned { width: 20px; height: 20px; top: 2px; right: 6px; font-size: .62rem; }
@media (max-width: 360px) {
    html.rk-touch .hub-grid.view-mode-icons-text,
    html.rk-touch .hub-grid:not(.view-mode-list):not(.view-mode-icons-only) { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (prefers-reduced-motion: reduce) { html.rk-touch .os-hub { animation: none; } }
/* Escritorio: tres apps por fila aunque el Hub sea angosto */
html:not(.rk-touch) .hub-grid.view-mode-icons-text { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
