:root { --primary: #2563eb; --bg: #f1f5f9; --panel: #ffffff; --text: #1e293b; --border: #e2e8f0; --footer-bg: #0f172a; --footer-text: #f8fafc; }
        * { box-sizing: border-box; margin: 0; padding: 0; }
        body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(--bg); color: var(--text); overflow-x: hidden; transition: background-color 0.3s, color 0.3s; }

        .card, .sidebar, .site-header, input, select, textarea, details { transition: background-color 0.3s, border-color 0.3s, color 0.3s, box-shadow 0.3s; }

        /* --- MODO OSCURO (DARK MODE) --- */
        body.dark-mode { color-scheme: dark; --bg: #0f172a; --panel: #1e293b; --text: #f8fafc; --border: #334155; --footer-bg: #020617; }
        body.dark-mode .section-title, body.dark-mode .logo-area h1, body.dark-mode .results-section h2 { color: var(--text); }
        body.dark-mode select.select-top { background-color: #0f172a; color: #f8fafc; border-color: #334155; }
        body.dark-mode select.select-top option { background-color: #0f172a; color: #f8fafc; }
        body.dark-mode input, body.dark-mode textarea { background-color: #0f172a; color: var(--text); border-color: #334155; }
        body.dark-mode .input-locked { background-color: #334155 !important; border-color: #475569 !important; color: #94a3b8; }
        body.dark-mode .dynamic-row { background: #0f172a; }
        body.dark-mode .stat-box { background: #0f172a; border-color: #334155; }
        body.dark-mode .seo-article h2, body.dark-mode .seo-article h3 { color: var(--text); }
        body.dark-mode details { background: #0f172a; border-color: #334155; }
        body.dark-mode details summary { color: var(--text); }
        body.dark-mode details:hover { background: #1e293b; border-color: #475569; }
        body.dark-mode details p { color: #cbd5e1; border-color: var(--border); }
        body.dark-mode .disclaimer { background: #0f172a; border-color: #475569; color: #94a3b8; }
        body.dark-mode .checkbox-container { background: #1e1b4b; border-color: #3730a3; }
        body.dark-mode .checkbox-container span { color: #a5b4fc; }
        body.dark-mode .form-group label, body.dark-mode .row-header, body.dark-mode p { color: #94a3b8; }
        body.dark-mode .info-icon { background-color: #475569; }
        body.dark-mode .info-icon:hover { background-color: var(--primary); }
        body.dark-mode #advancedPanelYellow, body.dark-mode #advancedPanelRed { background: #022c22; border-color: #065f46; }
        body.dark-mode #estrategiaRetiro { background: #0f172a !important; color: #4ade80 !important; border-color: #059669 !important; }

        .btn-theme { background: transparent; border: none; font-size: 1.3rem; cursor: pointer; padding: 5px 10px; border-radius: 20px; transition: background 0.3s; display: flex; align-items: center; justify-content: center; }
        .btn-theme:hover { background: var(--border); }

        /* --- NUEVA CABECERA (NAVBAR) --- */
        .site-header { background: var(--panel); box-shadow: 0 1px 4px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100; margin-bottom: 30px; }
        .header-content { display: flex; align-items: center; max-width: 1400px; margin: 0 auto; padding: 15px 20px; position: relative; }
        .logo-area { display: flex; align-items: center; gap: 12px; position: absolute; left: 50%; transform: translateX(-50%); }
        .logo-icon { font-size: 2rem; }
        .logo-area h1 { color: #0f172a; font-size: 1.4rem; font-weight: 800; margin: 0; letter-spacing: -0.5px; }
        .controls-top { display: flex; gap: 12px; margin-left: auto; z-index: 10; align-items: center; }
        .select-top { padding: 8px 15px; border-radius: 20px; border: 1px solid #cbd5e1; font-size: 0.9rem; background-color: #f8fafc; color: #475569; cursor: pointer; font-weight: 600; outline: none; transition: all 0.2s ease; }
        .select-top:hover, .select-top:focus { border-color: var(--primary); color: var(--primary); }
        /* ------------------------------- */

        .calculator-wrapper { display: flex; gap: 20px; max-width: 1400px; margin: 0 auto; align-items: stretch; padding: 0 20px; }
        .sidebar { width: 380px; flex-shrink: 0; background: var(--panel); padding: 20px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
        .main-content { flex: 1; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
        .card { background: var(--panel); padding: 20px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
        .chart-card { min-height: 450px; display: flex; flex-direction: column; }
        #chart-container { flex: 1; position: relative; width: 100%; min-height: 400px; }

        .section-title { font-size: 1.1rem; font-weight: bold; margin-bottom: 10px; margin-top: 20px; padding-bottom: 5px; border-bottom: 2px solid var(--border); color: #0f172a; }
        .section-title:first-child { margin-top: 0; }

        /* ICONO DE AYUDA TOOLTIP */
        .info-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background-color: #cbd5e1; color: #fff; font-size: 0.75rem; font-weight: bold; cursor: help; margin-left: 8px; transition: 0.2s; font-family: sans-serif; }
        .info-icon:hover { background-color: var(--primary); }

        .grid-3-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 15px; }
        .grid-2-col { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 15px; }
        .form-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 4px; color: #475569; }
        input[type="number"], input[type="text"], input[type="email"], textarea { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; background: var(--bg); font-family: inherit; }
        input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); background: var(--panel); }
        textarea { resize: vertical; }
        .input-locked { background-color: #e2e8f0 !important; color: #64748b; cursor: not-allowed; border-color: #cbd5e1 !important; }

        .row-header { display: grid; grid-template-columns: 1fr 1fr 1.2fr 30px; gap: 8px; font-size: 0.8rem; font-weight: bold; color: #475569; margin-bottom: 5px; padding: 0 5px; }
        .row-header-stress { grid-template-columns: 1fr 1fr 30px; }
        .dynamic-row { display: grid; gap: 8px; align-items: center; background: var(--bg); padding: 8px; border-radius: 6px; margin-bottom: 8px; }
        .cf-row { grid-template-columns: 1fr 1fr 1.2fr 30px; }
        .se-row { grid-template-columns: 1fr 1fr 30px; }
        .btn-small { padding: 6px; font-size: 0.85rem; cursor: pointer; border: none; border-radius: 4px; font-weight: bold; }
        .btn-remove { background: #ef4444; color: white; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
        .btn-remove:hover { background: #dc2626; }
        .btn-add { background: #10b981; color: white; width: 100%; padding: 10px; margin-bottom: 10px; margin-top: 5px;}
        .btn-add:hover { background: #059669; }

        .btn-run { width: 100%; padding: 15px; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 1.1rem; font-weight: bold; cursor: pointer; margin-top: 20px; transition: background 0.2s; }
        .btn-run:hover { background: #1d4ed8; }
        .btn-run:disabled { background: #94a3b8; cursor: not-allowed; }

        .checkbox-container { display: flex; align-items: center; gap: 8px; background: #e0e7ff; padding: 10px; border-radius: 6px; margin-bottom: 15px; border: 1px solid #c7d2fe; cursor: pointer; }
        .checkbox-container:hover { border-color: var(--primary); }
        .checkbox-container input { width: 18px; height: 18px; cursor: pointer; }
        .checkbox-container span { font-size: 0.85rem; font-weight: 600; color: #3730a3; }

        /* Paneles Avanzados */
        #advancedPanelYellow, #advancedPanelRed { display: none; background: #f0fdf4; border: 1px solid #bbf7d0; padding: 15px; border-radius: 8px; margin-bottom: 15px; animation: fadeIn 0.3s ease-in-out;}
        @keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

        .results-section h2 { font-size: 1.2rem; margin-bottom: 12px; color: #0f172a; }
        .results-wrapper { display: flex; gap: 20px; }
        .results-block { flex: 1; }
        .results-grid { display: grid; gap: 12px; text-align: center; }
        .grid-2 { grid-template-columns: repeat(2, 1fr); }
        .grid-3 { grid-template-columns: repeat(3, 1fr); }
        .stat-box { padding: 15px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
        .stat-box h3 { margin: 0 0 5px 0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
        .stat-box p { margin: 0; font-size: 1.3rem; font-weight: bold; }
        .stat-box small { font-size: 0.75rem; color: #64748b; }
        .red { color: #ef4444; } .yellow { color: #f59e0b; } .green { color: #10b981; }
        .blue { color: #3b82f6; } .purple { color: #a855f7; }
        .alert { background: #fee2e2; color: #991b1b; padding: 12px; border-radius: 6px; display: none; margin-top: 15px; font-size: 0.9rem; font-weight: bold; text-align: center; }

        .seo-wrapper { padding: 0 20px; }
        .seo-article { max-width: 1000px; margin: 40px auto; background: var(--panel); padding: 40px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); line-height: 1.7; color: #334155; }
        .seo-article h2 { color: #0f172a; margin-bottom: 15px; margin-top: 35px; font-size: 1.6rem; border-bottom: 2px solid var(--border); padding-bottom: 8px;}
        .seo-article h2:first-child { margin-top: 0; }
        .seo-article h3 { color: #1e293b; margin-top: 25px; margin-bottom: 10px; font-size: 1.2rem; }
        .seo-article p { margin-bottom: 15px; }

        .faq-container { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
        details { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 15px; cursor: pointer; transition: all 0.3s ease; }
        summary { font-weight: 700; color: #0f172a; font-size: 1.05rem; outline: none; list-style: none; display: flex; justify-content: space-between; align-items: center; }
        summary::-webkit-details-marker { display: none; }
        summary::after { content: "▼"; font-size: 0.8em; color: var(--primary); transition: transform 0.3s; }
        details[open] summary::after { transform: rotate(180deg); }
        details p { margin-top: 12px; margin-bottom: 0; color: #475569; font-size: 0.95rem; border-top: 1px solid var(--border); padding-top: 12px; }

        .disclaimer { background: var(--bg); border-left: 4px solid #94a3b8; padding: 15px; font-size: 0.85rem; color: #64748b; margin-top: 40px; }

        .site-footer { background-color: var(--footer-bg); color: var(--footer-text); padding: 50px 20px 20px 20px; margin-top: 40px; }
        .footer-content { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; }
        .footer-content h2 { font-size: 1.8rem; margin-bottom: 10px; color: #fff; }
        .footer-content p { color: #94a3b8; margin-bottom: 25px; font-size: 1rem; }

        .contact-form { width: 100%; max-width: 500px; background: #1e293b; padding: 25px; border-radius: 12px; text-align: left; }
        .contact-form .form-group label { color: #cbd5e1; }
        .contact-form input, .contact-form textarea { background: #0f172a; border-color: #334155; color: #fff; margin-bottom: 15px; }
        .contact-form input:focus, .contact-form textarea:focus { border-color: var(--primary); background: #0f172a; }
        .contact-form .btn-run { margin-top: 5px; }

        .hidden-bot-field { display: none; }
        .copyright { margin-top: 40px; color: #64748b; font-size: 0.85rem; }

        @media (max-width: 900px) {
            .header-content { flex-direction: column; gap: 15px; text-align: center; }
            .logo-area { position: relative; left: auto; transform: none; justify-content: center; }
            .controls-top { margin-left: 0; justify-content: center; }
            .calculator-wrapper { flex-direction: column; }
            .sidebar { width: 100%; }
            .results-wrapper { flex-direction: column; }
            .seo-article { padding: 25px; }
        }