/* SkyView 2.5 — estilos nuevos (se cargan después de app.css y lo extienden; no lo reemplazan). */

/* ---------- lista: ticker / nombre · precio / variación · fuente y estado ---------- */
.wl .row:not(.sec) { grid-template-columns: 26px minmax(0,1fr) auto 64px; grid-template-rows: auto auto; column-gap: 8px; row-gap: 0; padding: 6px 8px 6px 8px; }
.wl .row:not(.sec) > .logo { grid-row: 1 / span 2; }
.wl .row:not(.sec) > .s { grid-row: 1 / span 2; }
.wl .row:not(.sec) > .s small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl .row:not(.sec) > .mk { grid-column: 3 / span 2; grid-row: 2; justify-self: end; }
.mk { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--faint); white-space: nowrap; letter-spacing: .02em; }
.mk i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.mk.on i { background: var(--up); box-shadow: 0 0 0 2px color-mix(in srgb, var(--up) 22%, transparent); }
.mk.off i { background: var(--faint); }
.logo { contain: strict; }
.logo img { pointer-events: none; }
/* búsqueda */
.res .open { flex-direction: row; align-items: center; gap: 10px; }
.res .rtx { display: flex; flex-direction: column; min-width: 0; }
.res .rtx b { font-size: 15px; letter-spacing: .02em; }
.res .rtx small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .p { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

/* ---------- panel de indicadores: navegación · tarjetas · detalle ---------- */
.modal.indm { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(4,6,14,.46); }
.sheet.indp { width: min(1120px, 96vw); height: min(740px, 90vh); max-height: none; display: grid; grid-template-rows: auto minmax(0,1fr) auto; padding: 0; overflow: hidden;
  background: var(--panel) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.indp-head { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.indp-head h2 { margin: 0; font-size: 17px; letter-spacing: .01em; white-space: nowrap; }
.indp-q { flex: 1; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border-radius: 10px; background: var(--raise); border: 1px solid var(--line); color: var(--muted); }
.indp-q:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.indp-q input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--fg); font-size: 14.5px; height: 100%; }
.indp-q input::-webkit-search-cancel-button { display: none; }
kbd { font: 600 10.5px/1 var(--mono); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--raise); color: var(--muted); min-width: 18px; text-align: center; display: inline-block; }
.indp-body { display: grid; grid-template-columns: 196px minmax(0,1fr) 300px; min-height: 0; }
.indp-nav { overflow-y: auto; padding: 10px 8px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; overscroll-behavior: contain; }
.indp-ng { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 12px 10px 5px; font-weight: 700; }
.indp-ng:first-child { padding-top: 4px; }
.indp-ni { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--muted); text-align: left; }
.indp-ni span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.indp-ni small { color: var(--faint); font: 500 11.5px var(--mono); }
.indp-ni:hover { background: var(--raise); }
.indp-ni[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.indp-ni[aria-current="true"] span { color: var(--fg); font-weight: 650; }
.indp-main { overflow-y: auto; padding: 14px; overscroll-behavior: contain; min-width: 0; }
.indp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
.icard { position: relative; display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 9px 10px 11px; border-radius: 12px; background: var(--raise); border: 1px solid var(--line);
  content-visibility: auto; contain-intrinsic-size: 176px 150px; transition: border-color .12s, background .12s, transform .12s; }
.icard:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.icard.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--raise)); box-shadow: 0 0 0 1px var(--accent) inset; }
.icard b { font-size: 13.5px; line-height: 1.25; margin-top: 6px; }
.icard small { font-size: 11.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icard .istar { position: absolute; top: 8px; right: 8px; color: var(--faint); opacity: 0; }
.icard.fav .istar { opacity: 1; color: #f5c451; }
.icard.fav .istar svg { fill: currentColor; }
.ipv { display: block; height: 46px; border-radius: 7px; background: color-mix(in srgb, var(--bg) 70%, transparent); overflow: hidden; }
.ipv.big { height: 120px; border-radius: 10px; margin-bottom: 10px; }
.ipv svg { display: block; }
.indp-det { border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.indp-det h3 { margin: 2px 0 2px; font-size: 19px; }
.indp-det p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.indp-ins { margin: 6px 0 0; padding: 0 0 0 16px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.indp-acts { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.indp-acts .btn { justify-content: center; height: 40px; gap: 8px; }
.indp-acts .btn kbd { background: transparent; border-color: currentColor; color: inherit; opacity: .7; }
.indp-foot { display: flex; align-items: center; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.indp-foot span { display: inline-flex; align-items: center; gap: 4px; }
.indp-cnt { margin-left: auto; color: var(--faint); font-family: var(--mono); font-size: 11.5px; }
.indp-extra .plist, .qscripts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
@media (max-width: 1000px) { .indp-body { grid-template-columns: 180px minmax(0,1fr); } .indp-det { display: none; } }
@media (max-width: 860px) {
  .sheet.indp { width: 100vw; height: 100%; max-height: 100dvh; border-radius: 0; }
  .indp-body { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  .indp-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; gap: 6px; scrollbar-width: none; }
  .indp-ng { display: none; }
  .indp-ni { flex: none; height: 32px; border: 1px solid var(--line); border-radius: 99px; }
  .indp-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; }
  .indp-foot { display: none; }
  .indp-head kbd { display: none; }
}
.indp-q { min-width: 0; }
@media (max-width: 860px) {
  .modal.indm { padding: 0; }
  .sheet.indp { width: 100%; }
  .indp-head { padding: 10px 10px 10px 12px; gap: 8px; }
  .indp-head h2 { display: none; }
  .icard::after { content: "+"; position: absolute; right: 8px; bottom: 8px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
}

/* ---------- configuración de dibujos ---------- */
.lv-row { display: grid; grid-template-columns: 18px 64px minmax(60px,1fr) 30px 66px 92px 26px 26px; gap: 5px; align-items: center; }
.lv-row .inp.sm { min-width: 0; }
.ib.flipu svg { transform: rotate(180deg); }
#mDraw .sheet { width: min(520px, 100%); }
#mDraw textarea { width: 100%; resize: vertical; }
.ctl { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- calidad visual: en «Rendimiento» no hay desenfoques ni animaciones ---------- */
body.q-performance *, body.q-performance *::before, body.q-performance *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
body.q-performance .menu, body.q-performance .sheet, body.q-performance .toast, body.q-performance .chart-news, body.q-performance .lv-panel { background: var(--panel) !important; }
body.q-performance .modal { background: rgba(4,6,14,.62); }
body.q-balanced .modal { backdrop-filter: none; -webkit-backdrop-filter: none; }
body.no-motion *, body.no-motion *::before, body.no-motion *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }

/* ---------- configuración del gráfico: navegación con íconos ---------- */
.set-nav button { display: flex; align-items: center; gap: 9px; }
.set-nav button svg { flex: none; opacity: .8; }

/* ---------- leyenda: fondo, plegado, áreas táctiles cómodas ---------- */
.pleg { background: var(--leg-bg, transparent); border-radius: 8px; }
.legends.has-bg .pleg { padding: 4px 8px 5px; margin: -2px 0 0 -4px; }
.lfold { pointer-events: auto; display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px 0 2px; border-radius: 5px; color: var(--muted); font-size: 11.5px; margin: 0 0 1px -4px; width: max-content; }
.lfold:hover { background: var(--raise); color: var(--fg); }
.lfold svg { transition: transform .15s; }
.lfold.on svg { transform: rotate(-90deg); }
.pleg.folded .lrow { display: none; }
.lrow .lacts .ib.sm { width: 26px; height: 26px; min-width: 26px; border-radius: 6px; }
.lrow .lacts .ib.sm svg { width: 15px; height: 15px; }
.lrow .lacts .ib.sm:hover { background: var(--hover); }
.lrow .lname { cursor: grab; }
.lrow.dragging { opacity: .6; }
@media (pointer: coarse) { .lrow .lacts .ib.sm { width: 34px; height: 34px; min-width: 34px; } .lrow { min-height: 30px; } }
.pane-drop { position: absolute; z-index: 6; pointer-events: none; border: 2px dashed var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, transparent); display: grid; place-items: center; font-size: 12.5px; color: var(--accent); font-weight: 650; }
.pane-drop.bad { border-color: var(--faint); background: transparent; color: var(--muted); }
.pane-drop.new { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.menu.ctx { min-width: 240px; }
.pleg.main .lfold { margin-top: 1px; }

/* ---------- buscador de herramientas y favoritas ---------- */
.tsearch { position: fixed; z-index: 70; width: 290px; max-height: min(560px, calc(100vh - 16px)); display: flex; flex-direction: column; border-radius: 12px; overflow: hidden;
  background: var(--glass); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); border: 1px solid var(--glass-b); box-shadow: var(--shadow); }
.ts-q { display: flex; align-items: center; gap: 8px; margin: 8px; height: 34px; padding: 0 10px; border-radius: 8px; background: var(--raise); border: 1px solid var(--line); color: var(--muted); }
.ts-q:focus-within { border-color: var(--accent); }
.ts-q input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--fg); }
.ts-list { overflow-y: auto; padding: 0 6px 6px; overscroll-behavior: contain; flex: 1; }
.ts-h { display: flex; align-items: center; gap: 8px; padding: 10px 6px 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.ts-h::after { content: ""; flex: 1; height: 1px; background: var(--line); order: 1; }
.ts-h small { order: 2; font: 600 10.5px var(--mono); padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; }
.ts-i { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 6px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.ts-i .ts-n { flex: 1; min-width: 0; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.ts-i:hover, .ts-i.sel { background: var(--raise); }
.ts-i.sel { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.ts-i.cur .ts-n { color: var(--accent); }
.ts-k { display: inline-flex; gap: 3px; }
.ts-star { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--faint); opacity: 0; }
.ts-i:hover .ts-star, .ts-star.on { opacity: 1; }
.ts-star.on { color: #f5c451; } .ts-star.on svg { fill: currentColor; }
.ts-foot { padding: 7px 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); }
.tfavs { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.tfavs .ib.fav { position: relative; touch-action: none; }
.tfavs .ib.fav::after { content: ""; position: absolute; right: 3px; top: 3px; width: 4px; height: 4px; border-radius: 50%; background: #f5c451; }
.tfavs .ib.dragging { opacity: .6; cursor: grabbing; }
#toolsGrid > .search { margin: 4px 0 6px; }

/* ---------- atajos de teclado ---------- */
.keys-top { padding-bottom: 6px; }
.krow { display: flex; align-items: center; gap: 12px; padding: 7px 16px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.krow .kname { flex: 1; min-width: 0; }
.kkeys { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.kbtn { display: inline-flex; align-items: center; gap: 3px; min-height: 28px; padding: 2px 6px; border-radius: 7px; border: 1px solid var(--line); background: var(--raise); }
.kbtn:hover { border-color: var(--accent); }
.kbtn.add { color: var(--faint); min-width: 28px; justify-content: center; }
.kbtn.rec { border-color: var(--accent); color: var(--accent); font-size: 12px; }
.kchips { display: inline-flex; gap: 3px; }

/* ---------- celular y tablet: diseño propio, no la versión de escritorio achicada ---------- */
@media (max-width: 860px) {
  html, body { height: 100%; height: 100dvh; }
  .app { height: 100dvh; }
  .chart-ctl { min-width: 0; flex: 1; gap: 4px; }
  .tfs { overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .tfs::-webkit-scrollbar { display: none; }
  .tfs .tf { flex: none; min-width: 38px; height: 34px; }
  .sym-btn { height: 36px; }
  .ib, .ind-btn, .type-btn { min-width: 38px; min-height: 38px; }
  /* barra de estilo del dibujo: tira deslizable sobre la barra inferior */
  .dstyle { left: 6px !important; right: 6px; bottom: 8px; top: auto; max-width: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .dstyle::-webkit-scrollbar { display: none; }
  .tool-chip { left: 8px; right: 8px; bottom: 10px; top: auto; max-width: none; transform: none; }
  .legends .lrow { font-size: 12.5px; }
  .phead { font-size: 12px; }
  .phead .lsym { font-size: 14px; }
}
/* celular apaisado (poca altura): barra inferior compacta solo con íconos, barra superior más baja */
@media (max-width: 1000px) and (max-height: 520px) and (orientation: landscape) {
  :root { --top-h: 42px; }
  .brand, .top-icons, .tools, .rail, .feed span, .views { display: none; }
  .main { grid-template-columns: 1fr !important; }
  .bnav { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--panel); border-top: 1px solid var(--line); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .bnav button { flex-direction: row; justify-content: center; gap: 6px; padding: 4px 0; font-size: 12px; height: 40px; }
  .bnav button span { display: none; }
  .side:not(.open) { display: none !important; }
  .side.open { position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 70vw); z-index: 30; display: flex; box-shadow: var(--shadow); padding-bottom: 42px; }
  .lrow { min-height: 22px; }
}
/* tablet: panel lateral más angosto, iconos táctiles */
@media (min-width: 861px) and (max-width: 1200px) {
  :root { --side-w: 280px; }
  .views .view-btn span { display: none; }
}
@media (pointer: coarse) {
  .tools .ib { width: 40px; height: 40px; }
  .tfs .tf { min-height: 34px; }
}
