/* Invest — sistema de diseño. Tokens en :root, oscuro por defecto, movimiento desactivable. */
:root {
  --bg0: #06080B; --bg1: #0B0F14; --bg2: #11161E;
  --surface: rgba(255,255,255,.035); --surface-2: rgba(255,255,255,.07); --surface-3: rgba(255,255,255,.12);
  --line: rgba(255,255,255,.075); --line-2: rgba(255,255,255,.16);
  --ink: #F4F6F2; --ink-2: #C9CFD4; --muted: #8B94A1; --faint: #535C69;
  --accent: #C6F432; --accent-2: #DEFF7C; --accent-ink: #0C1300; --accent-dim: rgba(198,244,50,.12);
  --cool: #8B7CFF; --cool-dim: rgba(139,124,255,.16);
  --s1: #C6F432; --s2: #8B7CFF; --s3: #FF8F3F; --s4: #3FD5FF;
  --up: #34E0A1; --up-dim: rgba(52,224,161,.13); --down: #FF5A76; --down-dim: rgba(255,90,118,.13);
  --radius: 22px; --radius-s: 12px; --pad: 18px; --tab-h: 64px; --side-w: 244px;
  --font-text: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: "Unbounded", "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 18px 40px -18px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg0); }
body { margin: 0; font-family: var(--font-text); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg0); min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
.bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; background:
  radial-gradient(55% 38% at 8% -6%, rgba(198,244,50,.13), transparent 62%),
  radial-gradient(45% 34% at 108% 4%, rgba(139,124,255,.18), transparent 60%),
  radial-gradient(60% 45% at 60% 118%, rgba(63,213,255,.07), transparent 60%),
  linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 70%); }
.bg::after { content: ""; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.bg::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(80% 50% at 50% 0%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(80% 50% at 50% 0%, #000 20%, transparent 75%); }
#app { max-width: 640px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 32px; }
body.has-tabs #app { padding-bottom: calc(var(--tab-h) + 40px + env(safe-area-inset-bottom)); }
body.mock::before { content: "datos de ejemplo"; position: fixed; bottom: calc(var(--tab-h) + 26px + env(safe-area-inset-bottom)); right: 16px; z-index: 30; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--accent); background: rgba(6,8,11,.8); border: 1px solid var(--accent-dim); padding: 3px 10px; border-radius: 99px; backdrop-filter: blur(8px); pointer-events: none; }

/* tipografía */
h1 { font-family: var(--font-display); font-size: 27px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; margin: 4px 0 0; }
h2 { font-family: var(--font-text); font-size: 15.5px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
p { margin: 8px 0; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.center { text-align: center; justify-content: center; }
.eyebrow { font-size: 12.5px; color: var(--muted); letter-spacing: .01em; font-weight: 500; }
.grow { flex: 1; min-width: 0; }

/* vistas y cabeceras */
.view { animation: view-in .2s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 2px 16px; }
.top > div:not(.btn) { flex: 1; min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.view > .section-head, .view > section > .section-head:first-child { margin-top: 0; }
.view > .section-head { margin-top: 22px; }
section + section, .grid-2 + section, .kpis + section, .kpis + .grid-2, section + .grid-2, .grid-2 + .grid-2, section + .kpis, section + .actions { margin-top: 14px; }

/* tarjetas */
.card { position: relative; background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.018)); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); box-shadow: var(--shadow); backdrop-filter: blur(16px) saturate(120%); -webkit-backdrop-filter: blur(16px) saturate(120%); transition: border-color .2s; }
.card:hover { border-color: rgba(255,255,255,.11); }
.card.compact { padding: 14px 16px; }
.compact .row { padding: 8px 0; }
.hero-dark { background: radial-gradient(120% 90% at 100% 0%, rgba(198,244,50,.16), transparent 55%), radial-gradient(90% 80% at 0% 100%, rgba(139,124,255,.16), transparent 60%), linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015)); border-color: rgba(198,244,50,.2); overflow: hidden; }
.hero-dark::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(200deg, #000, transparent 55%); -webkit-mask-image: linear-gradient(200deg, #000, transparent 55%); pointer-events: none; }
.hero-dark > * { position: relative; z-index: 1; }
.hero-gold { background: radial-gradient(90% 120% at 100% 0%, rgba(255,255,255,.45), transparent 50%), linear-gradient(150deg, #E4FF8E 0%, var(--accent) 45%, #A8D81E 100%); color: var(--accent-ink); border-color: rgba(255,255,255,.4); box-shadow: 0 24px 60px -24px rgba(198,244,50,.45); }
.hero-gold .eyebrow, .hero-gold .muted { color: rgba(26,18,4,.7); }
.hero-num { font-family: var(--font-display); font-size: 40px; font-weight: 600; letter-spacing: -0.055em; line-height: 1.05; margin: 8px 0 6px; font-variant-numeric: tabular-nums; min-height: 1.05em; }
.hero-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.hero-sub { font-size: 15px; opacity: .85; }
.hero-cash { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 2px 0 10px; font-size: 14px; }
.hero-cash b { font-weight: 600; }
.hero-cash .sep { opacity: .5; }
.hero-cash small { width: 100%; font-size: 12px; }
.hero-split { display: flex; align-items: center; gap: 14px; }
.hero-split > div:first-child { flex: 1; min-width: 0; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 16px; }
.delta small { font-weight: 500; opacity: .8; font-size: 14px; }
.delta svg { width: 18px; height: 18px; }
.rationale { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid rgba(26,18,4,.15); font-size: 14px; line-height: 1.45; }
.ring-wrap { position: relative; width: 88px; height: 88px; flex: none; }
.ring-wrap .ring { display: block; }
.ring-wrap .ring circle:last-child { transition: stroke-dashoffset 1s var(--ease); }
.ring-t { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 30px; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.03em; }
.ring-t small { font-size: 12px; margin-left: 1px; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.stats3 b { display: block; font-size: 15px; }
.hero-spark { margin: 12px -6px -6px; }
.hero-spark .spark { width: 100%; height: 44px; display: block; }

/* chips, pastillas, puntos */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip b { font-weight: 600; color: var(--ink); }
.chip svg { width: 14px; height: 14px; }
.chip.gold { background: var(--accent-dim); color: var(--accent); border-color: rgba(198,244,50,.3); }
.chip.warn { background: rgba(255,143,63,.12); color: #FFB27A; border-color: rgba(255,143,63,.35); }
.chip.up { border-color: rgba(52,224,161,.3); } .chip.up b { color: var(--up); }
.chip.down { border-color: rgba(255,90,118,.3); } .chip.down b { color: var(--down); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip .tag { font-size: 11px; font-weight: 500; color: var(--muted); }
.pill { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.done { background: var(--up-dim); color: var(--up); }
.pill.skipped { background: var(--down-dim); color: var(--down); }
.pill.partial { background: var(--accent-dim); color: var(--accent); }
.pill.deferred { background: var(--surface-2); color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); flex: none; }
.dot.done { background: var(--up); } .dot.skipped { background: var(--down); } .dot.pending { background: var(--accent); }
.sq { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--surface-3); }
.sq.done { background: var(--accent); } .sq.partial { background: rgba(139,124,255,.6); } .sq.skipped { background: rgba(255,90,118,.55); } .sq.pending { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); } .sq.none { background: var(--surface-2); }

/* KPI y tiles */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.kpi { padding: 14px 14px 12px; border-radius: 18px; }
.kpi-ico { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); background: var(--surface-2); margin-bottom: 10px; } .kpi-ico svg { width: 16px; height: 16px; } .kpi-ico svg { width: 18px; height: 18px; }
.kpi.hot .kpi-ico { color: var(--accent-ink); background: var(--accent); }
.kpi.hot .kpi-ico svg { animation: flame 1.6s ease-in-out infinite alternate; }
@keyframes flame { from { transform: scale(1) } to { transform: scale(1.12) translateY(-1px) } }
.kpi-v { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.15; white-space: nowrap; }
.kpi-v small { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-l { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.tile-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface-2); }
.tile.up .tile-ico { background: var(--up-dim); color: var(--up); } .tile.down .tile-ico { background: var(--down-dim); color: var(--down); }
.tile .kpi-v { font-size: 20px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 8px; }
.kv > div { display: flex; flex-direction: column; gap: 1px; } .kv b { font-weight: 600; }
.kv .kpi-l { margin: 0 0 2px; }
.pend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 14px; }
.pend .kpi-l { width: 100%; margin: 0 0 2px; }

/* rejillas */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-2.tight { gap: 10px; }
@media (min-width: 700px) {
  #app { max-width: 760px; padding-left: 24px; padding-right: 24px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 34px; }
  .hero-num { font-size: 54px; }
}

/* listas y filas */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; padding-top: 4px; }
.row:last-child { padding-bottom: 2px; }
.row .name { font-weight: 500; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item { border-top: 1px solid var(--line); padding: 11px 0; }
.item:first-child { border-top: 0; padding-top: 4px; } .item:last-child { padding-bottom: 2px; }
.item .row { border-top: 0; padding: 0; }
.item .amt { margin-top: 2px; }
.item-log { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; margin-top: 8px; padding-left: 58px; line-height: 1.35; }
.item-log svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.row .amt { font-weight: 600; font-size: 16px; font-family: var(--font-display); letter-spacing: -0.01em; }
.row .small svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.sym { font-family: var(--font-display); font-weight: 600; font-size: 11.5px; letter-spacing: 0; min-width: 50px; padding: 7px 0; text-align: center; border-radius: 10px; background: var(--surface-2); }
.item.done .sym { background: var(--up-dim); color: var(--up); } .item.skipped .sym { background: var(--down-dim); color: var(--down); opacity: .8; }
.item.skipped .name, .item.skipped .amt { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.3); }
.venue-note { margin: -6px 0 6px; }
.item-log.deferred { color: var(--muted); }
.link { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.link:hover { color: var(--ink-2); }

/* feed */
.feed { padding: 6px 16px; }
.feed-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.feed-item:first-child { border-top: 0; }
.feed-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--ink-2); }
.feed-ico svg { width: 18px; height: 18px; }
.feed-item.ok .feed-ico { color: var(--up); background: var(--up-dim); }
.feed-item.error .feed-ico { color: var(--down); background: var(--down-dim); }
.feed-item.error .feed-t { color: var(--down); }
.feed-t { font-weight: 600; font-size: 14px; }
.feed-d { color: var(--muted); font-size: 13px; margin-top: 1px; overflow-wrap: anywhere; }
.feed-r { text-align: right; display: flex; flex-direction: column; gap: 2px; flex: none; }
.feed-r .num { font-weight: 600; font-size: 14px; }

/* activo (cartera y mercado) */
.asset-head { display: flex; align-items: flex-start; gap: 10px; }
.asset-head > b, .asset-head .grow > b { font-family: var(--font-display); font-size: 16px; }
.sw { width: 10px; height: 10px; border-radius: 3px; margin-top: 7px; flex: none; }
.asset-val { text-align: right; flex: none; } .asset-val > b { font-size: 16px; font-family: var(--font-display); letter-spacing: -0.01em; }
.asset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 14px 0 12px; }
.asset-grid > div { display: flex; flex-direction: column; } .asset-grid b { font-size: 14.5px; font-weight: 600; } .asset-grid .kpi-l { order: -1; margin: 0 0 2px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; position: relative; overflow: visible; margin-top: 4px; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; transition: width .8s var(--ease); }
.bar > b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; transform: translateX(-1px); }
.bar-l { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 8px; } .bar-l b { color: var(--ink); font-weight: 600; }
.dev { font-weight: 600; font-size: 12.5px; }

/* gráficos */
.chart-wrap { position: relative; margin: 6px -6px 0; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart[data-empty]::after { content: "sin datos suficientes"; display: block; color: var(--muted); font-size: 13px; padding: 12px 0; }
.chart text { font-family: var(--font-text); font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart text.mark { fill: var(--ink-2); font-weight: 600; font-size: 11px; paint-order: stroke; stroke: #0B0F14; stroke-width: 3px; stroke-linejoin: round; }
.chart .pulse { opacity: .35; transform-box: fill-box; transform-origin: center; animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.3); opacity: .5 } 100% { transform: scale(1.6); opacity: 0 } }
.chart .col { transition: filter .15s; transform-box: fill-box; transform-origin: 50% 100%; animation: col-in .6s var(--ease) both; } .chart .col.hot { filter: brightness(1.25); }
@keyframes col-in { from { transform: scaleY(0) } }
.chart .arc { transition: filter .15s; } .chart .arc.hot { filter: brightness(1.15); }
.tip { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; background: rgba(12,16,22,.95); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,.4); white-space: nowrap; min-width: 120px; }
.tip-h { color: var(--muted); margin-bottom: 4px; font-size: 12px; }
.tip-row { display: flex; align-items: center; gap: 7px; }
.tip-row i { width: 12px; height: 3px; border-radius: 2px; flex: none; } .tip-row i.sq { width: 10px; height: 10px; border-radius: 3px; }
.tip-row b { font-variant-numeric: tabular-nums; } .tip-row span { color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 14px; height: 3px; border-radius: 2px; }
.seg { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: 12px; padding: 3px; margin-top: 10px; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 9px; padding: 7px 14px; min-height: 34px; cursor: pointer; transition: background .15s, color .15s; }
.seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px -4px rgba(198,244,50,.5); }
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut { width: 138px; flex: none; }
.donut svg { overflow: visible; }
.donut-c { font-family: var(--font-display); font-size: 17px; font-weight: 700; fill: var(--ink) !important; letter-spacing: -0.02em; }
.donut-s { font-size: 10px !important; }
.donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.lg-row { display: grid; grid-template-columns: 10px 1fr; align-items: center; gap: 10px; font-size: 13.5px; }
.lg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lg-row i { width: 10px; height: 10px; border-radius: 3px; }
.lg-row > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.lg-row .small { font-size: 12px; }
.heat-grid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 4px; }
.heat-grid .cell { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); cursor: default; animation: cell-in .4s var(--ease) both; outline: none; }
.heat-grid .cell:focus-visible { box-shadow: 0 0 0 2px var(--ink); }
@keyframes cell-in { from { opacity: 0; transform: scale(.6) } }
.cell.done { background: linear-gradient(145deg, var(--accent-2), var(--accent)); } .cell.partial { background: rgba(139,124,255,.6); } .cell.skipped { background: rgba(255,90,118,.55); } .cell.none { background: var(--surface-2); }
.cell.pending, .cell.now { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cell.now { animation: cell-in .4s var(--ease) both, glow 2s ease-in-out infinite alternate; }
@keyframes glow { from { box-shadow: inset 0 0 0 1.5px var(--accent) } to { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 10px rgba(198,244,50,.5) } }
.heat-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.heat-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* botones */
.btn, button.btn { font: inherit; font-weight: 600; font-size: 14.5px; border: 1px solid var(--line); border-radius: 13px; padding: 11px 16px; min-height: 44px; cursor: pointer; background: var(--surface-2); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s var(--ease), background .15s, opacity .15s; -webkit-tap-highlight-color: transparent; user-select: none; }
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 10px 28px -10px rgba(198,244,50,.6), inset 0 1px 0 rgba(255,255,255,.5); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { color: var(--down); }
.btn.icon { width: 44px; height: 44px; padding: 0; flex: none; border-radius: 12px; }
.btn.small { min-height: 36px; padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* formularios */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.field { margin-top: 14px; }
.field.inline { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.field.inline label { margin: 0; flex: 1; display: flex; flex-direction: column; color: var(--ink); }
.field.inline label b { font-family: var(--font-display); font-size: 14px; }
input, select { font: inherit; width: 100%; padding: 12px 14px; min-height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(0,0,0,.25); color: var(--ink); -webkit-appearance: none; appearance: none; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
input[type=number] { font-variant-numeric: tabular-nums; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393A1B1' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }
.suffix { position: relative; width: 110px; flex: none; }
.suffix input { padding-right: 34px; text-align: right; }
.suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
input[type=range] { padding: 0; min-height: 44px; background: transparent; border: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: var(--surface-3); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); margin-top: -9px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
input[type=range]:focus { box-shadow: none; }
.range-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.switch { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); margin: 0; color: var(--ink); font-size: 14.5px; cursor: pointer; }
.switch:first-of-type { margin-top: 6px; }
.switch > span { flex: 1; display: flex; flex-direction: column; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; }
.switch i { width: 50px; height: 30px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--accent-dim); }
.weights { margin-top: 4px; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.sub-head h3 { font-family: var(--font-display); font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.sub-head + .switch, .sub-head + p + .switch { border-top: 0; }
.checks { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.check svg { width: 18px; height: 18px; flex: none; } .check.ok svg { color: var(--up); } .check.ko svg { color: var(--down); }
.check > div { display: flex; flex-direction: column; } .check b { font-size: 14px; }
.secret { background: rgba(0,0,0,.3); border: 1px solid var(--line); padding: 12px; border-radius: 12px; word-break: break-all; font-size: 15px; letter-spacing: .08em; margin: 10px 0; text-align: center; }
.error { color: var(--down); font-size: 14px; margin-top: 10px; display: none; }
.error.show, .error:not(:empty) { display: block; }
.error-card { display: flex; align-items: center; gap: 12px; color: var(--down); } .error-card p { color: var(--muted); margin: 2px 0 0; }
.empty { text-align: center; padding: 18px 8px 8px; color: var(--muted); }
.empty svg { width: 28px; height: 28px; opacity: .6; } .empty p { margin: 8px auto 14px; max-width: 320px; }

/* barra de pestañas */
#tabs[hidden] { display: none; }
#tabs { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px; background: rgba(12,16,22,.78); backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%); border: 1px solid var(--line-2); border-radius: 24px; box-shadow: 0 20px 50px -12px rgba(0,0,0,.7); }
#tabs a { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .01em; border-radius: 18px; transition: color .25s, transform .12s; -webkit-tap-highlight-color: transparent; }
#tabs a:active { transform: scale(.94); }
#tabs a.active { color: var(--accent-ink); }
#tabs a svg { width: 22px; height: 22px; transition: transform .25s var(--ease); }
#tabs a.active svg { transform: translateY(-1px); }
.tab-ind { position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 5); border-radius: 18px; background: var(--accent); box-shadow: 0 8px 22px -6px rgba(198,244,50,.55); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .35s var(--ease); }
.brand { display: none; }

/* hoja modal y avisos */
.modal-bg { position: fixed; inset: 0; z-index: 40; background: rgba(4,8,14,.6); display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(6px); animation: fade .18s ease-out; }
.modal-bg.closing { animation: fade .18s ease-in reverse both; }
@keyframes fade { from { opacity: 0 } }
.modal { background: var(--bg2); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; border: 1px solid var(--line); padding: 14px var(--pad) calc(16px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; animation: up .22s var(--ease); }
.modal-bg.closing .modal { animation: up .18s ease-in reverse both; }
@keyframes up { from { transform: translateY(32px); opacity: 0 } }
.modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 0 auto 12px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { font-size: 19px; }
@media (min-width: 800px) { .modal-bg { align-items: center; } .modal { border-radius: 24px; } .modal::before { display: none; } }
#toasts { position: fixed; left: 0; right: 0; top: calc(10px + env(safe-area-inset-top)); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { display: flex; align-items: center; gap: 8px; background: rgba(17,22,30,.96); border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 14px; font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: toast-in .25s var(--ease); max-width: 100%; }
.toast.out { animation: toast-out .25s ease-in both; }
.toast .ico { display: grid; place-items: center; } .toast svg { width: 16px; height: 16px; }
.toast.ok .ico { color: var(--up); } .toast.error .ico { color: var(--down); } .toast.info .ico { color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.96) } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) } }

/* esqueletos */
.skel { pointer-events: none; }
.sk-line, .sk-block { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; height: 14px; margin: 10px 0; }
.sk-line.tall { height: 22px; } .sk-line.xl { height: 40px; } .sk-block { height: 160px; border-radius: 12px; }
.w30 { width: 30% } .w40 { width: 40% } .w45 { width: 45% } .w50 { width: 50% } .w55 { width: 55% } .w60 { width: 60% } .w70 { width: 70% } .w80 { width: 80% }
.sk-line::after, .sk-block::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%) } }
.skel + .skel, .skel + .grid-2, .grid-2 + .skel { margin-top: 14px; }

/* acceso */
.login { min-height: calc(100vh - 40px); display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .logo { width: 72px; height: 72px; border-radius: 22px; box-shadow: 0 18px 50px -10px rgba(198,244,50,.45); }
.login-brand h1 { margin-top: 12px; font-size: 34px; }
.login-card { padding: 22px; }
.login-card label { margin-top: 12px; } .login-card label:first-child { margin-top: 0; }
.login-card .btn { margin-top: 18px; }
.login-foot { text-align: center; font-size: 12.5px; margin-top: 18px; }

/* estrategias (backtest) */
.lead { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.loading-note { margin: -6px 2px 12px; }
.period-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.period-row .seg { margin-top: 0; }
.period-row .seg button { padding: 7px 10px; font-size: 12.5px; white-space: nowrap; }
.period-row select { width: auto; min-height: 40px; padding: 8px 36px 8px 12px; font-size: 13px; border-radius: 12px; }
.legend-x { gap: 2px 2px; margin: 0 0 4px; }
.legend-x button { font: inherit; font-size: 12px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 99px; padding: 3px 7px; min-height: 26px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: opacity .15s, background .15s; -webkit-tap-highlight-color: transparent; }
.legend-x button:hover { background: var(--surface); }
.legend-x button.off { opacity: .45; text-decoration: line-through; }
.legend-x > span { padding: 3px 7px; min-height: 26px; font-size: 12px; }
.legend i.dash { width: 16px; background: repeating-linear-gradient(90deg, #7F8C9B 0 4px, transparent 4px 7px); }
.chart-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.switch.compact { border: 0; padding: 4px 0; font-size: 13.5px; gap: 8px; }
.switch.compact:first-of-type { margin-top: 0; }
.switch.compact > span { flex: none; }
.switch.compact i { width: 40px; height: 24px; } .switch.compact i::after { width: 18px; height: 18px; } .switch.compact input:checked + i::after { transform: translateX(16px); }
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; border-radius: 10px; }
.tscroll:focus-visible { outline-offset: 0; }
table.bt { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 13.5px; }
.bt th, .bt td { padding: 9px 10px; text-align: right; white-space: nowrap; border-top: 1px solid var(--line); vertical-align: middle; }
.bt thead th { border-top: 0; font-weight: 500; color: var(--muted); font-size: 12px; padding-top: 0; }
.bt thead th button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: 3px; align-items: center; min-height: 28px; }
.bt thead th button:hover { color: var(--ink-2); }
.bt thead th button svg { width: 12px; height: 12px; }
.bt th[scope=row] { text-align: left; font-weight: 500; color: var(--ink); position: sticky; left: 0; z-index: 1; background: #0F141B; box-shadow: 1px 0 0 var(--line); white-space: normal; min-width: 190px; max-width: 190px; line-height: 1.35; }
.bt thead th:first-child { position: sticky; left: 0; z-index: 2; background: #0F141B; box-shadow: 1px 0 0 var(--line); text-align: left; }
@media (min-width: 800px) { .bt th[scope=row] { min-width: 270px; max-width: 270px; } }
.bt .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 8px 0 0; vertical-align: -1px; }
.bt .bt-name { display: inline; }
.bt .pill { margin-left: 6px; font-size: 11px; padding: 2px 7px; vertical-align: 1px; display: inline-block; margin-top: 2px; }
.bt tbody tr { cursor: pointer; }
.bt tbody tr:hover td, .bt tbody tr:hover th, .bt tbody tr:focus-visible td, .bt tbody tr:focus-visible th { background: var(--surface); }
.bt tbody tr:focus-visible { outline: none; }
.bt tbody tr:focus-visible th { box-shadow: inset 2px 0 0 var(--accent), 1px 0 0 var(--line); }
.bt tbody tr.is-active th { color: var(--ink); font-weight: 600; }
.reco-note { margin: 12px 0 0; line-height: 1.5; }
.reco-note .pill { margin-right: 4px; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 4px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mini-kpis > div { display: flex; flex-direction: column; } .mini-kpis .kpi-l { order: -1; margin: 0 0 2px; } .mini-kpis b { font-size: 15px; }
.params .field:first-child { margin-top: 8px; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.progress[hidden] { display: none; }
.progress i { display: block; width: 40%; height: 100%; border-radius: 99px; background: var(--accent); animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%) } to { transform: translateX(260%) } }
a.card.tile { color: inherit; transition: background .15s; }
a.card.tile:hover { background: linear-gradient(180deg, rgba(255,255,255,.085), rgba(255,255,255,.045)); }
a.card.tile > svg { color: var(--muted); flex: none; }
section + a.card, a.card + section, .grid-2 + a.card { margin-top: 14px; }
.tile-ico.gold { background: var(--accent-dim); color: var(--accent); }
.tile b { font-family: var(--font-display); font-size: 15px; display: block; margin-top: 1px; }
.plan-note { margin: 8px 0 0; font-size: 13px; color: rgba(26,18,4,.8); }
.plan-note b { font-weight: 600; }
.modal .small svg { width: 14px; height: 14px; vertical-align: -3px; margin-right: 3px; }

/* proyección (Inicio) */
.proj-head { margin: -4px 0 8px; }
.proj-num { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.05em; line-height: 1.05; margin: 4px 0 6px; min-height: 1.05em; }
.proj-ctl { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.proj-ctl .field { margin-top: 6px; min-width: 200px; }
.proj-ctl .seg { margin: 0 0 8px; }
.proj-ctl .seg button { padding: 7px 11px; }
.proj-warn { margin-top: 4px; }
.proj.loading .chart-wrap, .proj.loading .proj-head { opacity: .55; transition: opacity .2s; }

/* alertas de mercado (Inicio) */
.alert-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.alert-row:first-child { border-top: 0; padding-top: 4px; } .alert-row:last-child { padding-bottom: 2px; }
.alert-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--down-dim); color: var(--down); }
.alert-row.recovery .alert-ico { background: var(--up-dim); color: var(--up); }
.alert-ico svg { width: 18px; height: 18px; }
.alert-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-top b { font-family: var(--font-display); font-size: 15px; }
.alert-msg { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.4; overflow-wrap: anywhere; }
.feed-item.warn .feed-ico { color: var(--accent); background: var(--accent-dim); }

/* sobrantes: pastilla "extra", línea en ejecución y detalle en el hero de la semana */
.pill.extra { background: var(--cool-dim); color: #C4BBFF; }
.row .name .pill.extra, .modal .row .pill.extra { font-size: 11px; padding: 2px 7px; vertical-align: 1px; margin-left: 4px; }
.sweep-line { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--ink-2); }
.sweep-line svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.hero-extra { font-size: 13px; color: rgba(26,18,4,.8); margin: -2px 0 4px; } .hero-extra b { font-weight: 600; }

/* informe fiscal */
.tax-ctl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tax-ctl .seg { margin-top: 0; max-width: 100%; overflow-x: auto; }
.tax-ctl .seg button { padding: 7px 12px; }
table.tx { border-collapse: collapse; width: 100%; font-size: 13px; }
.tx th, .tx td { padding: 8px 10px; text-align: right; white-space: nowrap; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: middle; }
.tx thead th { border-top: 0; font-weight: 500; color: var(--muted); font-size: 12px; padding-top: 0; }
.tx th[scope=row], .tx thead th:first-child { text-align: left; padding-left: 0; font-weight: 600; color: var(--ink); }
.tx thead th:first-child { font-weight: 500; color: var(--muted); }
.tx th:last-child, .tx td:last-child { padding-right: 0; }
.tx tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); color: var(--ink); }
.tx tfoot td:first-child { text-align: left; padding-left: 0; color: var(--muted); font-weight: 500; }
.tx-wrap, .card .tscroll { margin-top: 12px; }
.tx-body > .section-head { margin-top: 22px; }
.notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.notes li { margin: 4px 0; }
.notes li::marker { color: var(--faint); }

/* movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.no-motion *, .no-motion *::before, .no-motion *::after { animation: none !important; transition: none !important; }

/* Diario */
.dot-c { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.seg.small button { padding: 4px 9px; font-size: 12px; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl small { font-size: 11px; opacity: .8; }

/* escritorio: barra lateral y rejilla de dos columnas */
@media (min-width: 1024px) {
  #tabs { left: 0; right: auto; top: 0; bottom: 0; width: var(--side-w); display: flex; flex-direction: column; gap: 4px; padding: 26px 16px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: rgba(8,11,15,.72); box-shadow: none; }
  .brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 26px; font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.04em; color: var(--ink); }
  .brand img { width: 34px; height: 34px; border-radius: 11px; box-shadow: 0 8px 22px -6px rgba(198,244,50,.5); }
  .tab-ind { display: none; }
  #tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 0 14px; font-size: 14px; font-weight: 550; border-radius: 14px; }
  #tabs a:hover { color: var(--ink); background: var(--surface); }
  #tabs a.active { color: var(--accent-ink); background: var(--accent); box-shadow: 0 10px 26px -10px rgba(198,244,50,.55); }
  #tabs a svg { width: 20px; height: 20px; }
  #tabs::after { content: "100 € a la semana, sin prisa"; margin-top: auto; padding: 14px; border-radius: 16px; font-size: 12.5px; line-height: 1.4; color: var(--muted); background: linear-gradient(160deg, rgba(139,124,255,.14), rgba(198,244,50,.06)); border: 1px solid var(--line); }
  body.has-tabs #app { margin-left: var(--side-w); max-width: none; padding: 34px clamp(28px, 4vw, 64px) 56px; }
  body.has-tabs .view { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  body.has-tabs .view > * { grid-column: 1 / -1; margin: 0 !important; }
  body.has-tabs .view > .grid-2 { display: contents; }
  body.has-tabs .view > .grid-2 > * { grid-column: auto; margin: 0 !important; }
  body.has-tabs .view > .top { padding: 0 2px 6px; }
  h1 { font-size: 40px; }
  .hero-num { font-size: 64px; }
  .kpis { grid-template-columns: repeat(6, 1fr); gap: 14px; }
  .kpi-v { font-size: 19px; }
  .feed { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; padding: 8px 22px; }
  .feed-item:nth-child(2) { border-top: 0; }
  body.mock::before { bottom: 18px; right: 22px; }
  #app[data-view="settings"] .view > section.card, #app[data-view="market"] .view > section.card { grid-column: auto; }
  #app[data-view="week"] .view > .hero-gold { grid-column: 1; grid-row: span 2; position: sticky; top: 28px; }
  #app[data-view="week"] .view > section:not(.hero-gold) { grid-column: 2; }
  #app[data-view="login"] { margin-left: 0; }
}

/* meta de patrimonio (Inicio) */
.goal-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.goal-num { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.04em; }
.goal-num small { font-family: var(--font-text); font-size: 13px; letter-spacing: 0; font-weight: 500; }
.goal-pct { color: var(--accent); font-size: 15px; }
.goal-bar { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 12px 0 2px; }
.goal-bar i { display: block; height: 100%; min-width: 12px; border-radius: 99px; background: linear-gradient(90deg, var(--cool), var(--accent)); box-shadow: 0 0 18px rgba(198,244,50,.45); transition: width 1s var(--ease); }
