/* SpaceView 2.7 — estilos nuevos (se cargan después de v26 y no reemplazan nada anterior) */

/* ---------- Search: principal + variantes ---------- */
.res { grid-template-columns: minmax(0,1fr) auto 30px 34px; }
.res .rtx small.meta { font-size: 11.5px; opacity: .8; }
.res .xp { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 1px; border-radius: 8px; color: var(--muted); position: relative; }
.res .xp:not(:disabled):hover { background: var(--raise); color: var(--text); }
.res .xp:disabled { visibility: hidden; }
.res .xp svg { transition: transform .16s ease; }
.res .xp.on svg { transform: rotate(180deg); }
.res .xp small { position: absolute; right: 0; top: 0; font-size: 9.5px; line-height: 1; color: var(--muted); }
.res-vars { border-left: 2px solid color-mix(in srgb, var(--accent, #089981) 55%, transparent); margin-left: 26px; background: color-mix(in srgb, var(--raise) 45%, transparent); }
.res.var { padding-top: 5px; padding-bottom: 5px; }
.res.var .rtx b { font-size: 13.5px; }
@media (prefers-reduced-motion: reduce) { .res .xp svg { transition: none; } }
.sfail { padding: 6px 16px; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .sfilters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .sfilters::-webkit-scrollbar { display: none; }
  .sfilters select { flex: 0 0 auto; max-width: 150px; }
}

/* ---------- eventos del gráfico en la leyenda ---------- */
.hev { font-size: 11.5px; color: var(--muted); padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--raise) 70%, transparent); white-space: nowrap; }
.hev[hidden] { display: none; }

/* ---------- perfiles de configuración de indicadores ---------- */
.prof-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 60%; }
.prof-btn span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-btn .caret { opacity: .6; font-size: 11px; }

/* ---------- NRM: líneas de posición / SL / TP / órdenes sobre el gráfico ---------- */
.nrm-layer { position: absolute; left: 0; top: 0; right: 0; height: 0; pointer-events: none; z-index: 6; }
.nrm-row { position: absolute; left: 0; top: 0; height: 0; will-change: transform; }
.nrm-row[hidden] { display: none; }
.nrm-row .ln { position: absolute; left: 0; right: 0; top: 0; border-top: 1px solid var(--c); opacity: .9; }
.nrm-row[data-kind="sl"] .ln, .nrm-row[data-kind="tp"] .ln, .nrm-row[data-kind="order"] .ln { border-top-style: dashed; }
.nrm-row .lab { position: absolute; right: 64px; top: 0; transform: translateY(-50%); display: inline-flex; align-items: stretch; height: 22px; pointer-events: auto; cursor: ns-resize;
  border: 1px solid var(--c); border-radius: 5px; background: color-mix(in srgb, var(--panel) 92%, transparent); font: 600 11.5px/1 "Geist Mono", ui-monospace, monospace; color: var(--text); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.25); user-select: none; touch-action: none; }
.nrm-row .lab .q { display: inline-flex; align-items: center; padding: 0 7px; background: var(--c); color: #fff; }
.nrm-row .lab .pl { display: inline-flex; align-items: center; padding: 0 8px; white-space: nowrap; }
.nrm-row .lab .pl.up { color: var(--up); } .nrm-row .lab .pl.dn { color: var(--down); }
.nrm-row .lab .x { width: 22px; border-left: 1px solid color-mix(in srgb, var(--c) 60%, transparent); color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
.nrm-row .lab .x:hover { color: var(--text); background: var(--raise); }
.nrm-row.drag .lab { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent); }
@media (pointer: coarse) { .nrm-row .lab { height: 28px; } .nrm-row .lab .x { width: 30px; } }

/* ---------- Inicio: Mercados (lista base propia), noticias y eventos ---------- */
.hm-mk .hm-sh { display: flex; align-items: center; gap: 8px; }
.hm-mk .hm-sh .grow { flex: 1; }
.hm-hint { margin: 2px 0 8px; }
.hm-mkgrid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.hm-mkgrid .hm-q { height: 44px; cursor: pointer; user-select: none; touch-action: pan-y; }
.hm-mkgrid .hm-qt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.hm-mkgrid .hm-qt small { font-size: 11px; }
.hm-mkgrid .hm-qv { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.hm-mkgrid .hm-c { font-size: 11.5px; }
.hm-q.dragging { opacity: .55; }
.hm-q.drop { box-shadow: inset 2px 0 0 var(--accent); }
.hm-news .hm-nl, .hm-ev .hm-evl { display: flex; flex-direction: column; gap: 2px; }
.hm-n { display: flex; flex-direction: column; gap: 2px; padding: 7px 6px; border-radius: 8px; color: var(--text); text-decoration: none; }
.hm-n:hover { background: var(--hover); }
.hm-n b { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.hm-evi { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; text-align: left; }
.hm-evi:hover { background: var(--hover); }
.hm-evi .grow { flex: 1; }
@media (max-width: 640px) { .hm-mkgrid { grid-template-columns: 1fr; } .hm-mkgrid .hm-q { height: 46px; } }
.hm-mkgrid .hm-qt b, .hm-mkgrid .hm-qt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Watchlist más compacta (más activos a la vista) ---------- */
.wl .row:not(.sec) { padding: 3px 8px; column-gap: 7px; grid-template-columns: 22px minmax(0,1fr) auto 58px; }
.wl .row:not(.sec) > .s b { font-size: 13px; }
.wl .row:not(.sec) > .s small { font-size: 11px; line-height: 1.15; }
.wl .row:not(.sec) .p, .wl .row:not(.sec) .chg { font-size: 12.5px; }
.wl .row:not(.sec) > .mk { font-size: 10px; }
.side-head { cursor: grab; }
.side.wl-dragout { transition: none !important; cursor: grabbing; }
@media (pointer: coarse) { .wl .row:not(.sec) { padding: 6px 8px; } }
.wl .row:not(.sec) > .s b, .wl .row:not(.sec) > .s small { line-height: 1.2; display: block; }
.wl .row:not(.sec) .p, .wl .row:not(.sec) .chg, .wl .row:not(.sec) > .mk { line-height: 1.2; }
/* sin pestañas de vista: la búsqueda y el orden pasan a la cabecera y la fila de herramientas solo aparece al filtrar */
.wl-tools.compact { padding: 0 8px 4px; min-height: 0; }
.wl-tools.compact:not(:has(.wl-find.open)) { display: none; }
.side-head .list-sel { flex: 1 1 auto; min-width: 0; max-width: none; }

/* ---------- Comunidad: landing (3 opciones + top 3) y muro del perfil ---------- */
.cm-homebtn { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; }
.cm-land { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; margin: 0 auto; width: 100%; }
.cm-lcards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.cm-lcard { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 22px 20px; border-radius: 16px; min-height: 220px; position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.cm-lcard::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); pointer-events: none; }
.cm-lcard[data-area="galaxies"]::before { background: radial-gradient(circle, rgba(255, 213, 79, .2), transparent 70%); }
.cm-lcard[data-area="starask"]::before { background: radial-gradient(circle, rgba(0, 188, 212, .2), transparent 70%); }
.cm-lcard:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.cm-lcard b { font-size: 19px; letter-spacing: .04em; }
.cm-lcard p { margin: 0; color: var(--text); opacity: .86; line-height: 1.45; font-size: 14px; }
.cm-lic { display: inline-flex; gap: 6px; color: var(--accent); }
.cm-lgo { margin-top: auto; color: var(--accent); font-weight: 600; font-size: 13.5px; }
.cm-top { padding: 16px 18px; border-radius: 16px; }
.cm-top h3 { margin: 0 0 2px; }
.cm-toplist { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.cm-topu { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; text-align: left; }
.cm-topu:hover { background: var(--hover); }
.cm-topu .grow { flex: 1; }
.cm-pos { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.cm-topu:nth-child(1) .cm-pos { background: rgba(255, 213, 79, .22); color: #FFD54F; }
@media (max-width: 860px) { .cm-lcards { grid-template-columns: 1fr; } .cm-lcard { min-height: 0; } .cm-topu .muted.small { display: none; } }
#vCommunity[data-view="home"] .cm-areas { display: none; }

/* ---------- Planes ⭐ ---------- */
.plan-grid.v27 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0; }
.plan-grid.v27 .plan-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 92%, transparent); overflow: hidden; }
.plan-grid.v27 .plan-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-grid.v27 .plan-name { font-size: 16px; letter-spacing: .12em; }
.plan-grid.v27 .plan-tag { margin: 0; min-height: 2.6em; }
.plan-grid.v27 .plan-price { font-size: 18px; font-weight: 700; }
.plan-grid.v27 ul { margin: 4px 0 6px; padding-left: 16px; font-size: 13px; line-height: 1.5; }
.plan-grid.v27 .plan-go { margin-top: auto; }
.plan-cur { margin-top: auto; font-size: 12px; color: var(--accent); font-weight: 600; }
.plan-art { position: relative; height: 74px; margin: -2px 0 2px; }
.plan-art .planet { position: absolute; left: 50%; top: 8px; width: 56px; height: 56px; margin-left: -28px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, var(--p1), var(--p2) 62%, var(--p3)); box-shadow: inset -8px -6px 14px rgba(0,0,0,.35); animation: plan-float 6s ease-in-out infinite; }
.plan-art .ring { position: absolute; left: 50%; top: 31px; width: 94px; height: 14px; margin-left: -47px; border-radius: 50%; border: 2px solid var(--ring, transparent); transform: rotate(-14deg); opacity: .8; animation: plan-float 6s ease-in-out infinite; }
.plan-art .glow { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--p1) 30%, transparent), transparent 60%); filter: blur(6px); }
.plan-card[data-plan="mercury"] { --p1: #d9d6cf; --p2: #8f8a80; --p3: #4b4741; }
.plan-card[data-plan="earth"] { --p1: #7fd3ff; --p2: #1f7ad1; --p3: #0f3d2e; }
.plan-card[data-plan="uranus"] { --p1: #c9fbff; --p2: #4fd1d9; --p3: #1b6f7a; --ring: rgba(190, 245, 250, .7); }
.plan-card[data-plan="jupiter"] { --p1: #ffe1b8; --p2: #d48a4f; --p3: #7a3e1d; --ring: rgba(255, 210, 160, .45); }
.plan-card[data-plan="star"] { --p1: #fff7cf; --p2: #ffcf40; --p3: #c27a00; }
.plan-card[data-plan="star"] .planet { box-shadow: 0 0 22px 6px rgba(255, 207, 64, .45); }
@keyframes plan-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.plan-art .ring { animation-name: plan-float-ring; } @keyframes plan-float-ring { 0%, 100% { transform: rotate(-14deg) translateY(0); } 50% { transform: rotate(-14deg) translateY(-4px); } }
body.no-motion .plan-art .planet, body.no-motion .plan-art .ring { animation: none; }
@media (prefers-reduced-motion: reduce) { .plan-art .planet, .plan-art .ring { animation: none; } }

/* ---------- IA: botón flotante y panel ---------- */
:root { --ai-b: 18px; }
body:has(#app[data-view="chart"]) { --ai-b: 64px; }
.ai-fab { position: fixed; right: 16px; bottom: calc(var(--ai-b) + env(safe-area-inset-bottom)); z-index: 60; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent, #2962ff), #7c4dff); box-shadow: 0 6px 20px rgba(0,0,0,.35); border: 0; cursor: pointer; }
.ai-fab:hover { filter: brightness(1.08); } .ai-fab[aria-expanded="true"] { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent), 0 6px 20px rgba(0,0,0,.35); }
.ai-panel { position: fixed; right: 16px; bottom: calc(var(--ai-b) + 54px + env(safe-area-inset-bottom)); z-index: 61; width: min(400px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - var(--ai-b) - 120px)); display: flex; flex-direction: column; border-radius: 16px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 96%, transparent); box-shadow: 0 18px 48px rgba(0,0,0,.4); overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.ai-head b { display: inline-flex; align-items: center; gap: 6px; } .ai-head .grow { flex: 1; }
.ai-ctx { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.ai-sw { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; }
.ai-log { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.ai-msg { border-radius: 12px; padding: 8px 10px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-msg p { margin: 0 0 6px; } .ai-msg p:last-child { margin: 0; }
.ai-msg.user { align-self: flex-end; max-width: 85%; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.ai-msg.assistant { background: color-mix(in srgb, var(--raise) 70%, transparent); }
.ai-msg h4 { margin: 6px 0 2px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.ai-calcs { margin-top: 6px; font-size: 12px; } .ai-calcs dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; } .ai-calcs dt { color: var(--muted); }
.ai-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); align-items: flex-end; } .ai-form textarea { flex: 1; resize: none; }
.ai-foot { margin: 0; padding: 0 12px 10px; } .ai-empty { padding: 18px 14px; } .tiny { font-size: 11px; }
@media (max-width: 640px) { :root, body:has(#app[data-view="chart"]) { --ai-b: 70px; } .ai-fab { right: 12px; } .ai-panel { right: 8px; left: 8px; width: auto; max-height: calc(100vh - var(--ai-b) - 130px); } }

/* ---------- publicidad ---------- */
.ad-slot { margin: 12px auto; max-width: 1100px; width: 100%; padding: 8px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--line) 80%, transparent); min-height: 120px; contain: content; }
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }   /* §55: espacio reservado (sin saltos de diseño); si no hay anuncio, se oculta */
.ad-lbl { display: block; font-size: 10.5px; margin-bottom: 4px; letter-spacing: .04em; }
.brk-list { display: flex; flex-direction: column; gap: 6px; } .brk { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 8px; align-items: center; } .brk small { grid-column: 1 / -1; }

/* 0.5 · pestaña Pine del panel derecho */
.pine-side-list { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px; overflow: auto; }
.pine-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; }
.pine-row:hover { background: var(--accent-soft); }
.pine-row.on .pine-nm b { color: var(--accent); }
.pine-nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pine-nm b, .pine-nm small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pine-nm small.err { color: var(--down); }
.pine-empty { padding: 10px; font-size: 12px; }
