:root {
    --bg: #F4F6FA;
    --panel: #FFFFFF;
    --line: #E4E8F0;
    --navy: #11203F;
    --ink: #1A2333;
    --ink-dim: #6B7686;
    --green: #1FB872;
    --green-soft: #E6F7EF;
    --red: #E0445A;
    --red-soft: #FDEAEE;
    --accent: #C8102E;
    --telegram: #0088cc;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    /* Bloqueamos el scroll horizontal aquí para no romper el 'sticky' de los hijos del body */
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Space Grotesk', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.mono {
    font-family: 'IBM Plex Mono', monospace;
}

a {
    color: inherit;
    text-decoration: none;
}

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 32px;
}

@media(max-width:680px) {
    .wrap {
        padding: 0 20px;
    }
}

.top-wrap {
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar {
    background: var(--navy);
    height: 6px;
    width: 100%;
}

header {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.logo-mark {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 0.8rem;
    color: #fff;
}

.navlinks {
    display: flex;
    gap: 32px;
    font-size: 0.92rem;
    color: var(--ink-dim);
}

.navlinks a:hover {
    color: var(--ink);
}

.nav-cta {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 10px 22px;
    border-radius: 8px;
    transition: transform .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}

.nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(200, 16, 46, 0.22);
}

@media(max-width:780px) {
    .navlinks {
        display: none;
    }

    nav {
        gap: 12px;
    }

    .logo {
        font-size: 0.95rem;
    }

    .nav-cta {
        padding: 9px 16px;
        font-size: 0.82rem;
    }
}

@media(max-width:480px) {

    .logo span,
    .logo {
        font-size: 0.88rem;
    }

    .nav-cta {
        padding: 8px 12px;
        font-size: 0.76rem;
    }
}

/* ===== HERO ===== */
.hero {
    padding: 64px 0 48px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 48px;
    align-items: start;
}

@media(max-width:900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--navy);
    background: var(--green-soft);
    border-radius: 99px;
    padding: 6px 14px;
    margin-bottom: 18px;
}

.tag .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
}

h1 {
    font-size: clamp(2.1rem, 4vw, 3rem);
    line-height: 1.12;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 16px;
}

h1 .accent {
    color: var(--accent);
}

.hero p.lead {
    font-size: 1.04rem;
    color: var(--ink-dim);
    line-height: 1.65;
    max-width: 480px;
    margin-bottom: 28px;
}

.hero-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 36px;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 14px 28px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform .15s ease, box-shadow .15s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(200, 16, 46, 0.22);
}

.btn-ghost {
    border: 1px solid var(--line);
    color: var(--ink);
    font-weight: 500;
    font-size: 0.95rem;
    background: var(--panel);
    padding: 14px 28px;
    border-radius: 8px;
    transition: border-color .15s ease, background .15s ease;
}

.btn-ghost:hover {
    border-color: var(--navy);
}

/* tags row from manager info */
.info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.info-chip {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    color: var(--ink-dim);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 14px;
}

.info-chip b {
    color: var(--ink);
    font-weight: 600;
}

/* ===== chart card ===== */
.chart-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
}

.chart-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.chart-head .pair-sub {
    color: var(--ink-dim);
    font-size: 0.8rem;
}

.chart-head .pct {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 2rem;
    color: var(--green);
}

.chart-container {
    position: relative;
    height: 220px;
    width: 100%;
    margin-top: 14px;
}

.chart-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    color: var(--ink-dim);
}

.chart-foot b {
    color: var(--ink);
    font-weight: 600;
}

/* donut + side stats inside card */
.donut-row {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.donut {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: conic-gradient(var(--green) 0% 84%, var(--red) 84% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.donut-inner {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-inner .n {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 1.1rem;
}

.donut-inner .l {
    font-size: 0.6rem;
    color: var(--ink-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    min-width: 0;
}

.donut-legend .li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.donut-legend .sw {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.donut-legend b {
    font-family: 'IBM Plex Mono', monospace;
}

/* ===== sections ===== */
section {
    padding: 64px 0;
    border-top: 1px solid var(--line);
}

.section-head {
    max-width: 600px;
    margin-bottom: 40px;
}

.section-eyebrow {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.76rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

h2 {
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.section-head p {
    color: var(--ink-dim);
    line-height: 1.6;
    font-size: 1rem;
}

/* metrics grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}

@media(max-width:900px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.metric-cell {
    background: var(--panel);
    padding: 28px 26px;
}

.metric-cell .m-label {
    font-size: 0.76rem;
    color: var(--ink-dim);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.metric-cell .m-val {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.9rem;
    font-weight: 700;
}

.metric-cell .m-sub {
    font-size: 0.82rem;
    color: var(--ink-dim);
    margin-top: 6px;
}

.m-val.green {
    color: var(--green);
}

.m-val.red {
    color: var(--red);
}

/* monthly returns bar chart */
.bars-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 28px;
    overflow: hidden;
}

.bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 160px;
    margin-top: 24px;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.bar {
    width: 100%;
    border-radius: 5px 5px 0 0;
    background: var(--line);
    min-height: 4px;
}

.bar.active {
    background: linear-gradient(180deg, var(--green), #BEEFD6);
}

.bar-label {
    font-size: 0.72rem;
    color: var(--ink-dim);
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    max-width: 100%; 
    text-align: center;
}

@media(max-width:680px) {
    .bars {
        height: 130px;
        gap: 5px;
    }

    .bar-label {
        font-size: 0.6rem;
    }
}

@media(max-width:400px) {
    .bars {
        gap: 2px;
    }
    .bar-label {
        font-size: 0.48rem;
    }
}

/* how it works */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

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

.step {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 30px;
    transition: border-color .2s ease, transform .2s ease;
}

.step:hover {
    border-color: var(--green);
    transform: translateY(-3px);
}

.step .step-num {
    font-family: 'IBM Plex Mono', monospace;
    color: var(--green);
    font-size: 0.85rem;
    background: var(--green-soft);
    border-radius: 99px;
    padding: 4px 12px;
    display: inline-block;
    margin-bottom: 18px;
}

.step h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.step p {
    color: var(--ink-dim);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* copy section */
.copy-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    text-align: center;
}

/* faq */
.faq-item {
    border-bottom: 1px solid var(--line);
    padding: 20px 0;
    cursor: pointer;
}

.faq-item:first-child {
    padding-top: 0;
}

.faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.faq-q {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1rem;
}

.faq-q .icon {
    font-family: 'IBM Plex Mono', monospace;
    color: var(--accent);
    transition: transform .2s ease;
}

.faq-item.open .faq-q .icon {
    transform: rotate(45deg);
}

.faq-a {
    color: var(--ink-dim);
    font-size: 0.93rem;
    line-height: 1.65;
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
}

.faq-item.open .faq-a {
    max-height: 200px;
    margin-top: 12px;
}

/* CTA band */
.cta-band {
    text-align: center;
    padding: 72px 0;
    background: var(--navy);
    color: #fff;
    border-top: none;
}

.cta-band h2 {
    color: #fff;
    margin-bottom: 14px;
}

.cta-band p {
    color: #AEB8CC;
    max-width: 480px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

/* footer */
footer {
    padding: 40px 0;
    border-top: 1px solid var(--line);
}

.foot-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

footer p {
    color: var(--ink-dim);
    font-size: 0.85rem;
}

.disclaimer {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
    color: var(--ink-dim);
    font-size: 0.78rem;
    line-height: 1.7;
}

/* --- 1. Componentes Globales --- */
.history-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    margin-top: 24px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
    table-layout: fixed;
}

.history-table th {
    text-align: left;
    font-size: 0.72rem;
    color: var(--ink-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
}

.history-table td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
    font-family: 'IBM Plex Mono', monospace;
}

.history-table tr:hover {
    background: #f9f9fb;
}

.t-type {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
    text-transform: uppercase;
}

.t-buy {
    background: var(--green-soft);
    color: var(--green);
}

.t-sell {
    background: var(--red-soft);
    color: var(--red);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-pagination {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-pagination:hover:not(:disabled) {
    border-color: var(--navy);
    background: var(--bg);
}

.btn-pagination:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.res-pos {
    color: var(--green);
    font-weight: 600;
}

.res-neg {
    color: var(--red);
    font-weight: 600;
}

.table-container {
    overflow-x: auto;
    display: block;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* --- 2. Media Queries (Sobrescriben a los globales) --- */
@media(max-width:480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 40px 0 32px;
    }

    section {
        padding: 48px 0;
    }

    .hero-actions,
    .info-row {
        gap: 10px;
    }

    .btn-primary,
    .btn-ghost {
        padding: 13px 22px;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }

    .hero-actions {
        flex-direction: column;
    }

    .info-chip {
        font-size: 0.72rem;
        padding: 7px 11px;
    }

    .chart-card,
    .copy-card,
    .bars-card,
    .history-card {
        padding: 16px;
    }

    .donut-row {
        gap: 14px;
        justify-content: center;
        text-align: center;
    }

    .donut-legend {
        align-items: center;
    }

    .chart-head .pct {
        font-size: 1.6rem;
    }

    .metric-cell {
        padding: 20px 16px;
    }

    .metric-cell .m-val {
        font-size: 1.5rem;
    }

    /* Ajustes específicos de la tabla para móviles */
    .history-table {
        min-width: 440px;
    }

    .history-table td,
    .history-table th {
        padding: 10px 6px;
        font-size: 0.75rem;
    }

    .pagination-controls {
        gap: 8px;
    }

    .btn-pagination {
        width: 28px;
        height: 28px;
    }

    #page-info {
        font-size: 0.7rem;
    }

    /* Asegura que los pasos no se desborden */
    .step {
        padding: 24px;
    }
}

/* ==========================================================================
   SISTEMA DE PROGRESO DE CUMPLIMIENTO (APPSNEXO GLOBAL)
   ========================================================================== */
.xp-global-wrapper {
    background-color: #11111400; /* Fondo oscuro integrado */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 18px 0 35px 0; /* Espacio inferior para las etiquetas flotantes */
    width: 100%;
}

.xp-system {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.xp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
}

.xp-title {
    color: #9ca3af;
    font-weight: 500;
}

#level-name {
    color: #06b6d4; /* Color de acento de tu landing */
    text-transform: uppercase;
    margin-left: 4px;
}

.xp-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Contenedor adaptativo para la barra y los hitos */
.xp-bar-container {
    position: relative;
    width: 100%;
    padding: 6px 0;
}

/* Línea base gris de la barra */
.xp-bar {
    height: 8px;
    background-color: #24242b;
    border-radius: 4px;
    position: relative;
    z-index: 1;
}

/* Llenado dinámico con gradiente */
.xp-fill {
    height: 100%;
    width: 0%; /* Manejado por JS */
    background: linear-gradient(90deg, #6366f1, #06b6d4);
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Capa de hitos absolutos */
.milestones-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* Estructura de cada hito */
.milestone-node {
    position: absolute;
    top: 4px; /* Alineación perfecta con el centro de la barra */
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* El punto físico */
.milestone-node .dot {
    width: 12px;
    height: 12px;
    background-color: #1a1a1e;
    border: 2px solid #4b5563;
    border-radius: 50%;
    transition: all 0.4s ease;
}

/* Texto del rango (Nuevo, Verificado, etc) */
.milestone-node .label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    color: #6b7280;
    margin-top: 8px;
    white-space: nowrap;
}

/* Número del hito (50, 100, etc) */
.milestone-node .value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    color: #4b5563;
    margin-top: 1px;
}

/* --- ESTADOS ACTIVOS (Cuando el número de la DB supera el hito) --- */
.milestone-node.active .dot {
    background-color: #ffffff;
    border-color: #06b6d4;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.8);
}

.milestone-node.active .label {
    color: #ffffff;
    font-weight: 600;
}

.milestone-node.active .value {
    color: #06b6d4;
}

/* RESPONSIVIDAD PARA PANTALLAS MÓVILES (< 768px)
   Para evitar que los textos se pisen entre sí en celulares, ocultamos
   los números intermedios y dejamos solo los textos clave. */
@media (max-width: 768px) {
    .xp-global-wrapper {
        overflow-x: auto; /* Permite scroll horizontal suave si la pantalla es ultra pequeña */
        padding-bottom: 30px;
    }
    
    .milestone-node .value {
        display: none; /* Oculta los números abajo para limpiar espacio */
    }
    
    /* Oculta textos alternos en móvil para evitar colisiones de texto */
    .milestone-node:nth-child(2) .label,  /* Verificado */
    .milestone-node:nth-child(4) .label,  /* Estable */
    .milestone-node:nth-child(6) .label,  /* Experto */
    .milestone-node:nth-child(8) .label,  /* Avanzado */
    .milestone-node:nth-child(10) .label { /* Institucional */
        display: none;
    }
}

/* === Estilos de Comentarios === */
.comments-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px; margin-top: 40px; }
@media(max-width: 900px) { .comments-grid { grid-template-columns: 1fr; } }

.comment-card { background: var(--panel); border: 1px solid var(--line); padding: 20px; border-radius: 12px; margin-bottom: 20px; }
.comment-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.stars { color: #f1c40f; }
.admin-reply { margin-top: 15px; padding: 12px; background: var(--bg); border-left: 4px solid var(--accent); border-radius: 4px; font-size: 0.9rem; }

.star-row { display: flex; gap: 8px; margin-bottom: 20px; }
.star-btn { 
    background: none; border: 1px solid var(--line); font-size: 1.5rem; cursor: pointer; 
    padding: 5px 10px; border-radius: 8px; color: var(--ink-dim); transition: 0.2s;
}
.star-btn.active, .star-btn:hover { border-color: #f1c40f; color: #f1c40f; background: #fffdf0; }

.form-field { margin-bottom: 15px; }
.form-field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-dim); }
.form-field input, .form-field textarea { 
    width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; 
}

.rating-summary { display: flex; align-items: center; gap: 20px; margin-bottom: 30px; background: var(--panel); padding: 20px; border-radius: 14px; border: 1px solid var(--line); }
.rating-big { font-size: 3rem; font-weight: 700; color: var(--ink); }
.rating-stars-display { color: #f1c40f; font-size: 1.2rem; }

/* === Estilos Panel Admin === */
.comment-card-admin { background: var(--panel); border: 1px solid var(--line); padding: 20px; border-radius: 12px; margin-bottom: 20px; }
.comment-card-admin.pending { border-left: 6px solid #f1c40f; }
.comment-card-admin.approved { border-left: 6px solid var(--green); }
.comment-card-admin.rejected { border-left: 6px solid var(--red); }
.status-pill { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; }
.status-pill.pending { background: #fff9e6; color: #9a7d0a; }
.status-pill.approved { background: var(--green-soft); color: var(--green); }
.status-pill.rejected { background: var(--red-soft); color: var(--red); }
.reply-area { width: 100%; margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }