/* =========================================================================
 * Crypto Flow — Simulador de Trading y selector de simulador
 * ========================================================================= */
/* selector DeFi / Trading (también se usa en app.html) */
.product-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; margin-top: -4px; }
.product-switch a { text-align: center; padding: 7px 4px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-2); text-decoration: none; }
.product-switch a:hover { color: var(--text); }
.product-switch a.on { background: var(--brand-soft); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 40%, transparent); }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eq-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; font-weight: 800; font-size: 12px; }
a.plan-pill, a.upgrade { text-decoration: none; }
.onb-bal.one > div { max-width: 260px; }
.alert.left { text-align: left; }
.alert.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.lvl-num.t, .academy-hero.t .lvl-badge { background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.academy-hero.t { background: linear-gradient(135deg, color-mix(in srgb, var(--brand-2) 16%, var(--surface)), var(--surface) 60%); }

/* activos */
.tr-assets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.tr-asset { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 10px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; color: var(--text); }
.tr-asset b { font-size: 14px; }
.tr-asset span { font-weight: 600; justify-self: end; }
.tr-asset em { grid-column: 2; justify-self: end; font-style: normal; font-size: 12px; font-weight: 600; }
.tr-asset:hover { border-color: var(--muted); }
.tr-asset.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

/* zona principal */
.tr-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.tr-bottom { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.tr-chart-card { padding: 14px 14px 10px; }
.tr-chart-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tr-title b { font-size: 17px; display: block; }
.tr-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tr-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); border-radius: 20px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.chip.on { color: var(--text); border-color: var(--muted); }
.chip i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; opacity: .4; }
.chip.on i { opacity: 1; }
.dot-sma20 { background: var(--s1); } .dot-sma50 { background: var(--s2); } .dot-ema20 { background: var(--s7); } .dot-bb { background: var(--s3); }
.tchart { position: relative; width: 100%; user-select: none; touch-action: pan-y; }
.tchart canvas { display: block; cursor: crosshair; }
.tr-hint { margin: 6px 0 0; }
.seg.sm button { padding: 5px 9px; font-size: 12px; }
.seg.block { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; margin-bottom: 10px; }
.seg.block button { text-align: center; }
.seg.side button[data-v="buy"].on, .seg.side button[data-v="long"].on { background: var(--up); color: #fff; }
.seg.side button[data-v="sell"].on, .seg.side button[data-v="short"].on { background: var(--down); color: #fff; }
.otype-help { min-height: 18px; margin: -2px 0 6px; }
.quick.inline { margin: 0; }
.quick.inline button { padding: 2px 7px; font-size: 11px; }
.tr-order .field { margin: 10px 0; }
.tr-order .quote { margin: 10px 0; }
.side-btn { color: #fff; border: 0; }
.side-btn.buy { background: var(--up); }
.side-btn.sell { background: var(--down); }
.side-btn:hover:not(:disabled) { filter: brightness(1.08); }
.row-btns .side-btn { flex: 1; }
.lev-scale { display: flex; justify-content: space-between; margin-top: 2px; }
.tag-buy { color: var(--up); } .tag-sell { color: var(--down); }

/* diario */
.kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.insights { list-style: none; padding: 0; margin: 0; }
.insights li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text-2); }
.insights li:last-child { border-bottom: 0; }
.insights b { color: var(--text); }
.select.sm { padding: 5px 8px; font-size: 12px; font-weight: 500; }
.note-in { width: 100%; min-width: 160px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; color: var(--text); font: inherit; font-size: 12.5px; }
.note-in:focus { outline: none; border-color: var(--brand); }
.tbl.journal td { vertical-align: top; }

/* gestión de riesgo */
.calc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.calc .field { min-width: 0; }
.calc .field:nth-child(2) { grid-column: 1 / -1; }
.calc-out { margin: 6px 0 14px; }
.calc-big { text-align: center; background: var(--surface-2); border-radius: 12px; padding: 14px; margin-bottom: 8px; }
.calc-big b { display: block; font-size: 26px; letter-spacing: -.02em; margin: 2px 0; }
.calc-big .small { display: block; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 20px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--up); }
.switch input:checked + span::before { transform: translateX(18px); }
.rules { margin: 10px 0 14px; }
.rules.off { opacity: .45; pointer-events: none; }
.rule { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: default; }
label.rule { justify-content: flex-start; cursor: pointer; }
.rule b, .rule .small { display: block; }
.rule input[type="checkbox"] { accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
.input-wrap.sm { width: 92px; padding: 2px 4px 2px 10px; }
.input-wrap.sm input { font-size: 14px; padding: 5px 0; }
.dd-table > div { display: grid; grid-template-columns: 48px 1fr 64px; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.dd-table b { text-align: right; }
.dd-bar { height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.dd-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--warn), var(--down)); border-radius: 6px; }

/* retos */
.challenges { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.challenge { display: flex; flex-direction: column; gap: 6px; }
.challenge .btn { margin-top: auto; align-self: flex-start; }
.challenge.won { border-color: color-mix(in srgb, var(--up) 50%, var(--border)); }
.ch-h { display: flex; justify-content: space-between; align-items: flex-start; }
.ch-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }

/* replay */
.rp-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

@media (max-width: 1200px) {
  .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .tr-main, .tr-bottom { grid-template-columns: minmax(0, 1fr); }
  .tr-order { max-width: 560px; width: 100%; justify-self: center; }
}
@media (max-width: 640px) {
  .tr-assets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calc { grid-template-columns: minmax(0, 1fr); }
  .tr-sep { display: none; }
}
