/* Mar Cripto Terminal — sistema visual
   Terminal de riesgo: navy profundo, azules de marca para estructura, ámbar del pixel-A para acentos.
   Lexend (geométrica, cercana al logo) para títulos; IBM Plex Sans para texto; IBM Plex Mono para cifras. */
:root {
  --bg: #050f1c; --bg2: #081627; --panel: #0b1b30; --panel2: #10243e; --line: #1a3352; --line2: #234266;
  --fg: #e7f0fa; --fg2: #b9c9da; --muted: #8197ae;
  --deep: #075296; --blue: #0e88e2; --neon: #1fd0ff; --grey: #666666; --amber: #e09a31; --burnt: #bf760a;
  --accent: #1fd0ff; --good: #2bd99f; --warn: #e09a31; --bad: #ff5d6e;
  --goodbg: rgba(43, 217, 159, .12); --warnbg: rgba(224, 154, 49, .14); --badbg: rgba(255, 93, 110, .13); --bluebg: rgba(14, 136, 226, .14);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --f-display: "Lexend", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --side: 248px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef3f9; --bg2: #e6edf6; --panel: #ffffff; --panel2: #f1f6fb; --line: #d5e1ed; --line2: #c3d3e4;
  --fg: #0a1d31; --fg2: #33475c; --muted: #5d6e80;
  --accent: #0b74c4; --neon: #0e88e2; --amber: #bf760a; --burnt: #9c5f06;
  --good: #0c8f63; --warn: #b06c08; --bad: #cf3343;
  --goodbg: rgba(12, 143, 99, .1); --warnbg: rgba(191, 118, 10, .11); --badbg: rgba(207, 51, 67, .09); --bluebg: rgba(14, 136, 226, .1);
  --shadow: 0 10px 30px rgba(16, 40, 70, .12);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 14.5px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
p { margin: 0; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--good); } .neg { color: var(--bad); } .mut { color: var(--muted); } .amb { color: var(--amber); }
.small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-brand { background: radial-gradient(1200px 600px at 10% 10%, rgba(14, 136, 226, .25), transparent 60%), linear-gradient(160deg, #041325, #072b52 70%, #075296); padding: 48px max(32px, 6vw); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; color: #e7f0fa; position: relative; overflow: hidden; }
.auth-brand img { width: 210px; height: auto; }
.auth-brand h1 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.12; max-width: 16ch; color: #fff; }
.auth-brand .lead { color: #b9d3ec; max-width: 46ch; font-size: 16px; margin-top: 14px; }
.auth-points { display: grid; gap: 12px; max-width: 520px; }
.auth-points div { display: flex; gap: 12px; align-items: baseline; color: #d5e6f7; }
.auth-points b { font: 600 12px var(--f-mono); color: var(--amber); min-width: 28px; }
.pixel-bg { position: absolute; right: -40px; bottom: -40px; width: 340px; opacity: .14; pointer-events: none; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h2 { font-size: 22px; }
.auth-foot { color: var(--muted); font-size: 12px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 18px; overflow-y: auto; z-index: 30; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 2px 6px 8px; }
.side .logo img { height: 46px; width: auto; }
.logo-l { display: none; } :root[data-theme="light"] .logo-d { display: none; } :root[data-theme="light"] .logo-l { display: block; }
.nav { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group > span { font: 600 10.5px var(--f-display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 0 10px 4px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--fg2); text-decoration: none; font: 500 14px var(--f-body); position: relative; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--panel); color: var(--fg); }
.nav a[aria-current="page"] { background: var(--panel2); color: var(--fg); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; position: sticky; bottom: -18px; background: var(--bg2); padding: 10px 0 18px; }
.quote-mini { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--panel); font-size: 12.5px; color: var(--fg2); }
.quote-mini b { display: block; font: 600 10px var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); margin-bottom: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 14px; padding: 10px 24px; min-height: 58px; }
.menu-btn { display: none; }
.tickers { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tickers::-webkit-scrollbar { display: none; }
.tk { display: flex; gap: 7px; align-items: baseline; white-space: nowrap; font: 500 12.5px var(--f-mono); }
.tk b { font: 600 12px var(--f-display); color: var(--fg2); }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-btn { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; font: 500 13px var(--f-body); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--deep), var(--blue)); color: #fff; display: grid; place-items: center; font: 600 12px var(--f-display); }
.dropdown { position: absolute; right: 24px; top: 54px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 230px; padding: 6px; display: flex; flex-direction: column; z-index: 50; }
.dropdown button, .dropdown a { all: unset; padding: 9px 12px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--fg); }
.dropdown button:hover, .dropdown a:hover { background: var(--panel2); }
.dropdown .dd-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }

.page { padding: 24px 24px 64px; max-width: 1320px; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .lede { color: var(--muted); max-width: 72ch; margin-top: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- paneles ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.span2 { grid-column: span 2; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kpis > div { background: var(--panel); box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kpis span { font: 600 10.5px var(--f-display); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.kpis b { font: 600 18px var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.stat-big { font: 700 34px var(--f-display); line-height: 1; letter-spacing: -.02em; }

/* ---------- controles ---------- */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
label.f { display: flex; flex-direction: column; gap: 5px; font: 600 11px var(--f-display); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); min-width: 0; }
label.f small { text-transform: none; letter-spacing: 0; font: 400 11.5px var(--f-body); color: var(--muted); }
input, select, textarea { font: 500 14px var(--f-mono); color: var(--fg); background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 10px; width: 100%; min-width: 0; }
input[type="email"], input[type="password"], input[type="text"].txt, textarea.txt { font-family: var(--f-body); }
textarea { min-height: 120px; font-size: 12.5px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--bluebg); }
button, .btn { font: 600 13px var(--f-display); letter-spacing: .01em; cursor: pointer; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); color: var(--fg); padding: 9px 14px; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--blue); }
.btn-pri { background: var(--deep); border-color: var(--blue); color: #fff; }
.btn-pri:hover { background: var(--blue); }
.btn-amb { background: transparent; border-color: var(--amber); color: var(--amber); }
.btn-amb:hover { background: var(--warnbg); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 8px 14px; }
.seg button[aria-pressed="true"] { background: var(--panel2); color: var(--fg); box-shadow: inset 0 -2px 0 var(--amber); }
.seg button.long[aria-pressed="true"] { color: var(--good); box-shadow: inset 0 -2px 0 var(--good); }
.seg button.short[aria-pressed="true"] { color: var(--bad); box-shadow: inset 0 -2px 0 var(--bad); }

/* ---------- chips, veredictos ---------- */
.chip { font: 700 10px var(--f-display); letter-spacing: .07em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; white-space: nowrap; display: inline-block; }
.c-pass { background: var(--goodbg); color: var(--good); } .c-warn { background: var(--warnbg); color: var(--warn); } .c-fail { background: var(--badbg); color: var(--bad); }
.c-info { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); } .c-blue { background: var(--bluebg); color: var(--accent); }
.c-pro { border: 1px solid var(--amber); color: var(--amber); background: transparent; }
.badge { font: 700 9.5px var(--f-display); letter-spacing: .08em; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--amber); color: var(--amber); }
.verdict { border-radius: 10px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; border: 1px solid; flex-wrap: wrap; }
.verdict .big { font: 700 19px var(--f-display); letter-spacing: .05em; }
.verdict p { color: var(--fg); font-size: 13.5px; flex: 1; min-width: 200px; }
.v-pass { background: var(--goodbg); border-color: var(--good); color: var(--good); }
.v-warn { background: var(--warnbg); border-color: var(--warn); color: var(--warn); }
.v-fail { background: var(--badbg); border-color: var(--bad); color: var(--bad); }
ul.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ul.rules li { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 7px; background: var(--panel2); font-size: 13.5px; }
.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 11px 14px; border-radius: 10px; border: 1px dashed var(--amber); background: var(--warnbg); font-size: 13.5px; }
.banner.info { border-color: var(--blue); background: var(--bluebg); }

/* ---------- tablas ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { font: 600 10.5px var(--f-display); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 9px 11px; background: var(--panel2); white-space: nowrap; position: sticky; top: 0; }
td { padding: 8px 11px; border-top: 1px solid var(--line); white-space: nowrap; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
td.l { font-family: var(--f-body); }
td.wrap { white-space: normal; min-width: 180px; }
td.r, th.r { text-align: right; }
tr.flagged td:first-child { box-shadow: inset 3px 0 var(--bad); }
tbody tr:hover td { background: color-mix(in srgb, var(--panel2) 60%, transparent); }
.flags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- gráficos ---------- */
.svgchart { width: 100%; height: auto; display: block; }
canvas.chart { width: 100%; display: block; border-radius: 8px; }
.tv { width: 100%; height: 360px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 96px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 16px; background: var(--panel2); border-radius: 3px; position: relative; overflow: hidden; }
.bar .fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.heat td { text-align: center; }
.cal { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; }
.cal i { aspect-ratio: 1; border-radius: 3px; background: var(--panel2); border: 1px solid var(--line); }
.cal i.on { background: var(--blue); border-color: var(--blue); }
.meter { height: 8px; border-radius: 4px; background: var(--panel2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); min-width: 0; }
.tile span { font: 600 10.5px var(--f-display); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.tile b { font: 600 18px var(--f-mono); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

/* ---------- posiciones ---------- */
.pos-card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; overflow: hidden; }
.pos-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pos-card header h2 { font-size: 19px; display: flex; gap: 10px; align-items: center; }
.pos-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.pos-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel2); }
.rangebar { position: relative; height: 34px; }
.rangebar .rb-track { position: absolute; left: 0; right: 0; top: 15px; height: 4px; border-radius: 2px; background: var(--line2); }
.rangebar .rb-mark { position: absolute; top: 6px; width: 2px; height: 22px; transform: translateX(-1px); }
.rangebar .rb-lab { position: absolute; top: -2px; transform: translateX(-50%); font: 500 10.5px var(--f-mono); color: var(--muted); white-space: nowrap; }

/* ---------- textos ---------- */
.finding { border-left: 3px solid var(--line); padding: 4px 0 4px 14px; display: flex; flex-direction: column; gap: 4px; }
.finding.sev-fail { border-color: var(--bad); } .finding.sev-warn { border-color: var(--warn); } .finding.sev-pass { border-color: var(--good); }
.finding h4 { font-size: 15px; font-weight: 600; }
.finding p { max-width: 78ch; font-size: 14px; color: var(--fg2); }
.quote-card { border-radius: 12px; padding: 18px 20px; background: linear-gradient(135deg, var(--panel2), var(--panel)); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.quote-card q { font: 500 18px/1.45 var(--f-display); quotes: none; color: var(--fg); max-width: 60ch; }
.quote-card .qk { font: 600 10.5px var(--f-display); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.quote-card .px { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); width: 70px; opacity: .18; }
.coach-out { white-space: pre-wrap; font-size: 14.5px; line-height: 1.65; max-width: 82ch; }
.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.term { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--panel); }
.term .cat { font: 600 10px var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.term h4 { font-size: 15px; }
.term p { font-size: 13.5px; color: var(--fg2); }
.term code { font: 500 12px var(--f-mono); background: var(--panel2); border-radius: 5px; padding: 4px 7px; white-space: normal; }
.locked { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 28px; border: 1px dashed var(--amber); border-radius: 12px; background: var(--warnbg); }
.empty { padding: 28px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---------- modal, toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(2, 8, 16, .66); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; }
.modal.wide { max-width: 860px; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal .m-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal footer { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.x { border: 0; background: transparent; font-size: 20px; padding: 4px 10px; color: var(--muted); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; background: var(--panel2); border: 1px solid var(--blue); color: var(--fg); padding: 10px 18px; border-radius: 9px; font-size: 13.5px; z-index: 90; box-shadow: var(--shadow); }
.toast.err { border-color: var(--bad); }
.skeleton { background: linear-gradient(90deg, var(--panel2), var(--line), var(--panel2)); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: 6px; min-height: 16px; }
@keyframes sk { to { background-position: -200% 0; } }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); display: inline-block; box-shadow: 0 0 0 3px var(--goodbg); }
.live-dot.off { background: var(--muted); box-shadow: none; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .g2, .g3, .g4, .g-21, .g-12 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .top-in, .page { padding-left: 16px; padding-right: 16px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: 32px 20px; }
  .auth-points { display: none; }
  .bar { grid-template-columns: minmax(0, 1fr) 88px; } .bar .track { grid-column: 1 / -1; order: 3; }
  .user-btn .uname { display: none; }
  .dropdown { right: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- ecosistema Mar: dorado, velas, pie de marca ---------- */
:root { --gold: #e09a31; --gold2: #bf760a; --goldgrad: linear-gradient(100deg, #f3c26b, #e09a31 45%, #bf760a); --holding: #9544e2; }
:root[data-theme="light"] { --gold: #bf760a; --holding: #7b2fcf; }
.page-head h1 { position: relative; padding-bottom: 8px; }
.page-head h1::after { content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 3px; border-radius: 3px; background: var(--goldgrad); }
.side { box-shadow: inset 0 2px 0 var(--gold); }
.nav a[aria-current="page"] { box-shadow: inset 2px 0 0 var(--gold); }
.chip.c-pro { background: var(--goldgrad); color: #1b1203; border-color: transparent; font-weight: 700; }
.btn-amb { background: var(--goldgrad) !important; color: #1b1203 !important; border-color: transparent !important; font-weight: 600; }
.btn-amb:hover { filter: brightness(1.08); }
.quote-card { position: relative; overflow: hidden; }
.quote-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--goldgrad); }

/* velas animadas */
.auth-candles { position: absolute; inset: auto 0 0 0; width: 100%; height: 34%; opacity: .55; pointer-events: none; -webkit-mask-image: linear-gradient(to top, #000 30%, transparent); mask-image: linear-gradient(to top, #000 30%, transparent); }
.auth-brand > *:not(canvas):not(.pixel-bg) { position: relative; z-index: 1; }
.auth-quote { margin: 0; border-left: 3px solid var(--gold); padding: 8px 12px; background: var(--panel); border-radius: 0 8px 8px 0; font-size: 13px; color: var(--fg2); }
.auth-quote span { display: block; font: 600 10px var(--f-display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.auth-form { flex-direction: column; gap: 24px; }
.auth-form .site-foot { width: 100%; max-width: 520px; border: 0; padding: 0; justify-content: center; text-align: center; }
.brand-head { position: relative; overflow: hidden; border-radius: 14px; padding: 18px 20px; background: linear-gradient(120deg, rgba(7, 82, 150, .35), transparent 70%); border: 1px solid var(--line); }
.brand-head > canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; -webkit-mask-image: linear-gradient(to left, #000, transparent 75%); mask-image: linear-gradient(to left, #000, transparent 75%); }
.brand-head > *:not(canvas) { position: relative; }
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; position: relative; overflow: hidden; background: radial-gradient(800px 400px at 50% 40%, rgba(14, 136, 226, .18), transparent 70%), var(--bg); }
.boot canvas { position: absolute; inset: auto 0 0 0; width: 100%; height: 40%; opacity: .35; -webkit-mask-image: linear-gradient(to top, #000, transparent); mask-image: linear-gradient(to top, #000, transparent); }
.boot img, .boot .cload { position: relative; }
.cload { display: inline-flex; align-items: flex-end; gap: 5px; height: 34px; color: var(--muted); font-size: 12px; }
.cload i { width: 6px; border-radius: 1.5px; background: var(--neon); position: relative; animation: cl 1.1s ease-in-out infinite; }
.cload i::before { content: ""; position: absolute; left: 2.5px; top: -6px; bottom: -6px; width: 1px; background: currentColor; opacity: .5; }
.cload i:nth-child(2) { background: var(--gold); animation-delay: .12s; } .cload i:nth-child(3) { animation-delay: .24s; } .cload i:nth-child(4) { background: var(--gold); animation-delay: .36s; } .cload i:nth-child(5) { animation-delay: .48s; }
.cload span { margin-left: 10px; align-self: center; }
@keyframes cl { 0%, 100% { height: 8px; transform: translateY(-4px); } 50% { height: 26px; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .cload i { animation: none; height: 16px; } }

/* pie de marca */
.site-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 18px 24px 26px; margin-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--fg2); }
.sf-brand { display: flex; align-items: center; gap: 8px; } .sf-brand span:first-of-type { font-family: var(--f-display); font-weight: 600; color: var(--fg); }
.sf-social { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; } .sf-social a { color: var(--fg2); text-decoration: none; } .sf-social a:hover { color: var(--gold); }
.powered { color: var(--holding); text-decoration: none; font-family: var(--f-display); letter-spacing: .02em; }
.powered b { font-weight: 700; } .powered:hover { filter: brightness(1.2); }

/* noticias */
.news { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.news li + li { border-top: 1px solid var(--line); }
.news a { display: flex; flex-direction: column; gap: 4px; padding: 12px 4px; color: var(--fg); text-decoration: none; border-radius: 8px; transition: background .15s; }
.news a:hover { background: var(--panel2); } .news a:hover .news-title { color: var(--neon); }
.news-meta { display: flex; gap: 10px; align-items: center; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; } .news-meta b { color: var(--gold); font-weight: 600; }
.news-title { font-size: 15px; font-weight: 500; line-height: 1.35; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--fg2); }

/* comunidad */
.composer textarea { min-height: 96px; width: 100%; }
.post { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--panel); display: flex; flex-direction: column; gap: 10px; }
.post + .post { margin-top: 10px; }
.post.reply { margin-left: 28px; background: var(--panel2); border-left: 2px solid var(--gold); }
.post header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.post .avatar { width: 28px; height: 28px; font-size: 11px; }
.post p { white-space: normal; overflow-wrap: anywhere; }
.post footer { display: flex; gap: 6px; flex-wrap: wrap; }
.post footer .on { color: var(--gold); }
@media (max-width: 900px) { .post.reply { margin-left: 12px; } .site-foot { padding: 16px; } }
.auth-points div { text-shadow: 0 1px 8px rgba(4, 19, 37, .9); }

/* ---------- v1.5: hoja editable, bloqueo, grillas ---------- */
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lock { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--bad); background: var(--badbg); margin-bottom: 12px; }
.lock b { font-family: var(--f-display); color: var(--bad); letter-spacing: .04em; text-transform: uppercase; font-size: 12px; }
.lock span { font-size: 13px; color: var(--fg2); }
button:disabled { opacity: .45; cursor: not-allowed; }
.sheet table { font-size: 12.5px; }
.sheet td, .sheet th { padding: 6px 8px; }
.sheet th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.sheet th.sortable:hover { color: var(--fg); }
.sheet td[contenteditable] { cursor: text; border-radius: 4px; outline: none; transition: background .12s, box-shadow .12s; min-width: 48px; }
.sheet td[contenteditable]:hover { background: var(--panel2); }
.sheet td[contenteditable]:focus { background: var(--bg2); box-shadow: inset 0 0 0 1.5px var(--gold); }
.sheet tfoot td { border-top: 2px solid var(--line2); background: var(--panel2); font-family: var(--f-mono); }
.sheet .nowrap { white-space: nowrap; }
.cell-btn { border: 0; background: transparent; padding: 2px 6px; font: 600 12px var(--f-body); cursor: pointer; border-radius: 4px; }
.cell-btn:hover { background: var(--panel2); }
.cell-sel { padding: 3px 6px; font-size: 12px; min-width: 100px; background: transparent; border-color: transparent; }
.cell-sel:hover, .cell-sel:focus { border-color: var(--line2); }
.tf-seg button { padding: 5px 10px; font: 600 11.5px var(--f-mono); }
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } @media (max-width: 700px) { .kpis.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sheet td.wrap { white-space: nowrap; max-width: 220px; min-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.sheet td.wrap:focus { white-space: normal; overflow: visible; }
.sheet .flags { flex-wrap: nowrap; }
.sheet td { vertical-align: middle; }
.alloc-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--panel2); }
.alloc-bar i { display: block; height: 100%; }
.seg.tabs { align-self: flex-start; }
.seg.tabs button { padding: 9px 18px; font-weight: 600; }
.sheet tr.sel td { background: var(--warnbg); }
.kpis.fut { grid-template-columns: repeat(6, minmax(0, 1fr)); } @media (max-width: 1200px) { .kpis.fut { grid-template-columns: repeat(4, minmax(0, 1fr)); } } @media (max-width: 700px) { .kpis.fut { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- jerarquía: cifras protagonistas, guía inicial, ayuda ---------- */
.hero-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.hero-figs > div { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 4px; box-shadow: inset 1px 0 0 var(--line); min-width: 0; }
.hero-figs > div:first-child { box-shadow: none; padding-left: 0; }
.hero-figs span { font-size: 13px; color: var(--fg2); }
.hero-figs b { font: 600 28px/1.1 var(--f-body); letter-spacing: -.015em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-figs em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.hero-figs .meter { margin-top: 4px; max-width: 220px; }
.kpis.minor b { font-size: 16px; }
@media (max-width: 760px) { .hero-figs { grid-template-columns: minmax(0, 1fr); } .hero-figs > div { box-shadow: inset 0 1px 0 var(--line); padding-left: 0; } .hero-figs b { font-size: 24px; } }
ol.guide { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 0; counter-reset: g; }
ol.guide li { counter-increment: g; display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
ol.guide li::before { content: counter(g); grid-row: span 2; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line2); color: var(--fg2); font-weight: 600; font-size: 13px; }
ol.guide li.done::before { background: var(--accent); color: #04121f; border-color: var(--accent); }
ol.guide b { font-size: 14px; } ol.guide span { font-size: 13.5px; color: var(--fg2); }
.help-btn { width: 100%; justify-content: flex-start; gap: 10px; background: transparent; border: 1px solid var(--line); color: var(--fg2); font-weight: 500; }
.help-btn:hover { color: var(--fg); }
dl.help { margin: 0; display: flex; flex-direction: column; gap: 4px; }
dl.help dt { font-weight: 600; margin-top: 10px; } dl.help dt:first-child { margin-top: 0; }
dl.help dd { margin: 0; color: var(--fg2); font-size: 14px; line-height: 1.55; max-width: 68ch; }
/* Bitácora: encabezados fijos y fila seleccionada */
.sheet.tall { max-height: 72vh; overflow: auto; }
.sheet.tall thead th { position: sticky; top: 0; z-index: 2; }
.sheet tbody tr:focus-within td { background: var(--bluebg) !important; }
.sheet tbody tr:focus-within td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.auth-points i.pxdot { width: 8px; height: 8px; flex: none; background: #1fd0ff; box-shadow: 8px 8px 0 #0e88e2; margin-right: 8px; align-self: center; }
.cell-sel { min-width: 128px; }

/* Buscador de pares */
.pairbox { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); min-width: 260px; max-height: 300px; overflow: auto; background: var(--panel2); border: 1px solid var(--line2); box-shadow: 0 12px 28px rgba(0,0,0,.35); }
.pairopt { display: grid; grid-template-columns: 74px 1fr auto; gap: 8px; align-items: baseline; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.pairopt b { font-variant-numeric: tabular-nums; }
.pairopt span { color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pairopt em { font-style: normal; font-size: 11px; color: var(--muted); }
.pairopt.on, .pairopt:hover { background: var(--line); }
.pairopt.none { display: block; color: var(--muted); cursor: default; }
/* Backtest */
.bt-out { display: flex; gap: 2px; height: 26px; align-items: flex-end; margin: 10px 0; }
.bt-out i { flex: 1; min-width: 1px; }
.bt-out i.tp { background: var(--good); height: 100%; } .bt-out i.stop { background: var(--bad); height: 60%; } .bt-out i.liq { background: var(--bad); height: 100%; opacity: .55; }
.avatar.av-img { padding: 0; overflow: hidden; background: var(--panel2); }
.avatar.av-img img, .avatar.av-img svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.cbars { display: flex; gap: 6px; align-items: flex-end; height: 160px; padding-top: 14px; }
.cbars > div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; position: relative; }
.cbars i { width: 70%; background: linear-gradient(180deg, var(--accent), var(--blue)); border-radius: 3px 3px 0 0; }
.cbars b { font-size: 11px; position: absolute; top: -2px; } .cbars span { font-size: 10px; color: var(--muted); }
.coach-opt { text-align: left; align-items: flex-start; cursor: pointer; white-space: normal; display: flex; flex-direction: column; min-width: 0; }
.coach-card { border-color: var(--amber); }
.commit, .commit-bar { border-left: 3px solid var(--accent); padding: 8px 12px; background: var(--bluebg); margin-top: 10px; }
.commit-bar { display: flex; flex-direction: column; gap: 2px; margin: 0 0 16px; } .commit-bar span { font-size: 11px; color: var(--muted); }

.pctbox { border: 1px dashed var(--line2); border-radius: 8px; padding: 8px 12px; } .pctbox summary { cursor: pointer; color: var(--fg2); font-size: 13px; } .pctbox .seg button { white-space: nowrap; }
