/* ═══════════════════════════════════════════════════════════════
   Variables
═══════════════════════════════════════════════════════════════ */
:root {
    --brand-primary: #2563EB;
    --brand-dark:    #1D4ED8;
    --brand-light:   #EFF6FF;
    --success:       #059669;
    --surface:       #FFFFFF;
    --surface-2:     #F8FAFC;
    --border:        #E2E8F0;
    --text-primary:  #0F172A;
    --text-muted:    #64748B;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:     0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.05);
    --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
}

/* ═══════════════════════════════════════════════════════════════
   Reset & Base
═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    background: var(--surface-2);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   Header
═══════════════════════════════════════════════════════════════ */
.app-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #1E40AF 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

.app-logo {
    background: rgba(255,255,255,.15);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.app-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: #fff;
}

.app-subtitle {
    font-size: .8rem;
    color: rgba(255,255,255,.75);
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════
   Cards
═══════════════════════════════════════════════════════════════ */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
    overflow: hidden;
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .9rem 1.25rem;
    font-weight: 600;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text-primary);
}

.card-header-icon {
    background: var(--brand-light);
    color: var(--brand-primary);
    border-radius: var(--radius-sm);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-body { padding: 1.25rem; }

/* ═══════════════════════════════════════════════════════════════
   Formulario
═══════════════════════════════════════════════════════════════ */
.form-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: .9rem;
    margin-bottom: .375rem;
}

.form-control {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    font-size: .9rem;
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    outline: none;
}

.form-range { cursor: pointer; }

/* ═══════════════════════════════════════════════════════════════
   Botón Generar
═══════════════════════════════════════════════════════════════ */
.btn-generar {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-dark));
    border: none;
    border-radius: var(--radius-sm);
    padding: .625rem 1.25rem;
    font-weight: 600;
    font-size: .9rem;
    letter-spacing: .01em;
    transition: transform .12s, box-shadow .12s, opacity .12s;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

.btn-generar:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37,99,235,.45);
}

.btn-generar:active:not(:disabled) {
    transform: translateY(0);
}

.btn-generar:disabled {
    opacity: .7;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════
   Barra de progreso
═══════════════════════════════════════════════════════════════ */
.progress-lg {
    height: 12px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.progress-lg .progress-bar {
    background: linear-gradient(90deg, var(--brand-primary), #60A5FA);
    border-radius: 999px;
    transition: width .4s ease;
}

/* Pasos del proceso */
.pasos-lista {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    max-height: 160px;
    overflow-y: auto;
}

.paso-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    color: var(--text-muted);
    padding: .25rem .5rem;
    border-radius: var(--radius-sm);
    animation: fadeSlideIn .25s ease;
}

.paso-item.paso-activo {
    background: var(--brand-light);
    color: var(--brand-primary);
    font-weight: 500;
}

.paso-item.paso-listo {
    color: var(--success);
}

.paso-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════════
   Panel resultado
═══════════════════════════════════════════════════════════════ */
.resultado-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(5,150,105,.2);
}

.btn-descarga {
    background: linear-gradient(135deg, var(--success), #047857);
    border: none;
    border-radius: var(--radius-sm);
    padding: .625rem 1.5rem;
    font-weight: 600;
    font-size: .9rem;
    display: inline-flex;
    align-items: center;
    color: #fff;
    transition: transform .12s, box-shadow .12s;
    box-shadow: 0 4px 12px rgba(5,150,105,.3);
}

.btn-descarga:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(5,150,105,.4);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   Historial tabla
═══════════════════════════════════════════════════════════════ */
.card-historial .table thead th {
    background: var(--surface-2);
    border-bottom: 2px solid var(--border);
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .625rem 1rem;
}

.card-historial .table tbody td {
    padding: .625rem 1rem;
    font-size: .9rem;
    vertical-align: middle;
    border-color: var(--border);
}

.card-historial .table tbody tr:hover td {
    background: var(--brand-light);
}

/* ═══════════════════════════════════════════════════════════════
   Tabla de cobertura de datos (Estado Ingesta)
═══════════════════════════════════════════════════════════════ */
.table-ingesta thead th {
    background: var(--surface-2);
    border-bottom: 2px solid var(--border);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .5rem 1rem;
}

.table-ingesta tbody td {
    padding: .4rem 1rem;
    font-size: .9rem;
    vertical-align: middle;
    border-color: var(--border);
}

.divisa-chip {
    background: var(--brand-light);
    color: var(--brand-primary);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: monospace;
    letter-spacing: .04em;
}

/* Badges de fecha con semáforo */
.badge-fecha {
    display: inline-block;
    border-radius: 6px;
    padding: 2px 10px;
    font-size: 1rem;
    font-weight: 600;
}

.badge-fecha-ok   { background: #D1FAE5; color: #065F46; }
.badge-fecha-warn { background: #FEF3C7; color: #92400E; }
.badge-fecha-old  { background: #FEE2E2; color: #991B1B; }

/* Alerta de cobertura bajo el campo FechaFin */
.alerta-cobertura {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
    border-radius: var(--radius-sm);
    padding: .4rem .625rem;
    font-size: .8rem;
    line-height: 1.4;
}

.alerta-cobertura svg { margin-top: 1px; }

/* ═══════════════════════════════════════════════════════════════
   Footer
═══════════════════════════════════════════════════════════════ */
.app-footer {
    border-top: 1px solid var(--border);
    padding: .75rem 0;
    margin-top: 2rem;
}

/* ═══════════════════════════════════════════════════════════════
   Página de Ayuda
   ═══════════════════════════════════════════════════════════════ */

.ayuda-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: start;
    max-width: 1200px;
    margin: 0 auto;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.ayuda-sidebar {
    position: sticky;
    top: 1.5rem;
}
.ayuda-toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}
.ayuda-toc-titulo {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-secondary);
    margin-bottom: .75rem;
}
.ayuda-toc nav { display: flex; flex-direction: column; gap: .15rem; }
.ayuda-toc-item,
.ayuda-toc-sub {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .6rem;
    border-radius: 6px;
    font-size: .82rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background .15s, color .15s;
    cursor: pointer;
}
.ayuda-toc-item:hover,
.ayuda-toc-sub:hover { background: var(--hover-bg); color: var(--text-primary); }
.ayuda-toc-item.active,
.ayuda-toc-sub.active {
    background: #4f46e515;
    color: #818cf8;
    font-weight: 600;
}
.ayuda-toc-sub {
    padding-left: 1.9rem;
    font-size: .78rem;
}

/* ── Hero ────────────────────────────────────────────────────── */
.ayuda-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: linear-gradient(135deg, #4f46e515 0%, #7c3aed10 100%);
    border: 1px solid #4f46e530;
    border-radius: 16px;
    padding: 1.75rem 2rem;
    margin-bottom: 2rem;
}
.ayuda-hero-icon {
    width: 60px; height: 60px;
    background: #4f46e520;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: #818cf8;
    flex-shrink: 0;
}
.ayuda-hero-titulo {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 .25rem;
}
.ayuda-hero-sub {
    color: var(--text-secondary);
    font-size: .92rem;
    margin: 0;
}

/* ── Secciones ───────────────────────────────────────────────── */
.ayuda-seccion {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    scroll-margin-top: 1rem;
}
.ayuda-seccion-sub {
    border-left: 3px solid #4f46e540;
    margin-left: 1rem;
}
.ayuda-seccion-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}
.ayuda-seccion-titulo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.ayuda-intro {
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 1.25rem;
}
.ayuda-subtitulo {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-secondary);
    margin: 1.25rem 0 .75rem;
}

/* ── Badges de módulo ────────────────────────────────────────── */
.ayuda-modulo-badge {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .25rem .65rem;
    border-radius: 20px;
    flex-shrink: 0;
}
.ayuda-modulo-badge.reporte     { background: #4f46e520; color: #818cf8; border: 1px solid #4f46e540; }
.ayuda-modulo-badge.estadisticas{ background: #0ea5e920; color: #38bdf8; border: 1px solid #0ea5e940; }
.ayuda-modulo-badge.e1          { background: #8b5cf620; color: #a78bfa; border: 1px solid #8b5cf640; }
.ayuda-modulo-badge.e2          { background: #f59e0b20; color: #fbbf24; border: 1px solid #f59e0b40; }
.ayuda-modulo-badge.heatmap     { background: #10b98120; color: #34d399; border: 1px solid #10b98140; }
.ayuda-modulo-badge.optimizador { background: #f97316 20; color: #fb923c; border: 1px solid #f9731640; }
.ayuda-modulo-badge.semanal     { background: #64748b20; color: #94a3b8; border: 1px solid #64748b40; }
.ayuda-modulo-badge.capital     { background: #22c55e20; color: #4ade80; border: 1px solid #22c55e40; }
.ayuda-modulo-badge.montecarlo  { background: #ec489920; color: #f472b6; border: 1px solid #ec489940; }
.ayuda-modulo-badge.grafico     { background: #06b6d420; color: #22d3ee; border: 1px solid #06b6d440; }
.ayuda-modulo-badge.inventario  { background: #84cc1620; color: #a3e635; border: 1px solid #84cc1640; }

/* ── Parámetros ──────────────────────────────────────────────── */
.ayuda-params { display: flex; flex-direction: column; gap: .6rem; }
.ayuda-param {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: .75rem;
    padding: .65rem .85rem;
    background: #ffffff05;
    border: 1px solid var(--border);
    border-radius: 8px;
    align-items: start;
}
.ayuda-param-nombre {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary);
}
.ayuda-param-desc {
    font-size: .82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Cards R1/R2/R3 ──────────────────────────────────────────── */
.ayuda-cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: .75rem 0;
}
.ayuda-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.ayuda-card-tag {
    padding: .4rem .85rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
}
.ayuda-card-tag.r1 { background: #4f46e530; color: #818cf8; }
.ayuda-card-tag.r2 { background: #f59e0b30; color: #fbbf24; }
.ayuda-card-tag.r3 { background: #10b98130; color: #34d399; }
.ayuda-card-body {
    padding: .85rem;
    font-size: .82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.ayuda-card-body strong { color: var(--text-primary); }
.ayuda-card-body p { margin: .35rem 0 0; }

/* ── Info boxes ──────────────────────────────────────────────── */
.ayuda-info-box {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .85rem 1rem;
    background: #0ea5e910;
    border: 1px solid #0ea5e930;
    border-radius: 8px;
    font-size: .82rem;
    /*color: #7dd3fc;*/
    margin-top: 1rem;
    line-height: 1.5;
}
.ayuda-info-box svg { flex-shrink: 0; margin-top: 1px; color: #38bdf8; }
.ayuda-info-box.warning { background: #f59e0b10; border-color: #f59e0b30; /*color: #fcd34d;*/ }
.ayuda-info-box.warning svg { color: #fbbf24; }
.ayuda-info-box.success { background: #10b98110; border-color: #10b98130;/* color: #6ee7b7;*/ }
.ayuda-info-box.success svg { color: #34d399; }

/* ── Z-score visual ──────────────────────────────────────────── */
.ayuda-zscore-visual {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .85rem;
    margin: .75rem 0;
}
.ayuda-zscore-item {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    text-align: center;
}
.ayuda-zscore-item.put   { background: #ef444415; border-color: #ef444430; }
.ayuda-zscore-item.neutro{ background: #64748b15; border-color: #64748b30; }
.ayuda-zscore-item.call  { background: #22c55e15; border-color: #22c55e30; }
.ayuda-zscore-valor {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: monospace;
}
.ayuda-zscore-item.put   .ayuda-zscore-valor { color: #f87171; }
.ayuda-zscore-item.neutro .ayuda-zscore-valor{ color: #94a3b8; }
.ayuda-zscore-item.call  .ayuda-zscore-valor { color: #4ade80; }
.ayuda-zscore-label { font-size: .8rem; color: var(--text-secondary); }
.ayuda-zscore-item small { font-size: .72rem; color: var(--text-secondary); opacity: .8; }

/* ── Niveles E1 ──────────────────────────────────────────────── */
.ayuda-niveles { display: flex; flex-direction: column; gap: .5rem; }
.ayuda-nivel {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .65rem .85rem;
    background: #ffffff05;
    border-radius: 8px;
    font-size: .82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.ayuda-nivel-tag {
    flex-shrink: 0;
    font-size: .72rem;
    font-weight: 700;
    background: #8b5cf620;
    color: #a78bfa;
    border: 1px solid #8b5cf640;
    border-radius: 20px;
    padding: .2rem .6rem;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .ayuda-layout           { grid-template-columns: 1fr; }
    .ayuda-sidebar          { position: static; }
    .ayuda-cards-row        { grid-template-columns: 1fr; }
    .ayuda-zscore-visual    { grid-template-columns: 1fr; }
    .ayuda-param            { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   Panel de Backtesting
═══════════════════════════════════════════════════════════════ */
.btn-backtest {
    background: linear-gradient(135deg, #7C3AED, #6D28D9);
    border: none;
    border-radius: var(--radius-sm);
    padding: .5rem 1.25rem;
    font-weight: 600;
    font-size: .9rem;
    display: inline-flex;
    align-items: center;
    color: #fff;
    transition: transform .12s, box-shadow .12s;
    box-shadow: 0 4px 12px rgba(124,58,237,.3);
}

.btn-backtest:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(124,58,237,.4);
    color: #fff;
}

.btn-backtest:disabled { opacity: .65; cursor: not-allowed; }

.btn-detalle {
    background: linear-gradient(135deg, #0F172A, #1E293B);
    border: none;
    border-radius: var(--radius-sm);
    padding: .45rem 1.1rem;
    font-weight: 600;
    font-size: .8125rem;
    display: inline-flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    transition: transform .12s, box-shadow .12s;
    box-shadow: 0 3px 8px rgba(15,23,42,.25);
}
.btn-detalle:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(15,23,42,.35); color: #fff; }

/* Card resultado backtest */
#panelBacktest .card-header .card-header-icon {
    background: #EDE9FE;
    color: #7C3AED;
}

.backtest-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.backtest-stat {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    text-align: center;
}

.backtest-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.backtest-stat-value.win  { color: #059669; }
.backtest-stat-value.loss { color: #DC2626; }
.backtest-stat-value.rate { color: #7C3AED; }

.backtest-stat-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: .25rem;
}

/* Distribución por nivel de gale */
.gale-dist { display: flex; gap: .375rem; flex-wrap: wrap; }

.gale-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 1rem;
    font-weight: 600;
    background: #EDE9FE;
    color: #5B21B6;
}

/* ═══════════════════════════════════════════════════════════════
   Utilitarios
═══════════════════════════════════════════════════════════════ */
.text-sm { font-size: .9rem; }

.card-historial .table tbody td .badge {
    font-size: 1rem;
    padding: .35em .65em;
}

/* ═══════════════════════════════════════════════════════════════
   Página Detalle Backtesting
═══════════════════════════════════════════════════════════════ */
.btn-volver {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: .3rem .65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: background .12s, color .12s;
}
.btn-volver:hover { background: var(--brand-light); color: var(--brand-primary); }

/* Header resumen */
.detalle-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.detalle-win-rate {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    min-width: 90px;
}
.detalle-win-rate .wr-label {
    display: block;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .8;
    margin-top: .15rem;
}
.wr-ok   { color: #059669; }
.wr-warn { color: #7C3AED; }
.wr-bad  { color: #DC2626; }

.detalle-stats-row {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.detalle-stat { text-align: center; min-width: 60px; }
.detalle-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}
.detalle-stat-value.win   { color: #059669; }
.detalle-stat-value.loss  { color: #DC2626; }
.detalle-stat-value.muted { color: var(--text-muted); }
.detalle-stat-label {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin-top: .2rem;
}

/* Chart containers */
.chart-container { position: relative; min-height: 220px; }

/* Filtros */
.detalle-filtros {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* Tabla de secuencias */
.table-secuencias thead th {
    background: var(--surface-2);
    border-bottom: 2px solid var(--border);
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .5rem 1rem;
}
.table-secuencias tbody td {
    padding: .4rem 1rem;
    font-size: 1.2rem;
    vertical-align: middle;
    border-color: var(--border);
}

/* Badges resultado */
.hora-inicio {
    display: inline-block;
    margin-left: .4rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brand-primary);
    background: var(--brand-light);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: monospace;
}

.res-badge {
    display: inline-block;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.res-win  { background: #D1FAE5; color: #065F46; }
.res-loss { background: #FEE2E2; color: #991B1B; }
.res-inc  { background: #FEF3C7; color: #92400E; }

.btn-outline-purple {
    color: #7C3AED;
    border-color: #7C3AED;
    background: transparent;
    font-size: .9rem;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.btn-outline-purple:hover:not(:disabled) {
    background: #EDE9FE;
    color: #6D28D9;
    border-color: #6D28D9;
}

.btn-outline-purple:disabled { opacity: .6; cursor: not-allowed; }


code {
    font-size: 1.5rem !important
}

/* ═══════════════════════════════════════════════════════════════
   Nav menu
═══════════════════════════════════════════════════════════════ */
.app-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.app-nav-list {
    display: flex;
    flex-wrap: wrap;        /* segunda línea en pantallas pequeñas */
    gap: .25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 640px) {
    .app-nav-list {
        gap: 0;
    }
    .app-nav-link {
        padding: .45rem .6rem;
        font-size: .78rem;
        gap: .25rem;
    }
    .app-nav-link svg {
        width: 13px;
        height: 13px;
    }
}

.app-nav-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .6rem 1rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s, background .15s;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.app-nav-link:hover {
    color: var(--brand-primary);
    background: var(--brand-light);
}

.app-nav-link.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   Estadísticas — layout
═══════════════════════════════════════════════════════════════ */
.est-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.est-header-left { flex: 1 1 auto; }

.est-filtro {
    flex: 0 0 260px;
}

.est-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.est-stat {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .75rem 1.25rem;
    text-align: center;
    min-width: 90px;
    flex: 1 1 auto;
}

.est-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.est-stat-value.win  { color: #059669; }
.est-stat-value.loss { color: #DC2626; }
.est-stat-value.wr-ok   { color: #059669; }
.est-stat-value.wr-warn { color: #D97706; }
.est-stat-value.wr-bad  { color: #DC2626; }

.est-stat-label {
    font-size: .72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: .2rem;
}

/* ═══════════════════════════════════════════════════════════════
   Estadísticas — Heatmap table
═══════════════════════════════════════════════════════════════ */
.heatmap-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.heatmap-table {
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0;
}

.heatmap-th-divisa {
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 2;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .5rem .75rem;
    border-bottom: 2px solid var(--border);
    min-width: 80px;
}

.heatmap-th-hora {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    padding: .4rem .35rem;
    border-bottom: 2px solid var(--border);
    min-width: 42px;
}

.heatmap-td-divisa {
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 1;
    padding: .35rem .6rem;
    border-bottom: 1px solid var(--border);
}

.divisa-chip {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    background: var(--brand-light);
    color: var(--brand-primary);
    border-radius: 4px;
    padding: .15rem .45rem;
    white-space: nowrap;
}

.heatmap-td {
    text-align: center;
    font-size: .78rem;
    font-weight: 600;
    padding: .3rem .25rem;
    border-bottom: 1px solid rgba(0,0,0,.04);
    cursor: default;
    transition: opacity .15s;
}

.heatmap-td:hover { opacity: .82; }

.heatmap-td-vacio {
    background: #F1F5F9;
    color: #94A3B8;
}

/* Leyenda */
.heatmap-leyenda {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}

.leyenda-chip {
    font-size: .68rem;
    font-weight: 600;
    border-radius: 4px;
    padding: .15rem .5rem;
}

/* Chart container */
.chart-container {
    position: relative;
    height: 380px;
}

/* ═══════════════════════════════════════════════════════════════
   Evolución de la Estrategia
═══════════════════════════════════════════════════════════════ */
.evol-chart-container {
    position: relative;
    height: 320px;
}

.evol-tabla-scroll {
    overflow-y: auto;
    max-height: 320px;
}

.evol-tabla thead th {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-2);
    position: sticky;
    top: 0;
    z-index: 1;
    padding: .45rem .75rem;
    border-bottom: 2px solid var(--border);
}

.evol-tabla tbody td {
    font-size: .8rem;
    padding: .35rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════
   Optimizador de Hora de Inicio
═══════════════════════════════════════════════════════════════ */
.opt-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.opt-header-left { flex: 1 1 auto; }

.opt-controles {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}

.opt-control-group {
    display: flex;
    flex-direction: column;
}

/* Tarjeta "mejor hora" */
.opt-mejor-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border: 1px solid #BFDBFE;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
}

.opt-mejor-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    background: var(--brand-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.opt-mejor-titulo {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: .2rem;
}

.opt-mejor-valor {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: .5rem;
}

.opt-mejor-wr {
    font-size: 1.1rem;
    font-weight: 700;
}

.opt-mejor-detalle {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .3rem;
}

/* Tabla */
.opt-tabla-scroll {
    overflow-y: auto;
    max-height: 360px;
}

.opt-tabla thead th {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-2);
    position: sticky;
    top: 0;
    z-index: 1;
    padding: .5rem .75rem;
}

.opt-tabla tbody td {
    font-size: .82rem;
    padding: .4rem .75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.opt-fila-mejor td { background: #EFF6FF; }
.opt-fila-sin-datos { opacity: .45; }

.opt-estrella {
    color: #F59E0B;
    font-size: .75rem;
}

.opt-wr-badge {
    display: inline-block;
    font-size: .75rem;
    font-weight: 700;
    border-radius: 4px;
    padding: .15rem .5rem;
}

.opt-wr-badge.wr-ok   { background: #D1FAE5; color: #065F46; }
.opt-wr-badge.wr-warn { background: #FEF3C7; color: #92400E; }
.opt-wr-badge.wr-bad  { background: #FEE2E2; color: #991B1B; }

/* ═══════════════════════════════════════════════════════════════
   Gestión de Capital
═══════════════════════════════════════════════════════════════ */
.gc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.gc-filtro { flex: 0 0 280px; }

/* Stats row */
.gc-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.gc-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .75rem 1.25rem;
    text-align: center;
    flex: 1 1 auto;
    min-width: 100px;
    box-shadow: var(--shadow-sm);
}
.gc-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}
.gc-stat-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: .2rem;
}

/* Calculadora */
.gc-calc-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.gc-input-group { display: flex; flex-direction: column; gap: .3rem; }
.gc-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
}
.gc-label-val {
    font-size: .9rem;
    font-weight: 700;
    color: var(--brand-primary);
}
.gc-range-bounds {
    display: flex;
    justify-content: space-between;
    font-size: .68rem;
    color: var(--text-muted);
}

/* Fila de parámetros base */
.gc-params-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.gc-param-item {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    min-width: 130px;
}
.gc-param-item .form-control { max-width: 110px; }

/* Progresión de gales */
.gc-gales-header {
    display: flex;
    align-items: center;
    margin-bottom: .5rem;
}
/* Contenedor de sets (progresión automática) */
.gc-gales-auto-row {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.gc-set-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
}
.gc-gales-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    flex: 1;
}
.gc-set-badge {
    font-size: .62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: var(--brand-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: .2rem .55rem;
    min-width: 42px;
    text-align: center;
    flex-shrink: 0;
}
.gc-set-badge-rec {
    background: #7C3AED;
}
.gc-set-cost {
    font-size: .7rem;
    flex-shrink: 0;
}
.gc-gale-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .3rem .55rem;
    min-width: 52px;
}
.gc-gale-chip-rec {
    background: #F5F3FF;
    border-color: #C4B5FD;
}
.gc-gale-chip-label {
    font-size: .65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.gc-gale-chip-val {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Grid de gales manuales */
.gc-gales-manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .6rem;
}
.gc-gale-manual-item {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.gc-gale-manual-label {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
}
/* Grupos manuales por set */
.gc-set-manual-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .65rem .75rem;
    margin-bottom: .5rem;
}
.gc-set-manual-group-rec {
    border-color: #C4B5FD;
    background: #F5F3FF;
}
.gc-set-manual-header {
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--brand-primary);
    margin-bottom: .55rem;
}
.gc-set-manual-header-rec {
    color: #7C3AED;
}

.gc-resultado-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.gc-resultado {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .9rem 1rem;
    text-align: center;
}
.gc-resultado-valor {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}
.gc-resultado-label {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin-top: .25rem;
}
.gc-resultado-sub {
    font-size: .65rem;
    color: var(--text-muted);
    margin-top: .2rem;
}

/* Alertas */
.gc-alerta {
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    font-size: .82rem;
    font-weight: 500;
}
.gc-alerta-danger { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.gc-alerta-warn   { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.gc-alerta-ok     { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }

/* Distribución de gale */
.gc-gale-lista { display: flex; flex-direction: column; gap: .5rem; padding: .25rem 0; }
.gc-gale-fila  {
    display: grid;
    grid-template-columns: 52px 1fr 44px 40px;
    align-items: center;
    gap: .5rem;
    font-size: .8rem;
}
.gc-gale-label { font-weight: 600; }
.gc-gale-barra-wrap {
    background: #F1F5F9;
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}
.gc-gale-barra {
    height: 100%;
    border-radius: 4px;
    transition: width .4s ease;
    min-width: 2px;
}
.gc-gale-pct { font-weight: 700; text-align: right; }
.gc-gale-cnt { font-size: .72rem; }

/* ═══════════════════════════════════════════════════════════════
   Análisis Semanal Histórico
═══════════════════════════════════════════════════════════════ */
.sem-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.sem-header-left { flex: 1 1 auto; }

.sem-controles {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}
.sem-control-group {
    display: flex;
    flex-direction: column;
}

/* Resumen */
.sem-resumen {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.sem-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .75rem 1.25rem;
    text-align: center;
    min-width: 100px;
    flex: 1 1 auto;
    box-shadow: var(--shadow-sm);
}
.sem-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}
.sem-stat-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: .2rem;
}

/* Gráfico */
.sem-chart-container {
    position: relative;
    height: 360px;
}

/* Tabla */
.sem-tabla-scroll {
    overflow-y: auto;
    max-height: 360px;
}
.sem-tabla thead th {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-2);
    position: sticky;
    top: 0;
    z-index: 1;
    padding: .45rem .75rem;
    border-bottom: 2px solid var(--border);
}
.sem-tabla tbody td {
    font-size: .8rem;
    padding: .35rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.sem-fila-sin-datos { opacity: .4; }

.sem-wr-badge {
    display: inline-block;
    font-size: .73rem;
    font-weight: 700;
    border-radius: 4px;
    padding: .15rem .45rem;
}
.sem-wr-badge.wr-ok   { background: #D1FAE5; color: #065F46; }
.sem-wr-badge.wr-warn { background: #FEF3C7; color: #92400E; }
.sem-wr-badge.wr-bad  { background: #FEE2E2; color: #991B1B; }
/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════════════════ */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 100%);
}
.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
}
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: .75rem;
    color: var(--primary);
}
.login-title {
    text-align: center;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: .25rem;
}
.login-subtitle {
    text-align: center;
    font-size: .85rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    display: block;
}

/* ═══════════════════════════════════════════════════════════════
   Filtro multi-reporte (checkbox dropdown)
═══════════════════════════════════════════════════════════════ */
.rf-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}
.rf-btn {
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    padding: .25rem .5rem;
    font-size: .875rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    white-space: nowrap;
    overflow: hidden;
}
.rf-btn:hover { border-color: #adb5bd; }
.rf-btn .rf-arrow {
    flex-shrink: 0;
    transition: transform .15s ease;
}
.rf-btn.open .rf-arrow { transform: rotate(180deg); }
.rf-panel {
    display: none;
    position: fixed;        /* fixed evita recorte por overflow de cualquier ancestro */
    min-width: 240px;
    max-width: 360px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    z-index: 1055;
    padding: .5rem 0;
    max-height: 320px;
    overflow-y: auto;
}
.rf-panel.open { display: block; }
.rf-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .75rem;
    font-size: .85rem;
    cursor: pointer;
    user-select: none;
    color: var(--text-primary);
    transition: background .1s;
}
.rf-item:hover { background: #F1F5F9; }
.rf-item input[type="checkbox"] {
    flex-shrink: 0;
    accent-color: var(--brand-primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.rf-item-todos {
    font-weight: 600;
    border-bottom: 1px solid #F1F5F9;
    margin-bottom: .25rem;
    padding-bottom: .5rem;
}
.rf-badge {
    display: inline-block;
    background: var(--brand-primary);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    border-radius: 999px;
    padding: .05rem .4rem;
    margin-left: .25rem;
}

/* ═══════════════════════════════════════════════════════════════
   Tab Análisis — Estrategias
═══════════════════════════════════════════════════════════════ */
.analisis-pares-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .75rem;
}
.analisis-params-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.analisis-resultado-tabla thead th {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .5rem .75rem;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.analisis-resultado-tabla tbody td {
    padding: .45rem .75rem;
    vertical-align: middle;
    font-size: .875rem;
    border-bottom: 1px solid var(--border);
}
.analisis-resultado-tabla tbody tr:last-child td {
    border-bottom: none;
}
.analisis-resumen-badge {
    font-size: .78rem;
    color: var(--text-muted);
    padding: .35rem .75rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}


/* ── Tabs Estrategia E1/E2 ─────────────────────────────────────────────── */
.nav-tabs-estrategia {
    border-bottom: 2px solid var(--border);
    gap: .25rem;
}
.nav-tabs-estrategia .nav-link {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: .55rem 1.25rem;
    font-size: .9rem;
    font-weight: 500;
    transition: color .15s, background .15s;
}
.nav-tabs-estrategia .nav-link:hover {
    color: var(--text-primary);
    background: var(--surface-2);
    border-color: var(--border);
}
.nav-tabs-estrategia .nav-link.active {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border) var(--border) var(--surface-2);
    border-bottom-color: var(--surface-2);
}

/* ── Leyenda E2 ─────────────────────────────────────────────────────────── */
.alert-e2 {
    background: linear-gradient(135deg, #1a1f2e 0%, #161b22 100%);
    border: 1px solid #f0b42933;
    border-left: 3px solid #f0b429;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
}
.alert-e2-icon {
    color: #f0b429;
    margin-top: .1rem;
}
.alert-e2-titulo {
    font-size: .95rem;
    font-weight: 600;
    color: #f0b429;
    margin-bottom: .4rem;
    letter-spacing: .01em;
}
.alert-e2-texto {
    font-size: .85rem;
    color: #adbac7;
    line-height: 1.55;
}
.alert-e2-texto strong { color: #e6edf3; }
.alert-e2-texto em     { color: #f0b429; font-style: normal; font-weight: 500; }
.alert-e2-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    color: #8b949e;
    background: #ffffff0d;
    border: 1px solid #30363d;
    border-radius: 20px;
    padding: .2rem .65rem;
}
.alert-e2-pill svg { flex-shrink: 0; color: #f0b42999; }

/* ── Config recomendada E2 ──────────────────────────────────────────────── */
.config-recomendada {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    padding: .5rem .65rem;
    background: #f0b42912;
    border: 1px dashed #f0b42955;
    border-radius: 8px;
}
.config-rec-titulo {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #f0b429;
    margin-right: .2rem;
}
.config-rec-item {
    font-size: .73rem;
    color: #8b949e;
    background: #ffffff0d;
    border: 1px solid #30363d;
    border-radius: 20px;
    padding: .15rem .55rem;
}

/* ── Sesiones de Mercado Forex ──────────────────────────────────────────── */
.sesiones-card  { background:#161b22 !important; border-color:#30363d !important; }
.sesiones-header {
    background: #0d1117 !important;
    border-color: #30363d !important;
    display: flex;
    align-items: center;
    gap: .45rem;
    color: #c9d1d9;
}
.sesiones-reloj {
    font-size: .95rem;
    font-weight: 700;
    color: #e6edf3;
    font-variant-numeric: tabular-nums;
}
.sesiones-gmt {
    font-size: .68rem;
    color: #8b949e;
}

.ses-mercado {
    padding: .55rem .7rem;
    border-radius: 8px;
    border: 1px solid #30363d;
    background: #0d1117;
    margin-bottom: .3rem;
}
.ses-abierto { border-color: #238636 !important; }
.ses-cerrado { opacity: .65; }

.ses-mercado-top {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .35rem;
}
.ses-bandera  { font-size: 1rem; }
.ses-nombre   { font-size: .82rem; font-weight: 600; color: #e6edf3; flex: 1; }
.ses-estado   { font-size: .62rem; font-weight: 700; letter-spacing: .05em; padding: .15rem .45rem; border-radius: 20px; }
.estado-open  { background: #23863620; color: #3fb950; border: 1px solid #23863640; }
.estado-closed{ background: #8b949e15; color: #8b949e; border: 1px solid #30363d; }
.ses-tiempo   { font-size: .72rem; color: #8b949e; white-space: nowrap; }

.ses-barra-wrap  { display: flex; align-items: center; gap: .5rem; }
.ses-barra-track { flex: 1; height: 4px; background: #30363d; border-radius: 4px; overflow: hidden; }
.ses-barra-fill  { height: 100%; border-radius: 4px; transition: width .6s ease; }
.ses-horario     { font-size: .65rem; color: #8b949e; white-space: nowrap; font-variant-numeric: tabular-nums; }

.ses-solap { margin: .1rem 0; }
.ses-solap-inner {
    border: 1px solid;
    border-radius: 8px;
    padding: .55rem .75rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.ses-solap-tag   { font-size: .68rem; font-weight: 700; padding: .1rem .45rem; border-radius: 20px; width: fit-content; }
.ses-solap-label { font-size: .82rem; font-weight: 600; color: #e6edf3; }
.ses-solap-nota  { font-size: .72rem; color: #8b949e; }

.ses-pares-box   { border-top: 1px solid #30363d; padding-top: .6rem; margin-top: .1rem; }
.ses-pares-titulo{ font-size: .72rem; color: #8b949e; margin-bottom: .4rem; }
.ses-pares-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .4rem; }
.ses-par-chip {
    font-size: .72rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 20px;
    background: #21262d;
    color: #8b949e;
    border: 1px solid #30363d;
}
.ses-par-destacado {
    background: #f0b42920;
    color: #f0b429;
    border-color: #f0b42940;
}
.ses-pares-hint  { font-size: .68rem; color: #484f58; }
.ses-pares-vacio { font-size: .78rem; color: #8b949e; text-align: center; padding: .75rem 0; }

/* ── Selector de pares E2 ───────────────────────────────────────────────── */
.e2-pares-lista {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    max-height: 130px;
    overflow-y: auto;
    padding: .5rem .6rem;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
}
.e2-par-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .78rem;
    font-weight: 500;
    color: #e6edf3;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: .18rem .5rem;
    cursor: pointer;
    user-select: none;
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}
.e2-par-chip:hover {
    background: #1f2937;
    border-color: #f0b42966;
}
.e2-par-chip input[type=checkbox] {
    accent-color: #f0b429;
    width: 13px;
    height: 13px;
    cursor: pointer;
    flex-shrink: 0;
}
.e2-par-chip:has(input:checked) {
    background: #1a1f2e;
    border-color: #f0b42966;
    color: #f0e68c;
}

/* ── Señales activas E2 ─────────────────────────────────────────────────── */
.table-row-senal {
    background: #f0b42908 !important;
    border-left: 3px solid #f0b429;
}
.table-row-senal td:first-child {
    padding-left: calc(.75rem - 3px);
}

/* ── Tooltip hint en encabezados de tabla ───────────────────────────────── */
.th-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: .65rem;
    font-weight: 700;
    border-radius: 50%;
    background: #30363d;
    color: #8b949e;
    cursor: help;
    margin-left: .25rem;
    vertical-align: middle;
    line-height: 1;
}
.th-hint:hover { background: #f0b42933; color: #f0b429; }

/* ═══════════════════════════════════════════════════════════════
   Trading Automático — Dashboard
═══════════════════════════════════════════════════════════════ */

/* Barra de estado */
.trading-estado-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid #94a3b8;
    transition: border-color .3s;
}
.trading-estado-bar.activo  { border-left-color: #059669; }
.trading-estado-bar.inactivo { border-left-color: #94a3b8; }

/* Indicador */
.trading-indicador { display: flex; align-items: center; gap: .5rem; }
.trading-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #94a3b8;
    transition: background .3s;
}
.trading-dot.on {
    background: #059669;
    box-shadow: 0 0 0 3px rgba(5,150,105,.2);
    animation: pulso 1.5s infinite;
}
@keyframes pulso {
    0%,100% { box-shadow: 0 0 0 3px rgba(5,150,105,.2); }
    50%      { box-shadow: 0 0 0 6px rgba(5,150,105,.08); }
}

/* PnL */
.trading-pnl-wrap { display:flex; flex-direction:column; align-items:flex-start; gap:.1rem; }
.trading-label    { font-size:.68rem; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); }
.trading-pnl-val  { font-size:1.2rem; font-weight:700; font-variant-numeric:tabular-nums; }
.trading-pnl-val.pos { color: #059669; }
.trading-pnl-val.neg { color: #dc2626; }

/* Barra PnL */
.trading-pnl-bar-wrap { min-width:80px; }
.trading-pnl-bar {
    position: relative;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.trading-pnl-zero {
    position: absolute;
    left: 50%; top: 0;
    width: 2px; height: 100%;
    background: #94a3b8;
    transform: translateX(-50%);
}
.trading-pnl-fill {
    position: absolute;
    top: 0; height: 100%;
    border-radius: 4px;
    transition: width .4s ease, margin-left .4s ease;
}
.trading-pnl-fill.pos { background: #059669; left:50%; }
.trading-pnl-fill.neg { background: #dc2626; }

/* Balance */
.trading-balance-group { display:flex; gap:1.5rem; }
.trading-balance-item  { display:flex; flex-direction:column; gap:.1rem; font-variant-numeric:tabular-nums; }

/* Separador */
.trading-separador { width:1px; height:32px; background:var(--border); }

/* Conexión IQ */
.trading-conexion { display:flex; align-items:center; gap:.4rem; font-size:.8rem; }
.trading-conexion.ok  { color: #059669; }
.trading-conexion.off { color: #dc2626; }

/* Feed de eventos */
.feed-item {
    font-size: .8rem;
    padding: .3rem .5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}
.feed-hora { color: var(--text-muted); font-size:.72rem; font-variant-numeric:tabular-nums; white-space:nowrap; }
.feed-tipo {
    font-size: .68rem;
    font-weight: 700;
    padding: .1rem .35rem;
    border-radius: 3px;
    white-space: nowrap;
}
.feed-tipo.abierta { background:#dbeafe; color:#1d4ed8; }
.feed-tipo.win     { background:#d1fae5; color:#065f46; }
.feed-tipo.loss    { background:#fee2e2; color:#991b1b; }
.feed-tipo.eq      { background:#fef9c3; color:#854d0e; }
.feed-tipo.omitida { background:#f1f5f9; color:#475569; }

/* Toast */
.trading-toast {
    position: fixed;
    bottom: 1.5rem; right: 1.5rem;
    padding: .6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    z-index: 9999;
    animation: slideIn .2s ease;
}
@keyframes slideIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.trading-toast-ok    { background:#d1fae5; color:#065f46; border:1px solid #6ee7b7; }
.trading-toast-error { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }

/* ── Vista horizontal de secuencias (modal Resultados) ─────────────── */
.seq-block { margin-bottom: 6px; }

.seq-table {
    border-collapse: collapse;
    font-size: .78rem;
    table-layout: fixed;
    width: auto;
}
.seq-table td {
    border: 1px solid #dee2e6;
    padding: 4px 8px;
    white-space: nowrap;
    vertical-align: middle;
    overflow: hidden;
}

/* Columna 1: identificador de la secuencia — ancho fijo */
.sq-id {
    font-weight: 700;
    font-size: .8rem;
    background: #f8fafc;
    width: 145px;
    min-width: 145px;
    max-width: 145px;
}
.sq-tipo {
    background: #f8fafc;
    color: #475569;
    font-family: monospace;
    font-size: .76rem;
    font-weight: 600;
    width: 145px;
    min-width: 145px;
    max-width: 145px;
}

/* Celdas de gale (fila 1) — ancho fijo uniforme */
.sq-gale {
    width: 82px;
    min-width: 82px;
    max-width: 82px;
    text-align: center;
}
.sq-win  { background: #d1fae5; color: #065f46; font-weight: 700; }
.sq-loss { background: #ffe4e6; color: #9f1239; font-weight: 700; }
.sq-open { background: #fef9c3; color: #713f12; font-weight: 700; }
.sq-eq   { background: #e2e8f0; color: #475569; font-weight: 700; }
.sq-glbl { font-size: .68rem; font-weight: 400; opacity: .7; display: block; }

/* Celdas de hora (fila 2) — mismo ancho que gale */
.sq-time {
    width: 82px;
    min-width: 82px;
    max-width: 82px;
    color: #64748b;
    font-size: .76rem;
    font-weight: 600;
    font-family: monospace;
    text-align: center;
    background: #fcfcfc;
}
.sq-time-fin {
    color: #334155;
    font-weight: 700;
    background: #fcfcfc;
}

/* Celda resultado — ancho fijo */
.sq-res {
    font-weight: 700;
    font-size: .82rem;
    text-align: center;
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    vertical-align: middle;
}
.sq-res-win  { background: #059669; color: #fff; }
.sq-res-loss { background: #e11d48; color: #fff; }
.sq-res-eq   { background: #64748b; color: #fff; }
.sq-res-open { background: #d97706; color: #fff; }
.sq-res-err  { background: #b91c1c; color: #fff; font-size: .72rem; }
.sq-res-skip { background: #94a3b8; color: #fff; }
.sq-err  { background: #fecaca; color: #7f1d1d; font-weight: 700; }
.seq-omitida { opacity: .72; }
