
    :root {
        --bg: #0b0e14; --card: #151921; --border: #2d333b;
        --neon-green: #00ff88; --neon-red: #ff4444; 
        --neon-blue: #00d4ff; --neon-yellow: #ffd500; 
        --neon-purple: #b100ff; --neon-orange: #ff8800;
        --neon-pink: #ff007f; --neon-cyan: #00e5ff;
        --text: #e0e6ed; --text-dim: #8b949e;
    }

    body { background-color: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; margin: 0; padding: 0; padding-bottom: 30px; display: flex; flex-direction: column; align-items: center; min-height: 100vh; -webkit-tap-highlight-color: transparent; }
    
    #login-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999; }
    .login-card { background: var(--card); padding: 30px; border-radius: 20px; border: 1px solid var(--neon-cyan); text-align: center; box-shadow: 0 0 20px rgba(0, 212, 255, 0.2); width: 90%; max-width: 350px; }
    .login-logo { max-width: 180px; margin-bottom: 20px; filter: drop-shadow(0 0 10px var(--neon-cyan)); }
    
    #loading-screen { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg); flex-direction: column; align-items: center; justify-content: center; z-index: 9998; }
    .spinner { width: 60px; height: 60px; border: 4px solid rgba(0, 212, 255, 0.1); border-left-color: var(--neon-cyan); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 20px; }
    @keyframes spin { to { transform: rotate(360deg); } }

    #main-app { display: none; width: 100%; max-width: 700px; padding: 10px; box-sizing: border-box; margin-top: env(safe-area-inset-top); }

    .header { text-align: center; padding: 10px 0; margin-bottom: 15px; position: relative; }
    .app-logo { max-width: 130px; margin-bottom: 5px; filter: drop-shadow(0 0 8px rgba(0,255,136,0.3)); }
    .btn-logout { position: absolute; top: 10px; right: 0; background: transparent; border: 1px solid var(--neon-red); color: var(--neon-red); padding: 5px 10px; width: auto; font-size: 0.7rem; border-radius: 5px; cursor: pointer; }
    
    .tabs-container { overflow-x: auto; white-space: nowrap; margin-bottom: 15px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); padding: 5px; }
    .tabs { display: inline-flex; gap: 5px; min-width: 100%; }
    .tab-btn { flex: 1; background: transparent; border: none; color: var(--text-dim); padding: 10px 15px; cursor: pointer; font-weight: bold; font-size: 0.75rem; text-transform: uppercase; border-radius: 5px; }
    .tab-btn.active { color: #fff; background: rgba(0, 229, 255, 0.1); border: 1px solid var(--neon-cyan); }

    .tab-content { display: none; animation: fadeIn 0.3s ease; }
    .tab-content.active { display: block; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

    .card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 15px; margin-bottom: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.4); }
    .card-title { margin-top: 0; font-size: 0.9rem; color: var(--text-dim); text-transform: uppercase; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center;}

    .data-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.9rem; align-items: center;}
    .label { color: var(--text-dim); }
    .value { font-weight: bold; font-family: 'Courier New', monospace; }
    
    .progress-bg { background: #000; height: 10px; border-radius: 5px; margin: 10px 0; border: 1px solid #333; overflow: hidden; }
    .progress-bar { height: 100%; border-radius: 5px; transition: 0.5s; }

    input, button, select { padding: 12px; border-radius: 8px; border: 1px solid var(--border); background: #000; color: #fff; font-size: 0.9rem; width: 100%; box-sizing: border-box;}
    button { cursor: pointer; font-weight: bold; text-transform: uppercase; transition: 0.2s; margin-top: 5px; border: 1px solid var(--border); }

    .table-scroll { overflow-x: auto; max-height: 220px; margin-top: 10px; border: 1px solid #222; border-radius: 8px; }
    table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
    th { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); background: #1c2128; z-index: 10; }
    td { padding: 8px; border-bottom: 1px solid #1c2128; font-family: 'Courier New', monospace;}

    .item-list { display: flex; justify-content: space-between; align-items: center; background: #000; padding: 8px; border-radius: 5px; margin-bottom: 5px; border-left: 3px solid var(--neon-green); font-size: 0.85rem;}
    .item-list-right { display: flex; align-items: center; gap: 10px; }
    .del-btn { color: var(--neon-red); background: transparent; border: none; font-size: 1.2rem; padding: 0 5px; cursor: pointer; width: auto; margin: 0;}

    .forecast-box { background: rgba(0, 229, 255, 0.05); border: 1px dashed var(--neon-cyan); padding: 15px; border-radius: 10px; margin-top: 15px; }
    .forecast-big { font-size: 2rem; color: var(--neon-cyan); text-align: center; margin: 10px 0; font-family: 'Courier New', monospace; font-weight: bold; text-shadow: 0 0 10px rgba(0,229,255,0.4); }

    .custom-icon { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; margin-right: 8px; vertical-align: middle; border: 1px solid var(--border); }
    .trophy-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; padding: 10px 0; }
    .trophy-item { text-align: center; width: 85px; transition: 0.3s; }
    .trophy-custom-icon { width: 45px; height: 45px; border-radius: 8px; object-fit: cover; margin: 0 auto 5px auto; display: block; border: 1px solid var(--border); transition: 0.4s; }
    .trophy-name { font-size: 0.6rem; font-weight: bold; margin-top: 5px; text-transform: uppercase; }
    .locked .trophy-custom-icon { opacity: 0.3; filter: grayscale(100%); }
    .unlocked .trophy-custom-icon { opacity: 1; filter: none; transform: scale(1.1); }
    .unlocked { transform: scale(1.05); }

    input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; margin: 10px 0; padding: 0;}
    input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%; background: var(--neon-cyan); cursor: pointer; margin-top: -6px; }
    input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: var(--border); border-radius: 2px; }
    
    .input-group { display: flex; gap: 10px; margin-bottom: 10px; align-items: center;}
    .input-group label { flex: 1; font-size: 0.8rem; color: var(--text-dim); }
    .input-group input { flex: 1; }

    .pwd-blur { filter: blur(5px); cursor: pointer; transition: 0.3s; color: var(--text); user-select: none; }
    .pwd-reveal { filter: blur(0); color: var(--neon-pink); }
    .vault-item { background: #000; padding: 10px; border-radius: 8px; border-left: 3px solid var(--neon-pink); margin-bottom: 8px; font-size: 0.85rem;}
    @keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-5px); } 100% { transform: translateX(0); } }

    .terminal-box { background: #000; padding: 10px; border-radius: 8px; border: 1px solid #1a222c; height: 120px; overflow-y: auto; font-family: 'Courier New', monospace; font-size: 0.7rem; color: var(--neon-green); box-shadow: inset 0 0 10px rgba(0,255,136,0.05); display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth; }
    .log-entry { margin: 0; padding: 0; word-break: break-all; }
    .log-time { color: var(--text-dim); margin-right: 5px; }

    .chart-container { display: flex; justify-content: center; align-items: center; margin: 20px 0; gap: 20px;}
    .donut-wrapper { position: relative; width: 120px; height: 120px; border-radius: 50%; display: flex; justify-content: center; align-items: center; box-shadow: 0 0 15px rgba(0,0,0,0.5); transition: 0.5s; }
    .donut-hole { width: 80px; height: 80px; background: var(--card); border-radius: 50%; display: flex; justify-content: center; align-items: center; text-align: center; color: #fff; font-weight: bold; font-size: 0.8rem; box-shadow: inset 0 0 10px rgba(0,0,0,0.5); flex-direction: column;}
    .legend { font-size: 0.75rem; display: flex; flex-direction: column; gap: 8px; }
    .legend-item { display: flex; align-items: center; gap: 5px; color: var(--text-dim); }
    .legend-color { width: 10px; height: 10px; border-radius: 50%; }

    .advisor-box { background: rgba(0, 255, 136, 0.05); border: 1px dashed var(--neon-green); padding: 15px; border-radius: 8px; margin-top: 20px; font-size: 0.75rem; color: var(--text-dim); text-align: left; transition: 0.3s; line-height: 1.4;}
    .advisor-box strong { color: var(--neon-cyan); display: block; margin-bottom: 8px; font-family: 'Courier New', monospace; font-size: 0.8rem; text-transform: uppercase; }
    .adv-crit { border-color: var(--neon-red); background: rgba(255, 68, 68, 0.05); color: #fff; }
    .adv-crit strong { color: var(--neon-red); animation: flash 1s infinite alternate; }
    .adv-warn { border-color: var(--neon-yellow); background: rgba(255, 213, 0, 0.05); color: #fff; }
    .adv-warn strong { color: var(--neon-yellow); }
    .adv-ok { border-color: var(--neon-green); color: var(--text-dim); }
    .adv-ok strong { color: var(--neon-green); }
    @keyframes flash { from { text-shadow: 0 0 0; } to { text-shadow: 0 0 10px var(--neon-red); } }

    .tactical-map { position: relative; padding-left: 20px; margin-top: 15px; border-left: 2px dashed var(--border); }
    .t-node { position: relative; margin-bottom: 25px; padding: 15px; border-radius: 8px; background: #000; border: 1px solid var(--border); transition: 0.3s; }
    .t-node::before { content: ''; position: absolute; left: -26px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--border); }
    .t-node.done { border-color: var(--neon-green); box-shadow: 0 0 10px rgba(0,255,136,0.1); }
    .t-node.done::before { background: var(--neon-green); border-color: var(--neon-green); box-shadow: 0 0 8px var(--neon-green); }
    .t-node.active { border-color: var(--neon-cyan); }
    .t-node.active::before { background: var(--neon-cyan); border-color: var(--neon-cyan); box-shadow: 0 0 8px var(--neon-cyan); }
    .t-node.locked { opacity: 0.5; }
    
    #ios-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 10000; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
    .modal-content { background: var(--card); padding: 20px; border-radius: 15px; border: 1px solid var(--neon-cyan); max-width: 300px; text-align: center; box-shadow: 0 0 20px rgba(0, 212, 255, 0.2); }
    .modal-content h3 { color: var(--neon-cyan); margin-top: 0; }
    .modal-content p { font-size: 0.85rem; color: var(--text-dim); text-align: left; }

    .ticker-wrap { width: 100%; background: #000; border-top: 1px solid var(--neon-green); position: fixed; bottom: 0; left: 0; height: 30px; display: flex; align-items: center; overflow: hidden; z-index: 9997; box-shadow: 0 -5px 15px rgba(0,255,136,0.1); }
    .ticker { display: inline-block; white-space: nowrap; font-family: 'Courier New', monospace; font-size: 0.75rem; color: var(--neon-green); animation: ticker 25s linear infinite; font-weight: bold;}
    @keyframes ticker { 0% { transform: translateX(100vw); } 100% { transform: translateX(-100%); } }
    @keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }
    
    th { position: sticky; top: 0; }
    #btn-fullscreen { display: none; background: transparent; color: var(--neon-cyan); border: 1px solid var(--neon-cyan); margin-top: 15px; font-size: 0.7rem; }

    /* ── LAYOUT ESCRITORIO (≥ 1024px) ─────────────────────────────────────── */
    /* Sidebar y desktop-layout ocultos en móvil */
    .desktop-layout { display: block; }
    #desktop-sidebar { display: none !important; }

    @media (min-width: 1024px) {
        #desktop-sidebar { display: flex !important; flex-direction: column; }

        body { padding-bottom: 0; overflow: hidden; }

        #main-app {
            max-width: 100%;
            width: 100%;
            padding: 0;
            margin: 0;
            height: 100vh;
            overflow: hidden;
        }

        .desktop-layout {
            display: flex !important;
            width: 100vw;
            height: 100vh;
            overflow: hidden;
        }

        /* ── SIDEBAR ── */
        .sidebar {
            width: 260px;
            min-width: 260px;
            background: var(--card);
            border-right: 1px solid var(--border);
            display: flex !important;
            flex-direction: column;
            height: 100vh;
            overflow-y: auto;
            padding: 16px 12px 12px;
            box-sizing: border-box;
            flex-shrink: 0;
        }

        .sidebar .app-logo {
            max-width: 80px;
            display: block;
            margin: 0 auto 10px;
        }

        .sidebar #reloj-sidebar {
            font-size: 0.62rem;
            color: var(--text-dim);
            text-align: center;
            margin-bottom: 4px;
            line-height: 1.4;
        }

        .sidebar #rango-sidebar {
            font-size: 0.6rem;
            text-align: center;
            margin-bottom: 12px;
            font-weight: bold;
            letter-spacing: 1px;
        }

        /* Nav vertical */
        .sidebar-nav {
            display: flex;
            flex-direction: column;
            gap: 3px;
            flex: 1;
            overflow-y: auto;
        }

        .sidebar-nav .tab-btn {
            display: block !important;
            text-align: left !important;
            padding: 9px 12px !important;
            border-radius: 8px !important;
            font-size: 0.78rem !important;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            width: 100%;
            box-sizing: border-box;
            border: 1px solid transparent;
            background: transparent;
            color: var(--text-dim);
            cursor: pointer;
            transition: all 0.15s;
        }

        .sidebar-nav .tab-btn:hover {
            background: rgba(255,255,255,0.05);
            color: #fff;
        }

        .sidebar-nav .tab-btn.active {
            background: rgba(0,229,255,0.12) !important;
            border-color: var(--neon-cyan) !important;
            color: #fff !important;
        }

        /* Ocultar tabs horizontales y header móvil */
        .tabs-container { display: none !important; }
        #app-header { display: none !important; }

        /* ── ÁREA DE CONTENIDO ── */
        .content-area {
            flex: 1;
            height: 100vh;
            overflow-y: auto;
            padding: 24px 32px 50px;
            box-sizing: border-box;
            min-width: 0;
        }

        /* Tab content en escritorio */
        .tab-content.active {
            display: block;
        }

        /* Cards más cómodas */
        .card { padding: 20px; }
        .card-title { font-size: 1rem; }

        /* Terminal más alta */
        .terminal-box { height: 200px; }

        /* Tablas con más espacio */
        .table-scroll { max-height: 400px; }

        /* Donut más grande */
        .donut-wrapper { width: 160px; height: 160px; }
        .donut-hole { width: 110px; height: 110px; font-size: 1rem; }

        /* Footer sidebar */
        .sidebar-footer {
            border-top: 1px solid var(--border);
            padding-top: 10px;
            margin-top: 8px;
        }
    }

    @media (min-width: 1400px) {
        .sidebar { width: 280px; min-width: 280px; }
        .content-area { padding: 28px 48px 50px; }
    }
