/* Shared visual system: Finanzas + Inversión Pro. */
:root {
  color-scheme: dark;
  --bg: #0c1017; --bg-2: #0c1017; --surface: #131a24; --surface-2: #1a2330; --surface-3: #101720;
  --text: #ecf1f8; --muted: #99a8bc; --faint: #8a9bb1;
  --line: #293444; --line-soft: #222d3c; --cyan: #6ccbc8; --accent-strong: #236c70;
  --ok: #72d5aa; --danger: #f18b98; --pink: #c49bc8; --gold: #ddba76; --lime: #abc58c; --blue: #89aef0;
  --shadow: 0 3px 16px #0000000c; --radius: 14px; --gap: 20px; --rail: 248px;
  --bg-base-rgb: 12 16 23; --bg-card-rgb: 19 26 36; --bg-elevated-rgb: 26 35 48;
  --border-rgb: 41 52 68; --text-main-rgb: 236 241 248; --text-muted-rgb: 153 168 188;
}
html[data-theme='light'], body.pro-light {
  color-scheme: light;
  --bg: #f3f5f7; --bg-2: #f3f5f7; --surface: #fff; --surface-2: #edf1f5; --surface-3: #f7f9fb;
  --text: #172535; --muted: #56677b; --faint: #617187; --line: #d9e1e9; --line-soft: #e4e9ef;
  --cyan: #147674; --accent-strong: #155e63; --ok: #18774d; --danger: #bd3b50; --pink: #935796;
  --gold: #99711f; --lime: #597a30; --blue: #345fa5; --shadow: 0 3px 16px #17253506;
  --bg-base-rgb: 243 245 247; --bg-card-rgb: 255 255 255; --bg-elevated-rgb: 237 241 245;
  --border-rgb: 217 225 233; --text-main-rgb: 23 37 53; --text-muted-rgb: 86 103 123;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body, body.quant-page { margin: 0; background: var(--bg); color: var(--text); font-family: 'Manrope', sans-serif; font-size: 14px; line-height: 1.5; }
body.quant-page::before { display: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
[x-cloak] { display: none !important; }
.mono, .font-mono { font-family: 'IBM Plex Mono', monospace !important; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 500; padding: 12px 20px; background: var(--cyan); color: var(--bg); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.quant-shell { display: grid; grid-template-columns: var(--rail) minmax(0,1fr); min-height: 100dvh; }
.quant-shell.is-compact { --rail: 80px; }
.quant-sidebar, body.pro-light .quant-sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 0; padding: 26px 16px 18px; background: var(--surface-3); border-right: 1px solid var(--line); box-shadow: none; z-index: 120; overflow-y: auto; scrollbar-width: thin; }
.workspace-brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 24px; min-height: 62px; }
.workspace-brand img { width: 30px; height: 30px; object-fit: contain; }
html[data-theme='light'] .workspace-brand img { filter: brightness(.2); }
.workspace-brand strong { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.6px; }
.workspace-brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.workspace-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 3px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 25px; }
.workspace-switch a { text-align: center; font-size: 11px; font-weight: 700; padding: 8px 3px; border-radius: 5px; color: var(--muted); }
.workspace-switch a.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 3px #0001; }
.nav-caption { font-size: 10px; font-weight: 700; color: var(--faint); letter-spacing: .12em; text-transform: uppercase; margin: 0 12px 10px; }
.quant-nav { display: flex; flex-direction: column; gap: 4px; overflow: visible; padding: 0; }
.nav-node { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); background: transparent; text-align: left; transition: background .15s, color .15s; }
.nav-node svg, .nav-node i { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.6; }
.nav-node:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.nav-node.active { color: var(--cyan); background: color-mix(in srgb,var(--cyan) 10%,transparent); border-color: transparent; box-shadow: none; }
.nav-node.active::after { content: ''; margin-left: auto; width: 4px; height: 16px; background: var(--cyan); border-radius: 4px; }
.nav-divider { border: 0; border-top: 1px solid var(--line); margin: 20px 12px; }
.sidebar-tools { display: grid; gap: 12px; margin-top: auto; padding-top: 25px; }
.sidebar-data { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; font-size: 11px; color: var(--muted); }
.sidebar-data strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 6px; }
.sidebar-data p { display: flex; justify-content: space-between; gap: 12px; margin: 3px 0; }
.sidebar-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 10px 0; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }
.sidebar-footer strong { display: block; color: var(--text); font-size: 12px; }
.dual-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 8px; }
.dual-switch .seg-btn { border: 0; min-height: 32px; border-radius: 5px; }
.quant-shell.is-compact .workspace-brand .brand-copy, .quant-shell.is-compact .workspace-switch, .quant-shell.is-compact .nav-caption, .quant-shell.is-compact .sidebar-tools { display: none; }
.quant-shell.is-compact .workspace-brand { padding: 0 0 24px; justify-content: center; }
.quant-shell.is-compact .nav-node { display: flex; justify-content: center; padding: 10px; }
.quant-shell.is-compact .nav-node.active::after { display: none; }
.workspace-body { min-width: 0; }
.workspace-topbar { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 14px 32px; background: var(--bg); border-bottom: 1px solid var(--line-soft); z-index: 100; }
.workspace-crumb { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
.workspace-crumb b { font-weight: 600; color: var(--text); }
.workspace-actions { display: flex; align-items: center; gap: 12px; }
.private-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.private-label svg { width: 13px; height: 13px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; min-height: 34px; flex: 0 0 34px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--surface); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.quant-main, .finance-main { width: 100%; max-width: 1640px; margin: 0 auto; padding: 30px 32px 64px; min-width: 0; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 26px; }
.page-heading h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -1px; font-weight: 750; color: var(--text); }
.page-heading p { margin: 7px 0 0; font-size: 12px; color: var(--muted); }
.action-btn, .seg-btn { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 34px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 650; box-shadow: none; white-space: nowrap; text-decoration: none; }
.action-btn svg { width: 15px; height: 15px; }
.seg-btn svg { width: 14px; height: 14px; }
.action-btn.primary { background: var(--cyan); border-color: var(--cyan); color: #0b2429; }
html[data-theme='light'] .action-btn.primary { color: #fff; }
.seg-btn.active { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.seg-btn:hover, .action-btn:hover { filter: brightness(1.12); }
.eyebrow { font-size: 10px; font-weight: 650; letter-spacing: .065em; color: var(--muted); text-transform: uppercase; }
.portfolio-head, .metric-tile, .data-module, .asset-row, .trade-row { background: var(--surface); backdrop-filter: none; border-color: var(--line); box-shadow: none; }
.portfolio-head { padding: 28px; min-height: 220px; background: var(--surface); border-radius: 14px; }
.portfolio-head::after { display: none; }
.portfolio-dashboard { grid-template-columns: minmax(0,1fr) minmax(390px,1fr); gap: 28px; min-height: 168px; }
.portfolio-hero { border-right: 1px solid var(--line); padding-right: 24px; }
.mega-value { font-family: 'Manrope',sans-serif !important; font-size: clamp(36px,4.2vw,62px); font-weight: 700; line-height: 1.15; letter-spacing: -2.5px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.portfolio-stat { background: transparent !important; padding: 4px 8px; min-height: 72px; border: 0; border-radius: 0; }
.portfolio-stat strong { font-size: clamp(17px,1.7vw,25px); font-weight: 500; line-height: 1.25; }
.portfolio-stat span { font-size: 10px; font-weight: 500; }
.status-pill { min-height: 25px; padding: 0 8px; font-size: 10px; font-weight: 500; border-radius: 5px; background: var(--surface-2); }
.metric-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.metric-tile { border-radius: 10px; min-height: 96px; padding: 18px; }
.metric-value { font-size: clamp(18px,1.65vw,25px); font-weight: 500; }
.metric-sub { font-size: 10px; font-weight: 500; margin-top: 6px; }
.data-module { padding: 22px; border-radius: 14px; }
.module-head { align-items: center; min-height: 40px; margin-bottom: 18px; flex-wrap: wrap; }
.module-head h2 { margin-top: 4px; font-size: 16px; font-weight: 700; line-height: 1.4; letter-spacing: -.35px; }
.module-head .eyebrow { font-size: 9px; }
.sector { scroll-margin-top: 96px; }
.sector + .sector { margin-top: 20px; }
.chart-tall { height: 340px; }
.table-shell { overflow-x: auto; scrollbar-width: thin; }
.table-shell table { min-width: 620px; }
thead { color: var(--muted); background: var(--surface-3); }
th { font-size: 10px; font-weight: 650; }
td { font-size: 12px; }
.trade-row, .asset-row { border-radius: 8px; background: transparent; box-shadow: none; }
.trade-row:hover, .asset-row:hover { background: var(--surface-2); }
.mini-cell { background: var(--surface-3); border: 1px solid var(--line-soft); border-radius: 8px; }
.mini-cell strong { font-size: 18px; }
.search-field, .select-field { background: var(--surface-3); border: 1px solid var(--line); color: var(--text); border-radius: 8px; max-width: 100%; }
.search-field::placeholder { color: var(--muted); }
.positive { color: var(--ok); } .negative { color: var(--danger); }
.freshness-bar { display: flex; gap: 10px 24px; flex-wrap: wrap; margin: 16px 0 24px; color: var(--muted); font-size: 11px; }
.freshness-bar span { display: inline-flex; align-items: center; gap: 7px; }
.freshness-bar svg { width: 14px; height: 14px; }
.notice { padding: 13px 16px; margin: 16px 0; border: 1px solid var(--line); border-left: 3px solid var(--gold); background: var(--surface); border-radius: 8px; color: var(--muted); font-size: 12px; }
.recent-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 18px 0 24px; }
.recent-order { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-align: left; color: var(--text); }
.recent-order:hover { border-color: var(--cyan); }
.recent-order strong { display: block; font-size: 13px; margin: 8px 0; }
.recent-order small { display: block; color: var(--muted); font-size: 10px; }
.recent-order .order-side { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 24px 0 0; }
.section-heading h2 { font-size: 13px; font-weight: 650; margin: 0; }
.leverage-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin: 18px 0; }
.leverage-card { padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-3); }
.leverage-card header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.leverage-card h3 { font-size: 15px; }
.leverage-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; }
.leverage-card dt { font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.leverage-card dd { font-size: 16px; margin: 0; }
.mobile-backdrop { display: none; }
.loader-shell,.error-shell { min-height: 60dvh; }
.pulse-line { height: 3px; background: linear-gradient(90deg,var(--surface-2),var(--cyan),var(--surface-2)); background-size: 200% 100%; }
.empty-note { padding: 32px 16px; text-align: center; color: var(--muted); }
/* Finance screens use the same tokens with their existing data bindings. */
.finance-main .text-white { color: var(--text); }
.finance-main .text-slate-900 { color: var(--bg); }
.finance-main [class*='shadow-'], .finance-main [class*='drop-shadow-'] { box-shadow: none !important; filter: none; }
.finance-main .glass-border { border: 1px solid var(--line) !important; background: var(--surface) !important; border-radius: 12px !important; }
.finance-main .glass-border::after { display: none; }
.finance-main .absolute[class*='blur-'], .finance-main .absolute[class*='rounded-full'], .finance-main .absolute.opacity-10 { display: none; }
.finance-main [class*='bg-gradient-'] { background-image: none !important; background-color: var(--surface-2); }
.finance-main .bg-clip-text { color: var(--text); -webkit-text-fill-color: var(--text); }
.finance-main [class*='border-white'] { border-color: var(--line); }
.finance-main [class*='bg-white'] { background-color: var(--surface-2); }
.finance-main [class*='text-purple'], .finance-main [class*='text-indigo'], .finance-main [class*='text-pink'] { color: var(--cyan); }
.finance-main [class*='bg-purple'], .finance-main [class*='bg-indigo'], .finance-main [class*='bg-pink'] { background-color: var(--surface-2); }
.finance-main .font-black, .finance-main .font-extrabold { font-weight: 700; }
.finance-main .tracking-widest { letter-spacing: .055em; }
.finance-main .text-3xl { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.8px; }
.finance-main .text-lg { font-size: 16px; }
.finance-main .rounded-2xl { border-radius: 14px; }
.finance-main .gap-8 { gap: 20px; }
.finance-main .mb-8 { margin-bottom: 20px; }
.finance-main input,.finance-main select { color: var(--text); background: var(--surface-3); border-color: var(--line); min-height: 36px; }
.finance-main thead { background: var(--surface-3) !important; color: var(--muted) !important; }
.finance-main td,.finance-main th { font-size: 12px; }
.finance-main .text-emerald-400 { color: var(--ok); } .finance-main .text-red-400 { color: var(--danger); }
.finance-main .date-popover { width: min(570px,calc(100vw - 32px)); z-index: 150; }
.finance-summary { display: grid; grid-template-columns: 1.4fr repeat(3,1fr); gap: 16px; margin-bottom: 22px; }
.finance-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; min-width: 0; }
.finance-kpi.primary { border-top: 2px solid var(--cyan); }
.finance-kpi p { margin: 0 0 18px; font-size: 11px; color: var(--muted); }
.finance-kpi strong { display: block; font-size: clamp(22px,2.3vw,32px); font-weight: 650; letter-spacing: -.8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.finance-kpi small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.finance-error { color: var(--danger); }
.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.login-card { width: min(440px,100%); padding: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: 18px; }
.login-card h1 { font-size: 30px; letter-spacing: -1px; margin: 24px 0 10px; }
.login-card p { color: var(--muted); line-height: 1.7; }
.login-card .action-btn { width: 100%; margin: 24px 0; padding: 13px; font-size: 13px; }
.login-foot { font-size: 11px; color: var(--muted); padding-top: 20px; border-top: 1px solid var(--line); }
.apexcharts-tooltip { border-color: var(--line) !important; }
.quant-ring { filter: none !important; }
.ring-label { fill: #15212c; stroke: none !important; paint-order: normal; font-size: 10px; font-weight: 700; }
.ring-callout-text { stroke: none !important; paint-order: normal; font-size: 11px; font-weight: 650; fill: var(--text); }
.allocation-readout { background: var(--surface-3); }
.dual-switch .seg-btn { min-width: 0; padding: 6px 8px; }
.finance-main [class*='text-emerald-100'],.finance-main [class*='text-purple-100'],.finance-main [class*='text-pink-100'] { color: var(--text); }
.chart-empty { display: grid; place-items: center; min-height: 260px; text-align: center; color: var(--muted); font-size: 12px; border: 1px dashed var(--line); border-radius: 8px; }
.finance-main .text-red-100 { color: var(--text); }
.finance-main .glass-border { min-width: 0; }
.finance-main .labeling-toolbar input { max-width: 100%; flex: 1 1 200px; }
.finance-main .labeling-toolbar select { max-width: 100%; }
.finance-main .glass-border > .flex.justify-between { flex-wrap: wrap; gap: 12px; }
.finance-main [class*='animate-ping'] { display: none; }
.external-charts { display:grid; gap:12px; margin:20px 0; padding:16px; border:1px solid var(--line); border-radius:10px; background:var(--surface-3); }
.external-charts p { margin:3px 0; font-size:11px; }
.external-charts small { font-size:10px; line-height:1.6; }
.external-charts .control-line { justify-content:flex-start; }
.position-facts { display:flex; flex-wrap:wrap; gap:8px 20px; margin:18px 0; color:var(--muted); font-size:11px; }
.position-facts b { color:var(--text); font-weight:600; }
.execution-table small { display:block; margin-top:5px; font-size:10px; }
.cycle-period { font-size:11px; margin:18px 0 12px; }
.cycle-exits, .cycle-history, .closed-cycles { border-top:1px solid var(--line); margin-top:18px; padding-top:14px; }
.cycle-exit { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0; font-size:12px; border-bottom:1px solid var(--line-soft); }
.cycle-exit small { display:block; margin-top:3px; font-size:10px; }
.cycle-exit .mono { white-space:nowrap; }
.cycle-history summary { cursor:pointer; color:var(--muted); font-size:11px; }
.leverage-card dl small { display:block; margin-top:4px; font-size:10px; }
.order-detail { border-bottom:1px solid var(--line); }
.order-detail summary { cursor:pointer; list-style:none; }
.order-detail summary::-webkit-details-marker { display:none; }
.order-detail[open] .trade-row { background:var(--surface-2); }
.order-facts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; padding:16px; margin:0; background:var(--surface-3); border-radius:8px; }
.order-facts dt { font-size:10px; color:var(--muted); }
.order-facts dd { font-size:12px; margin:4px 0 0; overflow-wrap:anywhere; }
@media(min-width:1600px) { .quant-main,.finance-main { padding: 36px 44px 64px; } }
@media(max-width:1200px) {
 .portfolio-dashboard { grid-template-columns: 1fr; gap: 22px; } .portfolio-hero { border-right: 0; padding-right: 0; }
 .portfolio-stat-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } .portfolio-stat { min-height: 64px; padding: 0; }
 .finance-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .recent-strip { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:900px) {
 .quant-shell, .quant-shell.is-compact { display: block; }
 .quant-sidebar { position: fixed; left: -270px; width: 248px; transition: left .2s; padding: 20px 16px; }
 .quant-shell.mobile-open .quant-sidebar { left: 0; }
 .quant-shell.mobile-open .mobile-backdrop { display: block; position: fixed; inset: 0; background: #0008; z-index: 110; border: 0; }
 .quant-shell.is-compact .workspace-switch { display: grid; }
 .quant-shell.is-compact .brand-copy,.quant-shell.is-compact .nav-caption,.quant-shell.is-compact .nav-node span { display: block; }
 .quant-shell.is-compact .sidebar-tools { display: grid; }
 .quant-shell.is-compact .workspace-brand { justify-content: flex-start; }
 .quant-shell.is-compact .nav-node { justify-content: flex-start; }
 .workspace-topbar { padding: 12px 20px; min-height: 62px; }
 .quant-main,.finance-main { padding: 24px 20px 48px; }
 .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .leverage-cards { grid-template-columns: 1fr; }
}
@media(max-width:600px) {
 .workspace-topbar { padding: 10px 16px; } .workspace-crumb { gap: 9px; font-size: 11px; } .private-label { display: none; }
 .quant-main,.finance-main { padding: 24px 16px 48px; }
 .page-heading { align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
 .page-heading h1 { font-size: 25px; } .page-heading p { font-size: 11px; max-width: 280px; }
 .portfolio-head { padding: 20px; } .mega-value { font-size: 42px; letter-spacing: -2px; }
 .portfolio-stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
 .portfolio-stat strong { font-size: 19px; } .data-module { padding: 16px; }
 .finance-summary { gap: 10px; } .finance-kpi { padding: 17px 14px; }
 .finance-kpi strong { font-size: 22px; } .finance-kpi p { margin-bottom: 12px; font-size: 10px; }
 .recent-strip { gap: 10px; } .recent-order { padding: 13px; } .recent-order strong { font-size: 12px; }
 .recent-order .order-side { flex-wrap: wrap; gap: 2px; }
 .finance-main .p-6 { padding: 16px; } .finance-main .date-popover { position: fixed; top: 150px; right: 16px; max-height: calc(100dvh - 170px); overflow-y: auto; }
 .module-head .control-line { justify-content: flex-start; } .control-line { gap: 4px; }
 .seg-btn { padding: 7px 9px; } .freshness-bar { font-size: 10px; gap: 8px 14px; }
 .login-card { padding: 28px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto !important; animation:none !important; transition:none !important; } }
