/* ============================================================
   Ayuda - Comisiones por Agente
   AY-004
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--fp-bg-body, #1e1e23);
    color: var(--fp-text-primary, #f1f5f9);
    min-height: 100vh;
}

/* ---------- Header ---------- */
.ayuda-header {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    padding: 2rem 1.5rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
}
.ayuda-header-icon { font-size: 2.5rem; opacity: 0.95; }
.ayuda-header-text h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.ayuda-header-text p  { font-size: 0.9rem; opacity: 0.85; }
.btn-volver {
    margin-left: auto;
    display: flex; align-items: center; gap: 0.4rem;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff; padding: 0.45rem 0.9rem;
    border-radius: 8px; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: background 0.2s; white-space: nowrap;
}
.btn-volver:hover { background: rgba(255,255,255,0.3); color: #fff; }

/* ---------- Layout 2 columnas ---------- */
.ayuda-layout {
    display: flex; max-width: 1100px; margin: 0 auto;
    padding: 1.5rem; gap: 1.5rem;
}

/* ---------- Sidebar TOC ---------- */
.ayuda-toc {
    width: 240px; flex-shrink: 0;
    position: sticky; top: 1rem; align-self: flex-start;
    background: var(--fp-bg-card, #2a2a2e);
    border: 1px solid var(--fp-border, rgba(255,255,255,0.08));
    border-radius: 12px; padding: 1rem;
    max-height: calc(100vh - 2rem); overflow-y: auto;
}
.toc-list { list-style: none; }
.toc-list li { margin-bottom: 2px; }
.toc-list a {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.6rem; border-radius: 6px;
    font-size: 0.78rem; color: var(--fp-text-muted, #94a3b8);
    text-decoration: none; transition: all 0.15s;
}
.toc-list a:hover { background: rgba(8,145,178,0.1); color: #67e8f9; }
.toc-list a.active { background: rgba(8,145,178,0.15); color: #22d3ee; font-weight: 600; }
.toc-list a i { font-size: 0.85rem; width: 18px; text-align: center; flex-shrink: 0; }
.toc-toggle { display: none; }
.toc-sep { height: 1px; background: var(--fp-border, rgba(255,255,255,0.08)); margin: 6px 0; }

/* ---------- Contenido principal ---------- */
.ayuda-content { flex: 1; min-width: 0; }

.seccion { margin-bottom: 2.5rem; scroll-margin-top: 1rem; }
.seccion h2 {
    font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem;
    padding-bottom: 0.5rem; border-bottom: 1px solid rgba(8,145,178,0.2);
    display: flex; align-items: center; gap: 0.5rem;
}
.seccion h2 i { color: #22d3ee; }
.seccion h3 { font-size: 0.95rem; font-weight: 700; margin: 1.25rem 0 0.5rem; color: #67e8f9; }
.seccion p  { font-size: 0.85rem; line-height: 1.6; margin-bottom: 0.75rem; color: var(--fp-text-secondary, #cbd5e1); }
.seccion ul, .seccion ol { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.seccion li { font-size: 0.85rem; line-height: 1.6; margin-bottom: 0.3rem; color: var(--fp-text-secondary, #cbd5e1); }
.seccion code { background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 3px; font-size: 0.8rem; color: #67e8f9; }

/* ---------- Callout boxes ---------- */
.box { padding: 0.85rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.82rem; line-height: 1.5; border-left: 3px solid; }
.box-info   { background: rgba(59,130,246,0.1);  border-color: #3b82f6; color: #93c5fd; }
.box-tip    { background: rgba(16,185,129,0.1);  border-color: #10b981; color: #6ee7b7; }
.box-warn   { background: rgba(245,158,11,0.1);  border-color: #f59e0b; color: #fcd34d; }
.box-danger { background: rgba(239,68,68,0.1);   border-color: #ef4444; color: #fca5a5; }
.box strong { display: block; margin-bottom: 0.25rem; }

/* ---------- Tabla comparativa ---------- */
.tabla-comp {
    width: 100%; border-collapse: collapse; margin: 0.75rem 0 1rem;
    font-size: 0.8rem;
}
.tabla-comp th {
    background: rgba(8,145,178,0.15); color: #67e8f9;
    padding: 0.5rem 0.75rem; text-align: left; font-weight: 600;
    border-bottom: 1px solid rgba(8,145,178,0.2);
}
.tabla-comp td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--fp-border, rgba(255,255,255,0.06));
    color: var(--fp-text-secondary, #cbd5e1);
}
.tabla-comp tr:hover td { background: rgba(255,255,255,0.02); }

/* ---------- Steps ---------- */
.pasos { counter-reset: paso; list-style: none; padding-left: 0; }
.pasos li {
    counter-increment: paso;
    position: relative; padding-left: 2.5rem;
    margin-bottom: 1rem; font-size: 0.85rem; line-height: 1.6;
    color: var(--fp-text-secondary, #cbd5e1);
}
.pasos li::before {
    content: counter(paso);
    position: absolute; left: 0; top: 0;
    width: 1.8rem; height: 1.8rem; border-radius: 50%;
    background: rgba(8,145,178,0.2); color: #22d3ee;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
}

/* ---------- Badges ---------- */
.badge-contado { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; background: rgba(16,185,129,0.2); color: #34d399; }
.badge-credito { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-devoluc { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; background: rgba(239,68,68,0.2); color: #f87171; }
.badge-modo { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; background: rgba(8,145,178,0.15); color: #22d3ee; }

/* ---------- Flujo visual ---------- */
.flujo { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 1rem; }
.flujo-paso {
    display: flex; align-items: center; gap: 0.4rem;
    background: var(--fp-bg-card, #2a2a2e);
    border: 1px solid var(--fp-border, rgba(255,255,255,0.08));
    border-radius: 8px; padding: 0.5rem 0.75rem;
    font-size: 0.78rem; color: var(--fp-text-secondary, #cbd5e1);
}
.flujo-paso i { color: #22d3ee; }
.flujo-flecha { display: flex; align-items: center; color: #4b5563; font-size: 0.9rem; }

/* ---------- Ejemplo formula ---------- */
.formula-box {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--fp-border, rgba(255,255,255,0.08));
    border-radius: 8px; padding: 1rem;
    font-family: 'Lucida Console', 'Consolas', monospace;
    font-size: 0.8rem; line-height: 1.8;
    color: #e2e8f0; margin: 0.75rem 0 1rem;
    overflow-x: auto;
}
.formula-box .comment { color: #6b7280; }
.formula-box .var { color: #67e8f9; }
.formula-box .op { color: #f59e0b; }
.formula-box .result { color: #34d399; font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
    .ayuda-layout { flex-direction: column; }
    .ayuda-toc {
        position: relative; top: 0; width: 100%;
        max-height: none;
    }
    .toc-toggle {
        display: flex; align-items: center; gap: 0.4rem;
        background: none; border: none; color: #22d3ee;
        font-size: 0.8rem; font-weight: 600; cursor: pointer;
        padding: 0.3rem 0; width: 100%;
    }
    .toc-list.collapsed { display: none; }
}
@media (max-width: 600px) {
    .ayuda-header { flex-wrap: wrap; }
    .btn-volver { order: -1; margin-left: 0; }
    .flujo { flex-direction: column; }
    .flujo-flecha { transform: rotate(90deg); justify-content: center; }
}
