/* Paleta: canales de color (el modo backtest los pasa a grises) */
:root {
  --t-10-6-18: 10, 6, 18;
  --t-109-40-217: 109, 40, 217;
  --t-12-7-22: 12, 7, 22;
  --t-160-150-185: 160, 150, 185;
  --t-168-85-247: 168, 85, 247;
  --t-18-11-30: 18, 11, 30;
  --t-18-11-31: 18, 11, 31;
  --t-200-186-230: 200, 186, 230;
  --t-216-196-255: 216, 196, 255;
  --t-221-212-239: 221, 212, 239;
  --t-24-13-42: 24, 13, 42;
  --t-24-14-40: 24, 14, 40;
  --t-245-241-255: 245, 241, 255;
  --t-26-11-51: 26, 11, 51;
  --t-28-11-54: 28, 11, 54;
  --t-3-2-6: 3, 2, 6;
  --t-32-20-54: 32, 20, 54;
  --t-5-3-10: 5, 3, 10;
  --t-5-3-8: 5, 3, 8;
  --t-79-71-102: 79, 71, 102;
  --t-8-5-14: 8, 5, 14;
  --t-8-5-15: 8, 5, 15;
  --t-8-5-16: 8, 5, 16;
}
html.bt {
  --t-10-6-18: 9, 9, 9;
  --t-109-40-217: 95, 95, 95;
  --t-12-7-22: 10, 10, 10;
  --t-160-150-185: 157, 157, 157;
  --t-168-85-247: 175, 175, 175;
  --t-18-11-30: 15, 15, 15;
  --t-18-11-31: 15, 15, 15;
  --t-200-186-230: 195, 195, 195;
  --t-216-196-255: 209, 209, 209;
  --t-221-212-239: 218, 218, 218;
  --t-24-13-42: 20, 20, 20;
  --t-24-14-40: 20, 20, 20;
  --t-245-241-255: 244, 244, 244;
  --t-26-11-51: 20, 20, 20;
  --t-28-11-54: 21, 21, 21;
  --t-3-2-6: 3, 3, 3;
  --t-32-20-54: 27, 27, 27;
  --t-5-3-10: 4, 4, 4;
  --t-5-3-8: 4, 4, 4;
  --t-79-71-102: 77, 77, 77;
  --t-8-5-14: 7, 7, 7;
  --t-8-5-15: 7, 7, 7;
  --t-8-5-16: 7, 7, 7;
}

@font-face {
  font-family: 'Codec Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Codec Pro'), local('CodecPro-Regular'), url('assets/fonts/CodecPro-Regular.woff') format('woff');
}
:root {
  --bg: rgb(var(--t-5-3-8));
  --bg-2: rgb(var(--t-12-7-22));
  --panel: rgba(var(--t-18-11-30), 0.62);
  --panel-solid: rgb(var(--t-18-11-31));
  --panel-hi: rgba(var(--t-32-20-54), 0.75);
  --border: rgba(var(--t-216-196-255), 0.14);
  --border-hi: rgba(var(--t-216-196-255), 0.45);
  --lav: rgb(var(--t-216-196-255));
  --purple: rgb(var(--t-168-85-247));
  --deep: rgb(var(--t-109-40-217));
  --pos: #19e6a0;
  --neg: #ff4d6d;
  --neu: rgb(var(--t-200-186-230));
  --text: rgb(var(--t-245-241-255));
  --muted: rgb(var(--t-160-150-185));
  --dim: rgb(var(--t-79-71-102));
  --grad: linear-gradient(120deg, #ffffff 0%, rgb(var(--t-216-196-255)) 25%, rgb(var(--t-168-85-247)) 50%, rgb(var(--t-109-40-217)) 75%, #ffffff 100%);
  --radius: 14px;
  --font: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --display: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --heading: 'Codec Pro', 'IBM Plex Sans', 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: radial-gradient(ellipse at top, rgb(var(--t-28-11-54)) 0%, var(--bg) 60%) fixed;
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--lav); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--lav), var(--purple)); border-radius: 8px; }

/* ================= FONDO ================= */
#bg-canvas { position: fixed; inset: 0; z-index: -3; }
.bg-grid {
  position: fixed; inset: -50% -50% 0 -50%; z-index: -4;
  background-image:
    linear-gradient(rgba(var(--t-216-196-255), .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--t-216-196-255), .06) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(600px) rotateX(60deg) translateY(30%);
  transform-origin: center bottom;
  animation: gridMove 18s linear infinite;
  mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 70%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 70%);
}
@keyframes gridMove { to { background-position: 0 60px, 0 0; } }
.bg-orb { position: fixed; border-radius: 50%; filter: blur(110px); z-index: -5; opacity: .35; animation: orbFloat 22s ease-in-out infinite alternate; }
.orb-1 { width: 560px; height: 560px; background: var(--purple); top: -180px; left: 8%; opacity: .26; }
.orb-2 { width: 640px; height: 640px; background: var(--deep); bottom: -240px; right: -140px; animation-delay: -8s; opacity: .34; }
.orb-3 { width: 340px; height: 340px; background: #ffffff; top: 38%; left: 48%; animation-delay: -14s; opacity: .05; }
@keyframes orbFloat { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(80px, 60px) scale(1.15); } }
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
}

/* ================= LOGIN ================= */
.login {
  position: fixed; inset: 0; z-index: 1100;
  display: grid; place-items: center; padding: 28px 20px;
  background:
    radial-gradient(ellipse 55% 42% at 50% 42%, rgba(var(--t-109-40-217), .34), transparent 68%),
    rgba(var(--t-5-3-8), .55);
  transition: opacity .6s var(--ease), visibility .6s;
}
html.authed .login, .login.done { opacity: 0; visibility: hidden; pointer-events: none; }
html:not(.authed) .boot, html:not(.authed) .app { visibility: hidden; }
.login-card {
  position: relative; width: min(420px, 94vw);
  display: flex; flex-direction: column; align-items: stretch; gap: 16px;
  padding: 34px 32px 28px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(var(--t-24-13-42), .96), rgba(var(--t-8-5-16), .98));
  border: 1px solid rgba(var(--t-216-196-255), .18);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55), 0 0 60px rgba(var(--t-168-85-247), .16);
  backdrop-filter: blur(22px);
  animation: logoIn .7s var(--ease) both;
}
.login-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(255,255,255,.7), rgba(var(--t-216-196-255), .15) 30%, rgba(var(--t-168-85-247), .7) 70%, rgba(255,255,255,.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.login-logo { width: min(250px, 78%); height: auto; align-self: center; margin: 4px 0 8px; filter: drop-shadow(0 0 22px rgba(var(--t-168-85-247), .55)); }
.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field > span { font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.login-input { position: relative; display: block; }
.login-input > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--lav); opacity: .8; pointer-events: none; }
.login-input input { padding-left: 42px; height: 48px; border-radius: 12px; background: rgba(var(--t-5-3-10), .55); }
.login-input:focus-within > svg { color: #fff; opacity: 1; }
.login-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 9px; color: var(--muted);
  display: grid; place-items: center;
}
.login-eye:hover { color: var(--text); background: rgba(255,255,255,.06); }
.login-eye .eye-off { display: none; }
.login-eye.on .eye-open { display: none; }
.login-eye.on .eye-off { display: block; }
.login-input:has(.login-eye) input { padding-right: 46px; }
.login-error { min-height: 1.15em; margin-top: -6px; font-size: .8rem; color: var(--neg); text-align: center; }
.login-card .btn-block { height: 48px; margin-top: 2px; font-size: .95rem; }
.login-card.invalid { animation: shake .4s; }

/* ================= BOOT ================= */
.boot {
  position: fixed; inset: 0; z-index: 1000; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .7s var(--ease), visibility .7s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot-logo { width: min(340px, 70vw); height: auto; animation: logoIn 1.2s var(--ease) both, pulseGlow 3s ease-in-out 1.2s infinite; filter: drop-shadow(0 0 24px rgba(var(--t-168-85-247), .55)); }
@keyframes logoIn { from { transform: scale(.7) translateY(12px); opacity: 0; filter: blur(10px) drop-shadow(0 0 0 transparent); } to { transform: none; opacity: 1; } }
@keyframes gradFlow { to { background-position: 300% 0; } }
@keyframes gradPulse { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.boot-bar { width: min(340px, 70vw); height: 3px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--lav), var(--purple)); box-shadow: 0 0 12px var(--lav); animation: bootLoad 3s cubic-bezier(.45, 0, .25, 1) forwards; }
@keyframes bootLoad { to { width: 100%; } }
.boot-text { font-family: var(--mono); font-size: .72rem; color: var(--muted); letter-spacing: .2em; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ================= LAYOUT ================= */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 26px 18px;
  background: linear-gradient(180deg, rgba(var(--t-10-6-18), .85), rgba(var(--t-10-6-18), .6));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  z-index: 10;
}
.brand { display: flex; align-items: center; padding: 0 6px; }
.brand h1 { line-height: 0; }
.brand-logo { width: 190px; max-width: 100%; height: auto; filter: drop-shadow(0 0 10px rgba(var(--t-168-85-247), .45)); animation: pulseGlow 4s ease-in-out infinite; transition: transform .4s var(--ease); }
.brand-logo:hover { transform: scale(1.04); }
@keyframes pulseGlow { 50% { filter: drop-shadow(0 0 20px rgba(var(--t-168-85-247), .8)); } }
input[name="pair"] { text-transform: uppercase; font-family: var(--mono); font-weight: 600; letter-spacing: .06em; }

.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  color: var(--muted); font-weight: 500; font-size: .93rem; text-align: left;
  transition: color .25s, background .25s, transform .25s var(--ease);
  overflow: hidden;
}
.nav-item::before {
  content: ''; position: absolute; left: 0; top: 50%; width: 3px; height: 0;
  background: var(--lav); box-shadow: 0 0 12px var(--lav); border-radius: 3px;
  transform: translateY(-50%); transition: height .35s var(--ease);
}
.nav-item:hover { color: var(--text); background: rgba(var(--t-216-196-255), .05); transform: translateX(3px); }
.nav-item.active { color: var(--text); background: linear-gradient(90deg, rgba(var(--t-168-85-247), .28), rgba(var(--t-109-40-217), .08) 70%, transparent); }
.nav-item.active::before { height: 60%; }
.nav-item.active svg { color: var(--lav); filter: drop-shadow(0 0 6px var(--lav)); }
.nav-sep { height: 1px; margin: 8px 6px; background: linear-gradient(90deg, transparent, var(--border), transparent); }
.nav-mode { border: 1px dashed var(--border); }
.nav-mode .ico-live, html.bt .nav-mode .ico-bt { display: none; }
html.bt .nav-mode .ico-live { display: block; }
html.bt .nav-mode { border-style: solid; }

.mode-badge {
  display: none; width: max-content; margin-bottom: 8px; padding: 4px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: .64rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text); border: 1px solid var(--border-hi); background: rgba(255,255,255,.04);
}
html.bt .mode-badge { display: block; }
html.bt .brand-logo, html.bt .boot-logo, html.bt .login-logo { filter: grayscale(1) brightness(1.15) drop-shadow(0 0 12px rgba(255,255,255,.18)); animation: none; }
html.bt .boot-logo { animation: logoIn 1.2s var(--ease) both; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.mini-balance {
  padding: 16px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(var(--t-216-196-255), .1), rgba(var(--t-168-85-247), .12));
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.mini-balance .label { font-family: var(--mono); font-size: .62rem; letter-spacing: .18em; color: var(--muted); }
.mini-balance strong { font-family: var(--display); font-size: 1.25rem; }
.mini-balance small { font-family: var(--mono); font-size: .78rem; }
.main { padding: 26px 34px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.topbar h2 { font-family: var(--heading); font-size: 3rem; font-weight: 700; letter-spacing: 0; line-height: 1.05; background: linear-gradient(90deg, #ffffff 0%, #ffffff 40%, var(--lav) 70%, var(--purple) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar h2.anim { animation: titleIn .6s var(--ease); }
@keyframes titleIn { from { opacity: 0; transform: translateY(8px); filter: blur(6px); } }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sessions { display: flex; gap: 6px; }
.session-pill {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: .66rem; letter-spacing: .08em;
  border: 1px solid rgba(255,255,255,.08); color: var(--dim); background: rgba(255,255,255,.02);
}
.session-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.session-pill.open { color: var(--pos); border-color: rgba(25,230,160,.3); background: rgba(25,230,160,.06); }
.session-pill.open i { background: var(--pos); box-shadow: 0 0 8px var(--pos); animation: blink 1.4s infinite; }
.clock { font-family: var(--mono); font-size: .95rem; color: var(--lav); padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: rgba(var(--t-216-196-255), .04); text-shadow: 0 0 10px rgba(var(--t-216-196-255), .6); }

/* ================= VISTAS ================= */
.view { display: none; }
.view.active { display: block; }
.view.active .card, .view.active .kpi { animation: cardIn .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes cardIn { from { opacity: 0; transform: translateY(22px) scale(.98); filter: blur(4px); } }

/* ================= CARDS ================= */
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color .3s, box-shadow .3s, transform .3s var(--ease);
}
.card:hover { border-color: rgba(var(--t-216-196-255), .28); box-shadow: 0 14px 50px rgba(0, 0, 0, .45), 0 0 30px rgba(var(--t-216-196-255), .06); }
.hud::before, .hud::after {
  content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border-color: var(--lav); border-style: solid; opacity: .55; transition: opacity .3s, width .3s, height .3s;
}
.hud::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-top-left-radius: var(--radius); }
.hud::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-bottom-right-radius: var(--radius); border-color: var(--purple); }
.hud:hover::before, .hud:hover::after { opacity: 1; width: 26px; height: 26px; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.card-head h3, .section-title h3 { font-size: .82rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; display: flex; align-items: center; gap: 10px; }
.card-sub { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.lav { background: var(--lav); box-shadow: 0 0 10px var(--lav); }
.dot.purple { background: var(--purple); box-shadow: 0 0 10px var(--purple); }
.dot.white { background: #fff; box-shadow: 0 0 10px #fff; }
.dot.soft { background: var(--neu); box-shadow: 0 0 10px var(--neu); }
.dot.deep { background: var(--deep); box-shadow: 0 0 10px var(--deep); }
.link-btn { color: var(--lav); font-size: .8rem; font-family: var(--mono); transition: text-shadow .2s; }
.link-btn:hover { text-shadow: 0 0 10px var(--lav); }

.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ================= BOTONES ================= */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 11px; font-weight: 600; font-size: .88rem; letter-spacing: .02em;
  transition: transform .2s var(--ease), box-shadow .3s, background .3s, border-color .3s;
  overflow: hidden; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: #ffffff; color: rgb(var(--t-26-11-51)); box-shadow: 0 6px 24px rgba(var(--t-168-85-247), .35); }
.btn-primary::after {
  content: ''; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(var(--t-168-85-247), .2), transparent); transform: skewX(-20deg);
  transition: left .7s var(--ease);
}
.btn-primary:hover { box-shadow: 0 8px 34px rgba(var(--t-168-85-247), .55); transform: translateY(-1px); }
.btn-primary:hover::after { left: 140%; }
.btn-ghost { border: 1px solid var(--border); background: rgba(255,255,255,.02); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-hi); background: rgba(var(--t-216-196-255), .07); box-shadow: 0 0 18px rgba(var(--t-216-196-255), .12); }
.btn-danger { border: 1px solid rgba(255,77,109,.4); color: var(--neg); background: rgba(255,77,109,.06); }
.btn-danger:hover { background: rgba(255,77,109,.16); box-shadow: 0 0 18px rgba(255,77,109,.25); }
.btn-sm { padding: 8px 13px; font-size: .8rem; }
.btn-block { width: 100%; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); font-size: 1.3rem; color: var(--lav); transition: all .2s; }
.icon-btn:hover { background: rgba(var(--t-216-196-255), .1); box-shadow: 0 0 14px rgba(var(--t-216-196-255), .25); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.file-btn input { display: none; }

/* ================= TOOLBAR ================= */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.segmented { position: relative; display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(12px); }
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented button { padding: 8px 14px; border-radius: 9px; font-size: .8rem; color: var(--muted); transition: all .25s; white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: linear-gradient(135deg, rgba(var(--t-216-196-255), .2), rgba(var(--t-168-85-247), .2)); color: var(--text); box-shadow: inset 0 0 0 1px rgba(var(--t-216-196-255), .35); }
.strategy-tag { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; color: var(--purple); padding: 8px 14px; border-radius: 10px; border: 1px dashed rgba(var(--t-168-85-247), .4); }

/* ================= KPI ================= */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden;
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(16px);
  transition: transform .35s var(--ease), border-color .3s, box-shadow .3s;
}
.kpi::after {
  content: ''; position: absolute; inset: auto -40% -60% auto; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent, var(--lav)) 0%, transparent 70%); opacity: .14; transition: opacity .3s, transform .5s var(--ease);
}
.kpi:hover { transform: translateY(-4px); border-color: var(--accent, var(--lav)); box-shadow: 0 12px 36px rgba(0,0,0,.4), 0 0 24px color-mix(in srgb, var(--accent, var(--lav)) 25%, transparent); }
.kpi:hover::after { opacity: .3; transform: scale(1.3); }
.kpi .k-label { font-family: var(--mono); font-size: .66rem; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }
.kpi .k-icon { color: var(--accent, var(--lav)); opacity: .9; }
.kpi .k-value { font-family: var(--display); font-size: 1.7rem; font-weight: 600; margin: 10px 0 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .k-foot { font-size: .76rem; color: var(--muted); font-family: var(--mono); }
.kpi.main-kpi .k-value { font-size: 2rem; }
.kpi.main-kpi { background: linear-gradient(140deg, rgba(var(--t-109-40-217), .35), rgba(var(--t-10-6-18), .85) 55%, rgba(var(--t-168-85-247), .2)); }
.kpi.main-kpi::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--grad); background-size: 300% 100%; animation: gradFlow 6s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.pos { color: var(--pos); text-shadow: 0 0 10px rgba(25,230,160,.25); }
.neg { color: var(--neg); }
.neu { color: var(--neu); }
.glow-pos { text-shadow: 0 0 18px rgba(25,230,160,.45); }
.glow-neg { text-shadow: 0 0 18px rgba(255,77,109,.45); }

/* ================= CHARTS ================= */
.chart-wrap { position: relative; height: 300px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-tooltip {
  position: absolute; pointer-events: none; padding: 10px 12px; border-radius: 10px;
  background: rgba(var(--t-8-5-14), .92); border: 1px solid var(--border-hi);
  font-family: var(--mono); font-size: .74rem; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -110%); transition: opacity .15s;
  box-shadow: 0 0 20px rgba(var(--t-216-196-255), .2);
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip b { display: block; font-size: .9rem; margin-top: 2px; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); font-size: .9rem; }
.donut-wrap { position: relative; height: 210px; display: flex; justify-content: center; }
.donut-wrap canvas { width: 210px; height: 210px; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center strong { font-family: var(--display); font-size: 1.9rem; }
.donut-center span { font-family: var(--mono); font-size: .62rem; letter-spacing: .2em; color: var(--muted); }
.legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.legend div { text-align: center; padding: 8px 4px; border-radius: 10px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.05); }
.legend span { display: block; font-family: var(--mono); font-size: .62rem; color: var(--muted); letter-spacing: .1em; }
.legend strong { font-family: var(--display); font-size: 1.05rem; }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 82px 1fr auto; align-items: center; gap: 10px; font-size: .82rem; }
.bar-row .b-name { font-family: var(--mono); font-weight: 600; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .b-track { position: relative; height: 10px; background: rgba(255,255,255,.04); border-radius: 6px; overflow: hidden; }
.bar-row .b-track::before { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255,255,255,.18); }
.bar-row .b-fill { position: absolute; top: 0; bottom: 0; width: 0; border-radius: 6px; transition: width 1.1s var(--ease); }
.bar-row .b-fill.pos { left: 50%; background: linear-gradient(90deg, rgba(25,230,160,.4), var(--pos)); box-shadow: 0 0 10px rgba(25,230,160,.5); }
.bar-row .b-fill.neg { right: 50%; background: linear-gradient(270deg, rgba(255,77,109,.4), var(--neg)); box-shadow: 0 0 10px rgba(255,77,109,.5); }
.bar-row .b-val { font-family: var(--mono); font-size: .76rem; text-align: right; min-width: 74px; }
.bar-row .b-meta { grid-column: 2 / 4; font-size: .68rem; color: var(--muted); font-family: var(--mono); margin-top: -6px; }
.empty-mini { color: var(--muted); font-size: .85rem; padding: 16px 0; text-align: center; }

/* Cumplimiento */
.compliance-top { display: grid; grid-template-columns: 130px 1fr; gap: 20px; align-items: center; margin-bottom: 18px; }
.ring { position: relative; width: 130px; height: 130px; }
.ring svg { width: 130px; height: 130px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .ring-bg { stroke: rgba(255,255,255,.06); }
.ring .ring-fg { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 1.4s var(--ease); filter: drop-shadow(0 0 6px rgba(var(--t-216-196-255), .6)); }
.ring .ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .ring-label strong { font-family: var(--display); font-size: 1.5rem; }
.ring .ring-label span { font-family: var(--mono); font-size: .56rem; color: var(--muted); letter-spacing: .14em; text-align: center; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare div { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.06); }
.compare span { display: block; font-size: .7rem; color: var(--muted); margin-bottom: 4px; }
.compare strong { font-family: var(--display); font-size: 1.15rem; }
.compare small { display: block; font-family: var(--mono); font-size: .7rem; color: var(--muted); margin-top: 2px; }
.broken-title { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; color: var(--muted); margin: 6px 0 10px; }
.broken-rule { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-bottom: 10px; font-size: .82rem; }
.broken-rule .bt { height: 5px; grid-column: 1 / 3; background: rgba(255,255,255,.05); border-radius: 5px; overflow: hidden; }
.broken-rule .bt span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--neu), var(--neg)); border-radius: 5px; transition: width 1.2s var(--ease); }
.broken-rule em { font-style: normal; font-family: var(--mono); color: var(--neg); font-size: .75rem; }

/* Lista de operaciones recientes */
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.02); border: 1px solid rgba(255,255,255,.05);
  cursor: pointer; transition: all .25s var(--ease);
}
.recent-item:hover { background: rgba(var(--t-216-196-255), .06); border-color: var(--border-hi); transform: translateX(4px); }
.recent-item .ri-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.ri-icon.buy { background: rgba(25,230,160,.1); color: var(--pos); border: 1px solid rgba(25,230,160,.3); }
.ri-icon.sell { background: rgba(255,77,109,.1); color: var(--neg); border: 1px solid rgba(255,77,109,.3); }
.recent-item .ri-main strong { font-family: var(--mono); font-size: .88rem; }
.recent-item .ri-main span { display: block; font-size: .72rem; color: var(--muted); }
.recent-item .ri-pnl { font-family: var(--mono); font-weight: 600; text-align: right; font-size: .88rem; }
.recent-item .ri-pnl small { display: block; font-weight: 400; color: var(--muted); font-size: .7rem; }

/* ================= FORMULARIO ================= */
.trade-form { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
.form-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.form-side { position: sticky; top: 20px; }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.section-title.mt { margin-top: 26px; }
.step {
  font-family: var(--display); font-size: .78rem; font-weight: 700; color: var(--lav);
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--border-hi); background: rgba(var(--t-216-196-255), .07); box-shadow: 0 0 14px rgba(var(--t-216-196-255), .15) inset;
}
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); margin-top: 16px; }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { font-size: .72rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-weight: 500; }
.field em { font-style: normal; color: var(--lav); }
input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  background: rgba(var(--t-8-5-14), .65); border: 1px solid rgba(var(--t-160-150-185), .2);
  outline: none; font-size: .9rem; transition: border-color .25s, box-shadow .25s, background .25s;
}
input[type="number"], input[type="datetime-local"], input[type="month"] { font-family: var(--mono); }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { border-color: var(--lav); box-shadow: 0 0 0 3px rgba(var(--t-216-196-255), .12), 0 0 18px rgba(var(--t-216-196-255), .15); background: rgba(var(--t-8-5-14), .9); }
input.invalid { border-color: var(--neg); box-shadow: 0 0 0 3px rgba(255,77,109,.15); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23d8c4ff' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
select option { background: var(--panel-solid); }
textarea { resize: vertical; min-height: 70px; }
::-webkit-calendar-picker-indicator { filter: invert(1) brightness(.85); cursor: pointer; }
.input-with-btn { display: flex; gap: 6px; }
.mini-btn { width: 42px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--border-hi); color: var(--lav); font-size: 1.1rem; background: rgba(var(--t-216-196-255), .06); transition: all .2s; }
.mini-btn:hover { background: rgba(var(--t-216-196-255), .16); box-shadow: 0 0 12px rgba(var(--t-216-196-255), .3); }

.dir-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dir-toggle input { display: none; }
.dir-toggle label { text-align: center; padding: 11px 6px; border-radius: 10px; font-family: var(--mono); font-size: .8rem; font-weight: 600; border: 1px solid rgba(var(--t-160-150-185), .2); color: var(--muted); cursor: pointer; transition: all .25s; }
.dir-toggle input:checked + label.buy { color: var(--pos); border-color: var(--pos); background: rgba(25,230,160,.1); box-shadow: 0 0 18px rgba(25,230,160,.2); }
.dir-toggle input:checked + label.sell { color: var(--neg); border-color: var(--neg); background: rgba(255,77,109,.1); box-shadow: 0 0 18px rgba(255,77,109,.2); }

.route { display: grid; grid-template-columns: 1fr 80px 1fr; align-items: center; gap: 10px; }
.route-node { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 14px; background: rgba(255,255,255,.02); border: 1px solid rgba(255,255,255,.06); }
.route-node.entry { border-color: rgba(var(--t-216-196-255), .2); }
.route-node.exit { border-color: rgba(var(--t-168-85-247), .25); }
.route-label { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .7rem; letter-spacing: .2em; }
.route-label i { width: 10px; height: 10px; border-radius: 50%; }
.entry .route-label { color: var(--lav); }
.entry .route-label i { background: var(--lav); box-shadow: 0 0 10px var(--lav); }
.exit .route-label { color: var(--purple); }
.exit .route-label i { background: var(--purple); box-shadow: 0 0 10px var(--purple); }
.route-line { position: relative; height: 2px; background: linear-gradient(90deg, var(--lav), var(--purple)); opacity: .6; }
.route-line span { position: absolute; top: -4px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 14px var(--lav); animation: travel 2.2s ease-in-out infinite; }
@keyframes travel { 0% { left: 0; background: var(--lav); } 100% { left: calc(100% - 10px); background: var(--purple); } }

.hint { font-size: .82rem; color: var(--muted); margin-bottom: 14px; line-height: 1.5; }
.hint .ok { color: var(--pos); }
.hint .ko { color: var(--neg); }
.compliance-meter { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.compliance-meter .meter { width: 120px; height: 6px; border-radius: 6px; background: rgba(255,255,255,.06); overflow: hidden; }
.compliance-meter .meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--neg), var(--neu), var(--pos)); background-size: 120px 100%; border-radius: 6px; transition: width .5s var(--ease); }
.compliance-meter strong { font-family: var(--display); font-size: .9rem; min-width: 44px; text-align: right; }

.rules-check { display: flex; flex-direction: column; gap: 8px; }
.rule-item {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,77,109,.25); background: rgba(255,77,109,.04);
  cursor: pointer; transition: all .3s var(--ease); user-select: none;
}
.rule-item:hover { transform: translateX(3px); }
.rule-item .ri-num { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.rule-item .ri-text { font-size: .88rem; }
.rule-item .ri-state { font-family: var(--mono); font-size: .7rem; font-weight: 600; padding: 5px 10px; border-radius: 999px; color: var(--neg); border: 1px solid rgba(255,77,109,.4); min-width: 116px; text-align: center; transition: all .3s; }
.rule-item.met { border-color: rgba(25,230,160,.35); background: rgba(25,230,160,.06); box-shadow: 0 0 18px rgba(25,230,160,.06) inset; }
.rule-item.met .ri-state { color: var(--pos); border-color: rgba(25,230,160,.5); background: rgba(25,230,160,.1); }
.rule-item.pop { animation: pop .35s var(--ease); }
@keyframes pop { 50% { transform: scale(1.02); } }

.stars { display: flex; gap: 4px; }
.stars button { font-size: 1.5rem; color: var(--dim); transition: color .2s, transform .2s, text-shadow .2s; }
.stars button:hover { transform: scale(1.2); }
.stars button.on { color: var(--neu); text-shadow: 0 0 12px rgba(var(--t-200-186-230), .7); }

.preview .pv-pair { font-family: var(--heading); font-size: 2.1rem; font-weight: 700; letter-spacing: .04em; color: #fff; }
.preview .pv-dir { font-family: var(--mono); font-size: .75rem; letter-spacing: .2em; margin: 4px 0 16px; color: var(--pos); }
.preview .pv-dir.sell { color: var(--neg); }
.pv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pv-grid div { padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.05); }
.pv-grid span { display: block; font-family: var(--mono); font-size: .58rem; letter-spacing: .14em; color: var(--muted); }
.pv-grid strong { font-family: var(--mono); font-size: .98rem; }
.pv-pnl { font-family: var(--display); font-size: 2.1rem; font-weight: 700; text-align: center; margin: 18px 0; padding: 14px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.06); transition: color .3s, text-shadow .3s; }
.form-actions { display: flex; flex-direction: column; gap: 8px; }
.badge { font-family: var(--mono); font-size: .66rem; font-weight: 600; letter-spacing: .1em; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); color: var(--muted); }
.badge.win { color: var(--pos); border-color: rgba(25,230,160,.4); background: rgba(25,230,160,.08); }
.badge.loss { color: var(--neg); border-color: rgba(255,77,109,.4); background: rgba(255,77,109,.08); }
.badge.be { color: var(--neu); border-color: rgba(var(--t-200-186-230), .4); background: rgba(var(--t-200-186-230), .08); }

/* ================= TABLA ================= */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; padding: 14px; }
.filters select, .filters input[type="month"] { width: auto; min-width: 150px; padding: 9px 12px; font-size: .82rem; }
.filters select { padding-right: 34px; }
.search { position: relative; flex: 1 1 220px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 38px; font-size: .85rem; }
.filters-actions { display: flex; gap: 8px; margin-left: auto; }
.trades-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.table-summary { display: flex; flex-wrap: wrap; gap: 10px; }
.view-toggle button { display: inline-flex; align-items: center; gap: 7px; }
.view-toggle svg { width: 15px; height: 15px; }

.trade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.trade-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
  border-radius: 16px; background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(14px);
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
  animation: cardIn .5s var(--ease) both;
}
.trade-card:hover { transform: translateY(-4px); border-color: var(--border-hi); box-shadow: 0 16px 40px rgba(0,0,0,.45), 0 0 26px rgba(var(--t-168-85-247), .18); }
.trade-card.win { box-shadow: inset 0 3px 0 var(--pos); }
.trade-card.loss { box-shadow: inset 0 3px 0 var(--neg); }
.trade-card.be { box-shadow: inset 0 3px 0 var(--neu); }
.tc-shot { position: relative; aspect-ratio: 16 / 9; background: rgb(var(--t-8-5-15)); overflow: hidden; border-bottom: 1px solid var(--border); }
.tc-shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.trade-card:hover .tc-shot img { transform: scale(1.05); }
.tc-noshot { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--dim); font-size: .78rem; background: repeating-linear-gradient(135deg, rgba(var(--t-216-196-255), .03) 0 10px, transparent 10px 20px); }
.tc-noshot svg { width: 30px; height: 30px; }
.tc-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.tc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tc-head h4 { font-family: var(--heading); font-size: 1.35rem; font-weight: 700; letter-spacing: .02em; color: #fff; }
.tc-pnl { font-family: var(--display); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; text-shadow: none; }
.tc-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .78rem; color: var(--muted); }
.tc-actions { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.trade-card:hover .tc-actions { opacity: 1; }
.tc-actions button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(var(--t-5-3-8), .7); color: var(--text); backdrop-filter: blur(6px); }
.tc-actions button svg { width: 15px; height: 15px; }
.tc-actions button:hover { background: rgba(var(--t-216-196-255), .18); }
.tc-actions button.del:hover { color: var(--neg); background: rgba(255,77,109,.18); }
.sum-chip { padding: 9px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); font-size: .78rem; color: var(--muted); backdrop-filter: blur(10px); animation: cardIn .5s var(--ease) both; }
.sum-chip strong { font-family: var(--mono); color: var(--text); margin-left: 6px; }
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.trades-table { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 940px; }
.trades-table th {
  text-align: left; padding: 14px 14px; font-family: var(--mono); font-size: .66rem; letter-spacing: .14em; font-weight: 600;
  color: var(--muted); text-transform: uppercase; background: rgba(var(--t-216-196-255), .04); border-bottom: 1px solid var(--border);
  white-space: nowrap; user-select: none;
}
.trades-table th[data-sort] { cursor: pointer; transition: color .2s; }
.trades-table th[data-sort]:hover { color: var(--lav); }
.trades-table th.sorted { color: var(--lav); }
.trades-table th.sorted::after { content: ' ▾'; }
.trades-table th.sorted.asc::after { content: ' ▴'; }
.trades-table th.num, .trades-table td.num { text-align: right; }
.trades-table td { padding: 13px 14px; border-bottom: 1px solid rgba(255,255,255,.04); white-space: nowrap; }
.trades-table tbody tr { cursor: pointer; transition: background .2s; animation: rowIn .45s var(--ease) both; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } }
.trades-table tbody tr:hover { background: linear-gradient(90deg, rgba(var(--t-216-196-255), .07), transparent); }
.trades-table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--lav); }
.td-date strong { display: block; font-family: var(--mono); font-size: .82rem; }
.td-date span { font-size: .7rem; color: var(--muted); font-family: var(--mono); }
.td-pair { font-family: var(--mono); font-weight: 700; letter-spacing: .04em; }
.dir-tag { font-family: var(--mono); font-size: .68rem; font-weight: 700; padding: 4px 8px; border-radius: 6px; }
.dir-tag.buy { color: var(--pos); background: rgba(25,230,160,.1); }
.dir-tag.sell { color: var(--neg); background: rgba(255,77,109,.1); }
.type-tag { font-size: .74rem; color: var(--muted); }
.type-tag small { display: block; color: var(--dim); font-size: .68rem; }
.route-cell { font-family: var(--mono); font-size: .8rem; }
.route-cell i { color: var(--lav); font-style: normal; margin: 0 6px; }
.td-pnl { font-family: var(--mono); font-weight: 700; }
.rules-mini { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .74rem; }
.rules-mini .rm-bar { width: 60px; height: 5px; border-radius: 5px; background: rgba(255,255,255,.06); overflow: hidden; }
.rules-mini .rm-bar span { display: block; height: 100%; border-radius: 5px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .5; transition: opacity .2s; }
tr:hover .row-actions { opacity: 1; }
.row-actions button { width: 30px; height: 30px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; transition: all .2s; }
.row-actions button svg { width: 15px; height: 15px; }
.row-actions button:hover { color: var(--lav); background: rgba(var(--t-216-196-255), .1); }
.row-actions button.del:hover { color: var(--neg); background: rgba(255,77,109,.1); }
.table-empty { padding: 50px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-icon { font-size: 2.6rem; color: var(--lav); text-shadow: 0 0 20px var(--lav); animation: floatY 3s ease-in-out infinite; }
@keyframes floatY { 50% { transform: translateY(-8px) rotate(45deg); } }

/* ================= CALENDARIO ================= */
.cal-layout { display: grid; grid-template-columns: 1fr 330px; gap: 18px; margin-bottom: 18px; align-items: start; }
.cal-side { display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 1500px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.cal-head h3 { font-family: var(--heading); font-size: 1.4rem; font-weight: 700; letter-spacing: .02em; min-width: 200px; text-align: center; text-transform: capitalize; }
.cal-head .btn { margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 1.25fr); gap: 8px; }
.cal-dow { font-family: var(--font); font-size: .7rem; font-weight: 600; letter-spacing: .14em; color: var(--muted); text-align: left; padding: 0 4px 6px; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 2px; }
.cal-dow.weekend-h { color: var(--dim); }
.cal-dow.week-h { text-align: right; color: var(--lav); }
.cal-day {
  position: relative; min-height: 104px; padding: 10px 11px 9px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.012));
  border: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s, background .3s;
  animation: dayIn .5s var(--ease) both;
  overflow: hidden; isolation: isolate;
}
@keyframes dayIn { from { opacity: 0; transform: translateY(6px) scale(.96); } }
.cal-day::before {
  content: ''; position: absolute; inset: auto 0 0 0; height: 100%; z-index: -1; opacity: 0;
  transition: opacity .3s;
}
.cal-day.empty { background: transparent; border-color: transparent; }
.cal-day.weekend:not(.has) { background: transparent; border-style: dashed; border-color: rgba(255,255,255,.04); }
.cal-day.has { cursor: pointer; }
.cal-day.has:hover, .cal-day.selected { transform: translateY(-3px); z-index: 2; }
.cal-day.win { border-color: rgba(25,230,160,.28); box-shadow: inset 3px 0 0 var(--pos); }
.cal-day.win::before { opacity: 1; background: radial-gradient(120% 90% at 0% 100%, rgba(25,230,160,var(--a, .15)), transparent 70%); }
.cal-day.loss { border-color: rgba(255,77,109,.28); box-shadow: inset 3px 0 0 var(--neg); }
.cal-day.loss::before { opacity: 1; background: radial-gradient(120% 90% at 0% 100%, rgba(255,77,109,var(--a, .15)), transparent 70%); }
.cal-day.be { border-color: rgba(var(--t-200-186-230), .25); box-shadow: inset 3px 0 0 var(--neu); }
.cal-day.win:hover, .cal-day.win.selected { box-shadow: inset 3px 0 0 var(--pos), 0 10px 28px rgba(25,230,160,.18); border-color: rgba(25,230,160,.5); }
.cal-day.loss:hover, .cal-day.loss.selected { box-shadow: inset 3px 0 0 var(--neg), 0 10px 28px rgba(255,77,109,.18); border-color: rgba(255,77,109,.5); }
.cal-day.selected { outline: 1px solid var(--lav); outline-offset: 2px; }
.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cal-num { font-family: var(--heading); font-size: 1rem; font-weight: 700; color: rgba(var(--t-245-241-255), .55); line-height: 1; }
.cal-day.has .cal-num { color: var(--text); }
.cal-day.today .cal-num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: var(--text); color: rgb(var(--t-26-11-51)); box-shadow: 0 0 16px rgba(var(--t-216-196-255), .55); }
.cal-body { display: flex; flex-direction: column; gap: 5px; }
.cal-pnl { font-family: var(--display); font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.cal-pnl.pos, .cal-pnl.neg { text-shadow: none; }
.cal-meta { font-family: var(--font); font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-week {
  position: relative; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; gap: 4px; text-align: right;
  background: linear-gradient(160deg, rgba(var(--t-168-85-247), .12), rgba(var(--t-109-40-217), .05));
  border: 1px solid rgba(var(--t-168-85-247), .22); animation: dayIn .5s var(--ease) both;
}
.cal-week.up { border-color: rgba(25,230,160,.3); }
.cal-week.down { border-color: rgba(255,77,109,.3); }
.cal-week.none { background: rgba(255,255,255,.015); border-color: rgba(255,255,255,.05); }
.cw-label { font-family: var(--font); font-size: .64rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cal-week strong { font-family: var(--display); font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cw-meta { font-family: var(--font); font-size: .66rem; color: var(--muted); }
.month-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.month-stats .ms { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.05); }
.month-stats .ms.wide { grid-column: 1 / -1; text-align: center; background: linear-gradient(135deg, rgba(var(--t-216-196-255), .07), rgba(var(--t-168-85-247), .08)); }
.month-stats span { display: block; font-family: var(--mono); font-size: .6rem; letter-spacing: .14em; color: var(--muted); margin-bottom: 4px; }
.month-stats strong { font-family: var(--display); font-size: 1.05rem; }
.month-stats .ms.wide strong { font-size: 1.7rem; }
.year-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.ys { padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.06); }
.ys span { display: block; font-family: var(--font); font-size: .66rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ys strong { font-family: var(--display); font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ys strong em { font-style: normal; font-size: .9rem; color: var(--muted); }
.ys small { display: block; font-size: .72rem; color: var(--muted); margin-top: 3px; }
.ys small::first-letter { text-transform: uppercase; }
.ys.main { background: linear-gradient(150deg, rgba(var(--t-168-85-247), .22), rgba(var(--t-109-40-217), .06)); border-color: rgba(var(--t-168-85-247), .3); }
.year-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.ym { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; padding: 12px 6px 12px; border-radius: 14px; border: 1px solid transparent; transition: background .25s, border-color .25s, transform .3s var(--ease); }
.ym:hover { background: rgba(var(--t-216-196-255), .04); border-color: rgba(255,255,255,.06); transform: translateY(-2px); }
.ym.current { background: linear-gradient(180deg, rgba(var(--t-168-85-247), .16), rgba(var(--t-168-85-247), .03)); border-color: rgba(var(--t-216-196-255), .35); }
.ym .ym-val { font-family: var(--display); font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; min-height: 1em; }
.ym .ym-val.pos, .ym .ym-val.neg { text-shadow: none; }
.ym .ym-bar-wrap {
  position: relative; width: 100%; max-width: 40px; height: 150px; display: flex; flex-direction: column; border-radius: 10px;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 15px), rgba(255,255,255,.015);
}
.ym .ym-half { flex: 1; display: flex; padding: 0 5px; }
.ym .ym-half.top { align-items: flex-end; }
.ym .ym-half.bottom { align-items: flex-start; border-top: 1px solid rgba(var(--t-216-196-255), .25); }
.ym .ym-bar { width: 100%; height: 0; transition: height 1.1s var(--ease); }
.ym .ym-half.top .ym-bar { border-radius: 8px 8px 2px 2px; }
.ym .ym-half.bottom .ym-bar { border-radius: 2px 2px 8px 8px; }
.ym .ym-bar.pos { background: linear-gradient(0deg, rgba(25,230,160,.25), var(--pos)); box-shadow: 0 0 16px rgba(25,230,160,.35); }
.ym .ym-bar.neg { background: linear-gradient(180deg, rgba(255,77,109,.25), var(--neg)); box-shadow: 0 0 16px rgba(255,77,109,.35); }
.ym .ym-name { font-family: var(--heading); font-size: .86rem; font-weight: 700; color: var(--text); text-transform: capitalize; }
.ym .ym-count { font-family: var(--font); font-size: .64rem; color: var(--muted); margin-top: -6px; }

/* ================= ESTRATEGIA ================= */
.rules-editor { list-style: none; display: flex; flex-direction: column; gap: 8px; counter-reset: r; margin-bottom: 12px; }
.rules-editor li { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; counter-increment: r; animation: rowIn .4s var(--ease) both; }
.rules-editor li::before { content: counter(r, decimal-leading-zero); font-family: var(--mono); font-size: .76rem; color: var(--lav); }
.rules-editor input { padding: 9px 12px; font-size: .86rem; }
.rules-editor button, .chip button { color: var(--muted); width: 30px; height: 30px; border-radius: 8px; transition: all .2s; }
.rules-editor button:hover, .chip button:hover { color: var(--neg); background: rgba(255,77,109,.1); }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row input { padding: 9px 12px; font-size: .86rem; }
.move-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.move-form .dir-toggle, .move-form .span-full { grid-column: 1 / -1; }
.moves { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.move-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.06); }
.move-item strong { font-family: var(--display); font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; display: block; text-shadow: none; }
.move-item span { font-size: .75rem; color: var(--muted); }
.move-item button { color: var(--muted); width: 30px; height: 30px; border-radius: 8px; }
.move-item button:hover { color: var(--neg); background: rgba(255,77,109,.1); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 12px; border-radius: 999px; font-family: var(--mono); font-size: .78rem; border: 1px solid var(--border); background: rgba(var(--t-216-196-255), .05); animation: dayIn .35s var(--ease) both; }
.chip button { width: 24px; height: 24px; border-radius: 50%; font-size: .8rem; }
.danger-zone { border-color: rgba(255,77,109,.15); }

/* ================= MODAL ================= */
.modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; visibility: hidden; pointer-events: none; }
.modal.open { visibility: visible; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(var(--t-3-2-6), .7); backdrop-filter: blur(6px); opacity: 0; transition: opacity .35s; }
.modal.open .modal-backdrop { opacity: 1; }
.modal-box {
  position: relative; width: min(760px, 100%); max-height: 90vh; overflow-y: auto;
  background: linear-gradient(160deg, rgba(var(--t-24-14-40), .97), rgba(var(--t-10-6-18), .97));
  border: 1px solid var(--border-hi); border-radius: 20px; padding: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 60px rgba(var(--t-216-196-255), .12);
  opacity: 0; transform: translateY(30px) scale(.95); transition: opacity .35s var(--ease), transform .45s var(--ease);
}
.modal.open .modal-box { opacity: 1; transform: none; }
.modal-box.small { width: min(420px, 100%); }
.modal-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); border: 1px solid rgba(255,255,255,.08); transition: all .2s; z-index: 2; }
.modal-close:hover { color: var(--neg); border-color: var(--neg); transform: rotate(90deg); }
.md-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; padding-right: 40px; }
.md-head h3 { font-family: var(--heading); font-size: 1.9rem; font-weight: 700; letter-spacing: .03em; }
.md-pnl { margin-left: auto; font-family: var(--display); font-size: 1.6rem; font-weight: 700; }
.md-route { display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: center; gap: 12px; padding: 18px; border-radius: 14px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.06); margin-bottom: 16px; }
.md-route .mr-node span { display: block; font-family: var(--mono); font-size: .6rem; letter-spacing: .18em; color: var(--muted); }
.md-route .mr-node strong { display: block; font-family: var(--mono); font-size: 1.1rem; margin: 3px 0; }
.md-route .mr-node small { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.md-route .mr-node.exit { text-align: right; }
.md-route .mr-mid { text-align: center; }
.md-route .mr-line { height: 2px; background: linear-gradient(90deg, var(--lav), var(--purple)); position: relative; margin: 8px 0; }
.md-route .mr-line::after { content: '▶'; position: absolute; right: -4px; top: -8px; font-size: .7rem; color: var(--purple); }
.md-route .mr-mid strong { font-family: var(--display); font-size: 1rem; }
.md-route .mr-mid small { display: block; font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.md-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.md-grid div { padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.05); }
.md-grid span { display: block; font-family: var(--mono); font-size: .58rem; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.md-grid strong { font-family: var(--mono); font-size: .9rem; }
.md-section { margin-bottom: 18px; }
.md-section h4 { font-family: var(--mono); font-size: .68rem; letter-spacing: .18em; color: var(--lav); margin-bottom: 10px; text-transform: uppercase; }
.md-rules { display: flex; flex-direction: column; gap: 6px; }
.md-rule { display: flex; align-items: center; gap: 10px; font-size: .86rem; padding: 8px 12px; border-radius: 10px; }
.md-rule.met { background: rgba(25,230,160,.06); }
.md-rule.unmet { background: rgba(255,77,109,.06); }
.md-rule b { font-family: var(--mono); width: 20px; text-align: center; }
.md-rule.met b { color: var(--pos); }
.md-rule.unmet b { color: var(--neg); }
.md-text { font-size: .9rem; line-height: 1.6; color: rgb(var(--t-221-212-239)); white-space: pre-wrap; padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.025); border-left: 2px solid var(--purple); }
.md-shot img { display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: 12px; border: 1px solid var(--border); background: rgba(0,0,0,.25); cursor: zoom-in; }
.md-shot .shot-link { font-size: .8rem; color: var(--lav); word-break: break-all; }
.lightbox { position: fixed; inset: 0; z-index: 800; display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: rgba(var(--t-3-2-6), .9); backdrop-filter: blur(10px); cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1280px, 94vw); max-height: 90vh; object-fit: contain; border-radius: 12px; box-shadow: 0 24px 80px rgba(0,0,0,.65); cursor: default; }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 12px; color: #fff; font-size: 1.1rem; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.lightbox-close:hover { background: rgba(255,255,255,.16); }
.md-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.confirm-box h3 { font-family: var(--heading); font-size: 1.35rem; font-weight: 700; margin-bottom: 10px; }
.confirm-box p { color: var(--muted); font-size: .9rem; margin-bottom: 20px; line-height: 1.5; }

/* ================= TOASTS ================= */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 900; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-radius: 12px; min-width: 260px;
  background: rgba(var(--t-10-6-18), .95); border: 1px solid var(--border-hi); font-size: .88rem;
  box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 20px rgba(var(--t-216-196-255), .15);
  animation: toastIn .45s var(--ease) both;
}
.toast.error { border-color: rgba(255,77,109,.5); box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 20px rgba(255,77,109,.2); }
.toast.out { animation: toastOut .35s var(--ease) forwards; }
.toast i { font-style: normal; color: var(--lav); font-weight: 700; }
.toast.error i { color: var(--neg); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ================= RESPONSIVE ================= */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .form-grid.cols-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1100px) {
  .grid-2-1, .grid-1-1, .cal-layout, .trade-form { grid-template-columns: 1fr; }
  .form-side { position: static; }
  .sessions { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row;
    padding: 8px; border-right: none; border-top: 1px solid var(--border); gap: 0;
  }
  .brand, .sidebar-footer { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 4px; padding: 8px 6px; font-size: .62rem; }
  .nav-item::before { left: 50%; top: 0; width: 0; height: 3px; transform: translateX(-50%); transition: width .35s var(--ease); }
  .nav-item.active::before { width: 50%; height: 3px; }
  .main { padding: 18px 14px 100px; }
  .grid-3, .form-grid, .form-grid.cols-4, .md-grid { grid-template-columns: 1fr 1fr; }
  .route { grid-template-columns: 1fr; }
  .route-line { height: 40px; width: 2px; margin: 0 auto; background: linear-gradient(180deg, var(--lav), var(--purple)); }
  .route-line span { left: -4px !important; animation: travelY 2.2s ease-in-out infinite; }
  @keyframes travelY { 0% { top: 0; } 100% { top: calc(100% - 10px); } }
  .cal-grid { grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .cal-week, .cal-dow.week-h { display: none; }
  .cal-day { min-height: 70px; padding: 6px; }
  .cal-meta { display: none; }
  .cal-side { grid-template-columns: 1fr; }
  .cal-num { font-size: .8rem; }
  .cal-pnl { font-size: .7rem; }
  .year-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 14px; }
  .year-summary { grid-template-columns: 1fr 1fr; }
  .topbar-right .btn span { display: none; }
  .md-route { grid-template-columns: 1fr; text-align: center; }
  .md-route .mr-node.exit { text-align: center; }
}
@media (max-width: 860px) {
  /* Barra superior: título a la izquierda, acciones compactas a la derecha */
  .topbar { flex-wrap: nowrap; gap: 10px; margin-bottom: 18px; }
  .topbar h2 { font-size: clamp(1.5rem, 7vw, 2.4rem); min-width: 0; white-space: nowrap; }
  .topbar-right { flex-wrap: nowrap; gap: 8px; flex-shrink: 0; }
  .clock { display: none; }
  .topbar-right .btn { height: 40px; padding: 0 14px; }
  .topbar-right .btn-primary { width: 44px; padding: 0; }

  /* Navegación inferior */
  .sidebar { padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: rgba(var(--t-10-6-18), .94); }
  .nav { gap: 2px; }
  .nav-item { flex: 1 1 0; min-width: 0; padding: 8px 2px; border-radius: 12px; font-size: .62rem; text-align: center; }
  .nav-item:hover { transform: none; }
  .nav-item.active { background: linear-gradient(180deg, rgba(var(--t-168-85-247), .3), rgba(var(--t-109-40-217), .08)); }
  .nav-item span { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-item[data-short] span { font-size: 0; }
  .nav-item[data-short] span::after { font-size: .62rem; }
  .nav-item[data-short="Nueva"] span::after { content: 'Nueva'; }
  .nav-item[data-short="Trades"] span::after { content: 'Trades'; }
  .nav-item[data-short="Agenda"] span::after { content: 'Agenda'; }
  .nav-item[data-short="Inicio"] span::after { content: 'Inicio'; }
  .nav-sep { display: none; }
  .nav-mode, html.bt .nav-mode { border: 0; }
  .mode-badge { margin-bottom: 4px; padding: 3px 8px; font-size: .56rem; }

  .main { padding: 16px 12px calc(96px + env(safe-area-inset-bottom)); }
  .card { padding: 16px; }

  /* Dashboard */
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 14px; }
  .toolbar .segmented { width: 100%; }
  .toolbar .segmented button { flex: 1 0 auto; padding: 8px 10px; }
  .strategy-tag { text-align: center; font-size: .64rem; letter-spacing: .1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kpi-grid { gap: 10px; margin-bottom: 14px; }
  .kpi { padding: 14px; }
  .kpi .k-label { font-size: .56rem; letter-spacing: .1em; gap: 6px; }
  .kpi .k-icon svg { width: 15px; height: 15px; }
  .kpi .k-value { font-size: 1.3rem; margin: 8px 0 3px; }
  .kpi .k-foot { font-size: .64rem; line-height: 1.35; }
  .kpi.main-kpi, .kpi:last-child:nth-child(even) { grid-column: 1 / -1; }
  .kpi.main-kpi .k-value { font-size: 1.8rem; }

  /* Operaciones */
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
  .filters .search, .filters input[type="month"], .filters-actions { grid-column: 1 / -1; }
  .filters select, .filters input[type="month"] { width: 100%; min-width: 0; }
  .filters-actions { margin-left: 0; display: grid; grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .trades-bar { flex-direction: column; align-items: stretch; gap: 10px; min-width: 0; }
  .table-summary { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding-bottom: 2px; scrollbar-width: none; min-width: 0; max-width: 100%; }
  .table-summary::-webkit-scrollbar { display: none; }
  .sum-chip { flex-shrink: 0; padding: 8px 12px; font-size: .72rem; }
  .view-toggle { width: 100%; }
  .view-toggle button { flex: 1; justify-content: center; }
  .trade-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tc-body { padding: 10px 12px 12px; gap: 6px; }
  .tc-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .tc-head h4 { font-size: 1.05rem; }
  .tc-pnl { font-size: .95rem; }
  .tc-meta { font-size: .68rem; }
  .tc-meta .dir-tag { font-size: .6rem; padding: 3px 6px; }
  .tc-actions { display: none; }

  /* Calendario */
  .cal-head { flex-wrap: wrap; gap: 8px; }
  .cal-head h3 { min-width: 0; flex: 1; font-size: 1.15rem; }
  .cal-grid { gap: 4px; }
  .cal-dow { font-size: .58rem; letter-spacing: .06em; text-align: center; padding: 0 0 6px; }
  .cal-day { min-height: 56px; padding: 5px; border-radius: 10px; gap: 2px; }
  .cal-day.today .cal-num { min-width: 20px; height: 20px; padding: 0 4px; font-size: .7rem; }
  .cal-pnl { font-size: .6rem; letter-spacing: -.02em; }
  .ys { padding: 12px; }
  .ys strong { font-size: 1.1rem; }
  .year-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; row-gap: 12px; }
  .ym { padding: 10px 4px; }
  .ym .ym-bar-wrap { height: 90px; }
  .ym .ym-count { white-space: nowrap; font-size: .6rem; }

  /* Estrategia y capital */
  .rules-editor li { grid-template-columns: 24px 1fr auto; gap: 6px; }
  .add-row { flex-direction: column; }
  .add-row .btn { width: 100%; }

  /* Ficha de operación */
  .modal { padding: 10px; align-items: flex-end; }
  .modal-box { padding: 20px 16px; max-height: 88vh; border-radius: 18px; }
}
@media (max-width: 520px) {
  .grid-3, .form-grid, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: auto; }
  .compliance-top { grid-template-columns: 1fr; justify-items: center; }
}
@media (max-width: 360px) {
  .trade-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
