/* ============================================================================
   MetaReal · EstudioReal · css/app.css
   Fuentes locales (Poppins), sin recursos externos.
   Las variables --er-* son las compartidas con CostoReal; las variables
   antiguas (--primary, --text-main...) apuntan a ellas para no romper estilos.
   ============================================================================ */

@font-face { font-family: 'Poppins'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/poppins-700.woff2') format('woff2'); }

:root {
    --er-esmeralda: #10b981;
    --er-esmeralda-oscuro: #047857;
    --er-ambar: #F59E0B;
    --er-marino: #0F172A;
    --er-texto: #0f172a;
    --er-fondo: #f8fafc;
    --er-superficie: #ffffff;
    --er-borde: #e2e8f0;
    --er-suave: #475569;
    --er-peligro: #e11d48;
    --er-verde-suave: #ecfdf5;
    --er-rojo-suave: #fff1f2;
    --er-sobre-esmeralda: #04281c;

    --primary: var(--er-esmeralda);
    --primary-hover: #059669;
    --text-main: var(--er-texto);
    --text-muted: var(--er-suave);
    --bg-main: var(--er-fondo);
    --bg-card: var(--er-superficie);
    --real-red: var(--er-peligro);
    --red-hover: #be123c;
    --border-soft: var(--er-borde);
    --bg-green-soft: var(--er-verde-suave);
    --bg-red-soft: var(--er-rojo-suave);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-input: 0 2px 4px rgba(0, 0, 0, 0.02);
    --font-main: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    color-scheme: light;
}

:root[data-tema="oscuro"] {
    --er-esmeralda-oscuro: #34d399;
    --er-marino: #e2e8f0;
    --er-texto: #e5e7eb;
    --er-fondo: #0f172a;
    --er-superficie: #1e293b;
    --er-borde: #334155;
    --er-suave: #b6c0cf;
    --er-peligro: #fb7185;
    --er-verde-suave: #0b3b2e;
    --er-rojo-suave: #4c1d2b;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}


* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.6;
    padding: 24px;
    min-height: 100vh;
}

.app-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    display: flex; 
    flex-direction: column; 
    gap: 24px; 
}

/* --- INICIO: ENCABEZADO (HEADER) --- */
.app-header {
    background-color: var(--bg-card);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    display: flex; 
    flex-direction: column; 
    gap: 8px;
}

.header-main-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 16px; 
}

.text-logo { 
    font-size: 26px; 
    font-weight: 700; 
    color: var(--text-main); 
}

.text-logo span { 
    color: var(--primary); 
}

.badge {
    background-color: var(--bg-green-soft);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 11px; 
    padding: 4px 10px; 
    border-radius: 6px; 
    font-weight: 700;
}

.header-subtitle { 
    font-size: 14px; 
    color: var(--text-muted); 
    font-weight: 500; 
}

/* --- INICIO: CLASES DE UTILIDAD --- */
.text-primary { color: var(--primary); }
.text-green { color: var(--primary); }
.text-red { color: var(--real-red) !important; }
.hidden { display: none !important; }

/* --- INICIO: BOTONES --- */
.submit-btn {
    background-color: var(--primary);
    color: #ffffff; 
    border: none; 
    font-size: 14px; 
    font-weight: 600;
    padding: 14px; 
    border-radius: 12px; 
    width: 100%; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
    transition: background-color 0.2s ease; 
    font-family: var(--font-main);
}

.submit-btn:hover { 
    background-color: var(--primary-hover); 
}

.submit-btn:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
}

.action-btn-outline {
    background-color: transparent; 
    border: 1.5px solid var(--border-soft);
    color: var(--text-main); 
    font-size: 13px; 
    font-weight: 600;
    padding: 10px 18px; 
    border-radius: 10px; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
    transition: all 0.2s ease; 
    font-family: var(--font-main);
}

.action-btn-outline:hover { 
    background-color: var(--bg-main); 
    border-color: var(--text-muted); 
}

/* --- INICIO: TARJETAS Y CONTENEDORES --- */
.card {
    background-color: var(--bg-card); 
    border: 1px solid var(--border-soft);
    border-radius: 24px; 
    padding: 24px; 
    box-shadow: var(--shadow-card);
}

.card-header { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 20px; 
    border-bottom: 1px solid var(--border-soft); 
    padding-bottom: 12px; 
}

.card-header h2 { 
    font-size: 18px; 
    font-weight: 600; 
    color: var(--text-main); 
}

/* --- INICIO: FORMULARIOS --- */
.form-group { 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    margin-bottom: 16px; 
}

.form-group-row { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 12px; 
}

label { 
    font-size: 13px; 
    color: var(--text-muted); 
    font-weight: 500; 
}

input {
    background-color: var(--bg-main); 
    border: 1.5px solid var(--border-soft);
    border-radius: 12px; 
    color: var(--text-main); 
    padding: 12px 16px;
    font-size: 14px; 
    font-family: var(--font-main); 
    transition: all 0.2s ease; 
    box-shadow: var(--shadow-input);
}

input:focus { 
    outline: none; 
    border-color: var(--primary); 
    background-color: #ffffff; 
}

/* =====================================================================
   INICIO DE MODIFICACIÓN: Solución a campos numéricos (Eliminar flechas y arreglar cursor) 
======================================================================== */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield; /* Para Firefox */
    cursor: text; /* Corrige el problema del cursor al pasar el mouse por encima */
}
/* =====================================================================
   FIN DE MODIFICACIÓN 
======================================================================== */

/* --- INICIO: AVISO DE PRIVACIDAD --- */
.privacy-notice {
    background: var(--bg-green-soft); 
    padding: 14px; 
    border-radius: 12px;
    border: 1px solid var(--primary); 
    color: #065f46; 
    font-size: 0.9rem;
    display: flex; 
    gap: 12px; 
    align-items: center; 
    margin-bottom: 24px; 
    line-height: 1.5;
}

.privacy-icon { 
    font-size: 1.5rem; 
}

/* --- INICIO: DIAGNÓSTICO FINANCIERO Y RESULTADOS --- */
.subsection-title {
    font-size: 14px; 
    font-weight: 600; 
    color: var(--text-main);
    margin-top: 16px; 
    margin-bottom: 12px; 
    border-bottom: 1px dashed var(--border-soft); 
    padding-bottom: 4px;
}

.field-note { 
    font-size: 0.8rem; 
    color: var(--text-muted); 
    margin-top: -10px; 
    margin-bottom: 15px; 
}

.expenses-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 12px; 
}

@media(max-width: 600px) { 
    .expenses-grid { 
        grid-template-columns: 1fr; 
    } 
}

.savings-result-box {
    background: var(--bg-green-soft); 
    border: 1.5px solid var(--primary);
    border-radius: 16px; 
    padding: 18px; 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    margin-top: 16px;
}

.savings-result-box.zero-or-negative { 
    background: var(--bg-red-soft); 
    border-color: var(--real-red); 
}

.savings-result-label { 
    font-size: 11px; 
    font-weight: 600; 
    color: var(--text-muted); 
    text-transform: uppercase; 
}

.savings-result-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 8px; 
}

.savings-result-value { 
    font-size: 24px; 
    font-weight: 700; 
    color: var(--primary); 
}

.savings-result-box.zero-or-negative .savings-result-value { 
    color: var(--real-red); 
}

.savings-result-status {
    font-size: 11px; 
    font-weight: 600; 
    padding: 4px 8px; 
    border-radius: 6px;
    background-color: rgba(16, 185, 129, 0.15); 
    color: var(--primary);
}

.savings-result-box.zero-or-negative .savings-result-status { 
    background-color: rgba(244, 63, 94, 0.15); 
    color: var(--real-red); 
}

/* --- INICIO: NAVEGACIÓN SPA --- */
.screen { 
    opacity: 0; 
    transform: translateY(12px); 
    animation: screenReveal 0.4s forwards; 
    width: 100%; 
    max-width: 680px; 
    margin: 0 auto; 
}

#screen-goals { 
    max-width: 900px; 
}

@keyframes screenReveal { 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}

.welcome-card { 
    text-align: center; 
    padding: 40px 32px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 32px; 
}

.welcome-card h1 { 
    font-size: 26px; 
    font-weight: 700; 
    color: var(--text-main); 
}

.admin-quote-box {
    background-color: var(--bg-main);
    border-left: 3px solid var(--primary);
    padding: 16px 20px;
    margin: 28px auto;
    max-width: 520px;
    text-align: left;
    border-radius: 0 12px 12px 0;
}

.quote-text {
    font-style: italic;
    color: var(--text-main);
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.quote-author {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.welcome-divider { 
    width: 60px; 
    height: 3px; 
    background-color: var(--primary); 
    border-radius: 2px; 
    margin: 8px auto 0 auto; 
}

.welcome-actions { 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
    width: 100%; 
    max-width: 320px; 
}

/* --- INICIO: ALERTAS Y CONTROLES (TOGGLES) --- */
.toggle-group { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    background: var(--bg-main); 
    border: 1.5px solid var(--border-soft); 
    border-radius: 12px; 
    padding: 4px; 
    margin-bottom: 16px; 
}

.toggle-btn { 
    background: none; 
    border: none; 
    color: var(--text-muted); 
    padding: 10px; 
    font-size: 12px; 
    font-weight: 600; 
    border-radius: 8px; 
    cursor: pointer; 
}

.toggle-btn.active { 
    background-color: var(--primary); 
    color: #ffffff; 
}

.warning-alert-box { 
    background: var(--bg-red-soft); 
    border: 1px solid var(--real-red); 
    border-radius: 12px; 
    padding: 14px; 
    display: flex; 
    gap: 12px; 
    color: var(--real-red); 
    font-size: 13px; 
    font-weight: 500; 
    margin-bottom: 16px; 
}

.preview-box { 
    background: var(--bg-green-soft); 
    border: 1px solid rgba(16, 185, 129, 0.3); 
    border-radius: 12px; 
    padding: 14px; 
    display: flex; 
    gap: 12px; 
    color: #065f46; 
    font-size: 13px; 
    font-weight: 500; 
    margin-bottom: 16px; 
}

/* --- INICIO: DASHBOARD Y METAS --- */
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
    gap: 16px; 
}

.stat-card { 
    background: var(--bg-card); 
    border: 1px solid var(--border-soft); 
    border-radius: 20px; 
    padding: 24px; 
    box-shadow: var(--shadow-card); 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    min-height: 110px; 
}

.stat-label { 
    font-size: 11px; 
    font-weight: 700; 
    color: var(--text-muted); 
    text-transform: uppercase; 
}

.stat-value { 
    font-size: 28px; 
    font-weight: 700; 
    color: var(--text-main); 
}

.chart-container-card { 
    flex-direction: row; 
    justify-content: space-between; 
    align-items: center; 
}

.donut-chart-wrapper { 
    width: 68px; 
    height: 68px; 
}

.donut-chart { 
    width: 100%; 
    height: 100%; 
    transform: rotate(-90deg); 
}

.donut-number { 
    font-size: 9px; 
    font-weight: 600; 
    fill: var(--text-main); 
    text-anchor: middle; 
    transform: rotate(90deg); 
    transform-origin: 18px 18px; 
}

.balance-card { 
    border-left: 5px solid var(--primary) !important; 
    margin-top: 48px !important; 
    margin-bottom: 40px !important; 
}

.balance-subgrid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
    gap: 16px; 
    margin-bottom: 16px; 
}

.balance-item { 
    background: var(--bg-main); 
    padding: 14px; 
    border-radius: 10px; 
    border: 1px solid var(--border-soft); 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
}

.balance-item.result { 
    background: var(--bg-green-soft); 
    border-color: rgba(16, 185, 129, 0.2); 
    grid-column: 1 / -1; 
}

.balance-advice { 
    font-size: 13px; 
    color: var(--text-muted); 
    background: var(--bg-main); 
    padding: 10px 14px; 
    border-radius: 8px; 
    border-left: 3px solid var(--primary); 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

/* --- INICIO: ELEMENTOS DE METAS INDIVIDUALES --- */
.goal-item { 
    background: var(--bg-card); 
    border: 1px solid var(--border-soft); 
    border-radius: 20px; 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 14px; 
    box-shadow: var(--shadow-card); 
}

.goal-item-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
}

.goal-item-title { 
    font-size: 16px; 
    font-weight: 600; 
    color: var(--text-main); 
}

.progress-bar-container { 
    background: var(--bg-main); 
    height: 10px; 
    border-radius: 5px; 
    overflow: hidden; 
    width: 100%; 
    margin: 8px 0; 
}

.progress-bar-fill { 
    height: 100%; 
    background: var(--primary); 
    width: 0%; 
    transition: width 0.4s ease; 
}

.progress-labels-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 12px; 
}

.progress-text { 
    font-size: 12px; 
    font-weight: 600; 
    color: var(--primary); 
}

.contribution-mini-form { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
}

.mini-input { 
    padding: 6px 12px; 
    font-size: 12px; 
    width: 90px; 
}

.mini-btn { 
    background: transparent; 
    border: 1.5px solid var(--primary); 
    color: var(--primary); 
    font-size: 11px; 
    font-weight: 600; 
    padding: 6px 12px; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.2s; 
}

.mini-btn:hover { 
    background: var(--primary); 
    color: #fff; 
}

.section-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 16px; 
}

.goals-empty-state { 
    text-align: center; 
    padding: 48px; 
    background: var(--bg-main); 
    border: 2px dashed var(--border-soft); 
}

.goals-view-navigation, 
.navigation-actions { 
    display: flex; 
    gap: 16px; 
    margin-top: 24px; 
}

.navigation-actions button, 
.goals-view-navigation button { 
    flex: 1; 
    justify-content: center; 
    padding: 14px 20px; 
}

/* --- INICIO: MODALES --- */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh; 
    background: rgba(15, 23, 42, 0.6); 
    backdrop-filter: blur(4px); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 1000; 
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.2s; 
}

.modal-overlay:not(.hidden) { 
    opacity: 1; 
    pointer-events: auto; 
}

.modal-card { 
    background: var(--bg-card); 
    width: 90%; 
    max-width: 440px; 
    border-radius: 16px; 
    padding: 28px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); 
    transform: translateY(20px); 
    transition: transform 0.2s; 
}

.modal-overlay:not(.hidden) .modal-card { 
    transform: translateY(0); 
}

.modal-header { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 16px; 
    font-size: 18px; 
    font-weight: 600; 
}

.modal-actions { 
    display: flex; 
    gap: 12px; 
    margin-top: 24px; 
}

.modal-actions button { 
    flex: 1; 
}

.modal-highlight-amount { 
    font-weight: 600; 
    color: var(--primary); 
    background: var(--bg-green-soft); 
    padding: 2px 8px; 
    border-radius: 4px; 
    border: 1px solid rgba(16, 185, 129, 0.2); 
}

/* --- INICIO: PIE DE PÁGINA GLOBALES --- */
.app-footer { 
    text-align: center; 
    font-size: 12px; 
    color: var(--text-muted); 
    border-top: 1px solid var(--border-soft); 
    padding-top: 20px; 
    margin-top: 24px; 
}

.footer-line-1 { 
    font-weight: 600; 
    color: var(--text-main); 
    font-size: 14px; 
    margin-bottom: 4px; 
}

/* --- INICIO: HISTORIAL DE ABONOS --- */
.history-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    text-decoration: underline;
    font-family: var(--font-main);
    transition: color 0.2s;
}

.history-toggle-btn:hover {
    color: var(--primary);
}

.history-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-soft);
    display: none;
}

.history-container.show {
    display: block; 
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 160px;
    overflow-y: auto;
    padding-right: 4px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    background: var(--bg-main);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
}

.history-date {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-amount {
    font-weight: 600;
    color: var(--primary);
}

/* --- INICIO: MEDIA QUERIES (DISEÑO ESCRITORIO) --- */
@media (min-width: 768px) {
    .container, 
    .card, 
    .screen-content {
        max-width: 1100px !important;
        margin: 0 auto;
    }
    
    .grid-layout {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
        align-items: end;
    }

    .create-goal-layout {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 30px;
    }

    #goals-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        gap: 24px;
    }
}

/* --- INICIO: MEJORAS VISUALES --- */
.welcome-card {
    background: linear-gradient(135deg, #ffffff 0%, var(--bg-green-soft) 100%);
    border: 2px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.08);
}

.welcome-card h1 {
    font-size: 34px !important;
    background: linear-gradient(45deg, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent; 
    margin-bottom: 15px;
}

.welcome-quote {
    font-size: 16px !important;
    color: #334155;
    font-weight: 500;
}

#goals-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 32px; 
    margin-top: 20px;
    margin-bottom: 40px; 
}

/* --- INICIO: PIE DE PÁGINA (PREMIUM) --- */
.global-footer {
    background: linear-gradient(135deg, #0f172a 0%, #064e3b 100%);
    color: #94a3b8; 
    padding: 40px 20px;
    margin-top: 60px;
    border-radius: 24px 24px 0 0;
    text-align: center;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.1);
    border-top: 1px solid rgba(52, 211, 153, 0.3);
}

.footer-logo {
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
}

.footer-logo span { 
    color: var(--primary); 
}

.footer-contact {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.footer-contact p {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
    font-size: 16px; 
}

.footer-links {
    margin-bottom: 24px;
    font-size: 16px;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #34d399; 
    text-decoration: underline;
}

.footer-separator {
    margin: 0 12px;
    color: #334155;
}

.footer-slogan {
    font-size: 14px; 
    font-weight: 500; 
    color: #cbd5e1; 
    border-top: 1px solid rgba(255, 255, 255, 0.1); 
    padding-top: 20px;
    max-width: 500px; 
    margin: 0 auto;
}

/* --- INICIO: BANNER PREMIUM (ASESORÍA SAT) --- */
.sat-banner {
    background: linear-gradient(135deg, #0f172a 0%, #064e3b 100%);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 32px auto 20px auto;
    width: 100%;
    box-shadow: 0 10px 25px rgba(6, 78, 59, 0.2);
    color: #ffffff;
    flex-wrap: wrap;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.sat-banner-icon {
    background: rgba(255, 255, 255, 0.1);
    padding: 14px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #34d399; 
}

.sat-banner-text {
    flex: 1;
    min-width: 260px;
}

.sat-banner-text h4 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #34d399;
}

.sat-banner-text p {
    font-size: 13.5px;
    color: #cbd5e1;
    line-height: 1.5;
}

.sat-btn {
    background-color: #34d399;
    color: #064e3b;
    font-weight: 700;
    padding: 14px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.sat-btn:hover {
    background-color: #10b981;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* --- INICIO: GUARDIA DE SEGURIDAD (T&C MODAL) --- */
.guard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85); 
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999; 
    padding: 20px;
}

.guard-overlay.hidden {
    display: none !important;
}

.guard-card {
    background: var(--bg-card);
    border-radius: 24px;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: modalPopUp 0.4s ease-out forwards;
}

@keyframes modalPopUp {
    from { 
        opacity: 0; 
        transform: scale(0.95) translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

.guard-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-green-soft);
}

.guard-header h2 {
    font-size: 20px;
    color: var(--text-main);
}

.guard-body {
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto; 
}

.guard-instruction {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.legal-text-container {
    background: var(--bg-main);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 20px;
    max-height: 250px;
    overflow-y: auto;
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.6;
}

.legal-text-container h3 {
    font-size: 14px;
    margin-top: 16px;
    margin-bottom: 8px;
    color: var(--primary);
}

.legal-text-container h3:first-child {
    margin-top: 0;
}

.legal-text-container p {
    margin-bottom: 12px;
    color: var(--text-muted);
}

.guard-acceptance {
    background: var(--bg-main);
    padding: 16px;
    border-radius: 12px;
    border: 1.5px solid var(--border-soft);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
}

.checkbox-container input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.guard-footer {
    padding: 24px 32px;
    border-top: 1px solid var(--border-soft);
    background: var(--bg-main);
}

.guard-footer .submit-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- NOTIFICACIONES TOAST (COPIAR CORREO) --- */
.toast-notification {
    position: fixed;
    bottom: -60px; /* Inicia oculto fuera de la pantalla */
    left: 50%;
    transform: translateX(-50%);
    background-color: #1a1a1a; /* Un tono oscuro y elegante */
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 10px;
    /* La magia de la animación está aquí */
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); 
}

.toast-notification.show {
    bottom: 40px; /* Sube a la vista del usuario */
    opacity: 1;
}

/* Ícono de check opcional dentro del toast */
.toast-icon {
    background-color: #4CAF50; /* Verde de éxito */
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
}

/* ============================================================================
   AJUSTES EstudioReal: contraste, tema oscuro, accesibilidad y componentes nuevos
   ============================================================================ */
[hidden] { display: none !important; }

/* Contraste: texto oscuro sobre esmeralda, texto verde oscuro sobre fondos claros */
.submit-btn, .submit-btn:hover, .sat-btn, .sat-btn:hover, .toggle-btn.active { color: var(--er-sobre-esmeralda) !important; }
.submit-btn:disabled { color: var(--er-suave) !important; }
.text-primary, .text-green, .badge, .goal-item-title + .badge { color: var(--er-esmeralda-oscuro); }
.text-red { color: var(--er-peligro); }
.privacy-notice, .preview-box, .warning-alert-box, .welcome-quote, .footer-separator { color: var(--er-texto); }
input, select, textarea { background-color: var(--er-superficie); color: var(--er-texto); }
input:focus, select:focus { background-color: var(--er-superficie); }
:root[data-tema="oscuro"] .welcome-card { background: linear-gradient(135deg, #1e293b 0%, #0b3b2e 100%); }
:root[data-tema="oscuro"] .donut-ring { stroke: #334155; }

/* Accesibilidad: botones de 44 px mínimo y foco visible */
button, .submit-btn, .action-btn-outline, .toggle-btn, .history-toggle-btn, .sat-btn, select, input { min-height: 44px; }
input[type="checkbox"] { min-height: 0; }
:focus-visible { outline: 3px solid var(--er-ambar); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 20000; padding: 12px 18px; border-radius: 8px; background: var(--er-marino); color: var(--er-superficie); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }
label { font-weight: 500; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Íconos locales (sprite SVG) */
.icono { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; flex: none; }

/* Barra superior y tema */
.barra-herramientas { display: flex; justify-content: flex-end; }
.btn-tema { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--er-borde); border-radius: 22px; background: var(--er-superficie); color: var(--er-texto); font: inherit; font-size: 0.9rem; cursor: pointer; }
.header-logo img { height: 48px; width: auto; max-width: 180px; display: block; }

/* Mensajes fijos */
.privacidad-fija { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-left: 4px solid var(--er-esmeralda); border-radius: 8px; background: var(--er-verde-suave); color: var(--er-texto); font-size: 0.9rem; }
.deslinde { padding: 12px 14px; border: 1px dashed var(--er-borde); border-radius: 8px; color: var(--er-suave); font-size: 0.85rem; }

/* Metas: acciones y detalle */
.goal-item-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.goal-item-actions .acciones-der { display: flex; flex-wrap: wrap; gap: 8px; }
.goal-item .meta-monto { font-size: 20px; font-weight: 700; color: var(--er-esmeralda-oscuro); }
.goal-item .meta-de { font-size: 12px; color: var(--er-suave); }
.goal-item .meta-sugerido { font-size: 12px; color: var(--er-suave); }
.goal-item.completada { border-color: var(--er-esmeralda); }
.btn-peligro { border-color: var(--er-peligro) !important; color: var(--er-peligro) !important; }
.goal-movimientos { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--er-borde); border-radius: 10px; background: var(--er-fondo); font-size: 0.85rem; }
.goal-movimientos ul { margin: 0; padding: 0; list-style: none; }
.goal-movimientos li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--er-borde); }
.goal-movimientos li:last-child { border-bottom: 0; }
.campo-monto { width: 100%; }
.modal-card .campo-monto { margin-top: 10px; }
.modal-error { margin-top: 8px; color: var(--er-peligro); font-size: 0.85rem; }

/* Respaldo */
.respaldo-panel { padding: 20px; border: 1px solid var(--er-borde); border-radius: 16px; background: var(--er-superficie); }
.respaldo-panel h3 { margin-bottom: 8px; font-size: 1.05rem; color: var(--er-marino); }
.respaldo-panel p { margin-bottom: 12px; font-size: 0.9rem; }
.respaldo-acciones { display: flex; flex-wrap: wrap; gap: 10px; }
.aviso-cache { padding: 12px 14px; border-left: 4px solid var(--er-ambar); border-radius: 8px; background: var(--er-fondo); font-size: 0.88rem; }

/* Premium para clientes */
.premium-panel { padding: 24px; border: 2px solid var(--er-esmeralda); border-radius: 16px; background: var(--er-superficie); text-align: center; }
.premium-panel h3 { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; font-size: 1.1rem; color: var(--er-marino); }
.premium-panel p { margin-bottom: 14px; font-size: 0.95rem; }
.premium-acciones { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.btn-premium-wa, .btn-premium-enlace { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 22px; border-radius: 10px; font-weight: 600; font-size: 0.95rem; text-decoration: none; }
.btn-premium-wa { border: 2px solid var(--er-esmeralda); background: var(--er-esmeralda); color: var(--er-sobre-esmeralda); }
.btn-premium-enlace { border: 2px solid var(--er-marino); background: transparent; color: var(--er-marino); }

/* Pie unificado */
.global-footer a { text-underline-offset: 3px; }
.global-footer .footer-links a, .global-footer .footer-contact a { display: inline-block; padding: 8px 6px; }
.enlace-cruzado { margin-top: 10px; font-size: 0.85rem; }
.enlace-cruzado a { color: #34d399; font-weight: 600; }

/* Aviso de actualización */
.aviso-actualizacion { position: fixed; left: 50%; bottom: 20px; z-index: 10001; display: none; align-items: center; gap: 10px; max-width: calc(100% - 24px); padding: 10px 14px; transform: translateX(-50%); border-radius: 12px; background: #0f172a; color: #ffffff; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); font-size: 0.9rem; }
.aviso-actualizacion.visible { display: flex; }
.aviso-actualizacion button { padding: 8px 16px; border: none; border-radius: 8px; background: var(--er-esmeralda); color: var(--er-sobre-esmeralda); font-weight: 700; cursor: pointer; }

/* --- INSTALAR APP (Android: evento del navegador; iPhone: guía) --- */
.barra-superior, .barra-herramientas { gap: 10px; flex-wrap: wrap; }
.btn-instalar { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 2px solid var(--er-esmeralda); border-radius: 22px; background: var(--er-esmeralda); color: var(--er-sobre-esmeralda); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.guia-instalar { margin: 0 0 12px; padding-left: 22px; }
.guia-instalar li { margin-bottom: 10px; }
.guia-instalar .icono { width: 1.4em; height: 1.4em; }

/* ============================================================================
   AJUSTES RESPONSIVOS (celular y tableta): nada debe ensanchar la página
   ============================================================================ */
html { -webkit-text-size-adjust: 100%; }
.app-container, .app-main, .screen, .card, .form-side, .tip-side, .create-goal-layout > *, .form-group, .form-group-row > * { min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }
.form-group-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.create-goal-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
#goals-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px; }
.sat-banner-text { min-width: min(100%, 220px); }
.goal-item-header { flex-wrap: wrap; gap: 8px; }
.goal-item-title { min-width: 0; overflow-wrap: anywhere; }
.badge { max-width: 100%; }
.navigation-actions, .goals-view-navigation { flex-wrap: wrap; }
.toggle-btn { font-size: 13px; line-height: 1.25; }
.form-group label, .section-label { font-size: 14px; }

@media (min-width: 768px) {
    .create-goal-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 30px; }
    #goals-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 24px; }
}
@media (max-width: 600px) {
    body { padding: 12px; }
    .app-container { gap: 16px; }
    .app-header, .card { padding: 18px; border-radius: 18px; }
    .form-group-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .navigation-actions, .goals-view-navigation { flex-direction: column-reverse; gap: 10px; }
    .navigation-actions button, .goals-view-navigation button { width: 100%; flex: none; }
    .welcome-card h1 { font-size: 26px !important; }
    .sat-banner { padding: 18px; }
    .sat-btn { width: 100%; justify-content: center; }
}

/* Recuadro "Una referencia útil" */
.tip-box { padding: 16px 18px; border: 1px solid var(--er-borde); border-left: 4px solid var(--er-esmeralda); border-radius: 14px; background: var(--er-verde-suave); color: var(--er-texto); font-size: 0.9rem; }
.tip-box-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; color: var(--er-marino); }
.tip-box p { margin-bottom: 8px; }
.tip-box p:last-child { margin-bottom: 0; }

/* Pie de página ordenado */
.global-footer { max-width: 1200px; margin: 32px auto 0; padding: 32px 20px; border-radius: 24px; }
.global-footer a { color: #34d399; }
.global-footer .footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 20px; }
.global-footer .footer-separator { display: none; }
.global-footer .footer-contact { flex-direction: column; align-items: center; gap: 2px; margin-bottom: 20px; }
.global-footer .footer-contact p { display: block; text-align: center; font-size: 15px; line-height: 1.7; }
.global-footer .footer-contact a { font-weight: 600; text-decoration: underline; overflow-wrap: anywhere; }
.global-footer .footer-horario { margin-top: 4px; font-size: 14px; color: #94a3b8; }
.global-footer .enlace-cruzado a { display: inline; padding: 0; text-decoration: underline; }

/* Detalles finales de celular */
.section-header { flex-wrap: wrap; gap: 12px; }
.chart-container-card .stat-info { display: flex; flex-direction: column; gap: 4px; }
.screen-instructions { margin-bottom: 16px; }
h1:focus, h2:focus, h3:focus, [tabindex="-1"]:focus { outline: none; }   /* el foco que se mueve solo al cambiar de pantalla no necesita recuadro */
@media (max-width: 600px) { .sort-container { width: 100%; } .sort-select { width: 100%; } }
select, input, button, textarea { font-family: inherit; }
.section-title { display: flex; align-items: center; gap: 10px; }
