:root {
  --bg: #0B1020; --panel: #121831; --panel2: #182042; --line: #232B4D;
  --fg: #E8ECF8; --muted: #8A93B5; --ok: #3CF0A6; --bad: #FF5C7A; --amber: #FFB547; --violet: #7C8CFF;
  --gap-xs: 4px; --gap-sm: 8px; --gap-md: 12px; --gap-lg: 20px;
  --fs-cap: 13px; --fs-body: 15px; --fs-head: 18px; --fs-title: 30px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: var(--fs-body); -webkit-font-smoothing: antialiased; }
a { color: #9FB0FF; }
.mk-wrap { max-width: 980px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 32px; display: flex; flex-direction: column; gap: var(--gap-lg); }
.mk-title { font-size: var(--fs-title); font-weight: 700; letter-spacing: -0.03em; margin: 0; background: linear-gradient(90deg, #E8ECF8, #9FB0FF 60%, #3CF0A6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mk-lead { margin: var(--gap-xs) 0 0; color: var(--muted); line-height: 1.5; }
.mk-hint { font-size: var(--fs-cap); color: var(--muted); margin: 0; }
.mk-sm { font-size: var(--fs-cap); margin: 0; line-height: 1.5; }
.mk-live { margin-top: 6px; }
.mk-live::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; vertical-align: 1px; animation: plPulse 2s infinite; }
@keyframes plPulse { 0% { box-shadow: 0 0 0 0 rgba(60,240,166,.55); } 70% { box-shadow: 0 0 0 10px rgba(60,240,166,0); } 100% { box-shadow: 0 0 0 0 rgba(60,240,166,0); } }
@media (prefers-reduced-motion: reduce) { .mk-live::before { animation: none; } }
.mk-pos { color: var(--ok); } .mk-neg { color: var(--bad); }

.mk-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(18,24,49,.85); border: 1px solid var(--line); position: sticky; top: 8px; z-index: 5; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.mk-tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-cap); padding: 9px 6px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s; }
.mk-tabs button[aria-selected="true"] { background: linear-gradient(135deg, #1E2A5A, #22305F); color: #fff; box-shadow: inset 0 0 0 1px #3A4A8A; font-weight: 500; }
.mk-tab { display: flex; flex-direction: column; gap: var(--gap-md); }
.mk-tab[hidden] { display: none; }

.rq-kpi, .rq-m, .mk-card, .mk-panel, .ap2-card { background: linear-gradient(180deg, #151C3A, #111733); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 30px -18px rgba(0,0,0,.8); min-width: 0; }
.rq-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: var(--gap-sm); }
.rq-kpi { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; container-type: inline-size; }
.rq-lab { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); line-height: 1.2; overflow-wrap: anywhere; }
.rq-val { font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rq-kpi .rq-val { font-size: clamp(18px, 14cqi, 28px); }
.rq-sub { font-size: 11px; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
.rq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: var(--gap-md); }
.rq-m { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; container-type: inline-size; }
.rq-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.rq-name { font-size: var(--fs-head); font-weight: 600; }
.rq-px { font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; font-size: clamp(15px, 6cqi, 20px); white-space: nowrap; }
.rq-pred { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; border-radius: 12px; padding: 8px 12px; font-weight: 600; font-size: clamp(13px, 4.5cqi, 16px); }
.rq-pred .rq-sub { text-align: right; font-weight: 400; }
.rq-pred.up { background: rgba(60,240,166,.12); color: var(--ok); box-shadow: inset 0 0 0 1px rgba(60,240,166,.25); }
.rq-pred.dn { background: rgba(255,92,122,.12); color: var(--bad); box-shadow: inset 0 0 0 1px rgba(255,92,122,.25); }
.rq-pred.nt { background: rgba(124,140,255,.10); color: #B8C2FF; box-shadow: inset 0 0 0 1px rgba(124,140,255,.22); }
.rq-meter, .mk-bar { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--bad), #2A3150 50%, var(--ok)); }
.mk-bar { height: 8px; margin-top: 6px; }
.rq-meter i, .mk-bar i { position: absolute; top: -4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--bg); border: 2px solid var(--fg); box-shadow: 0 0 10px rgba(232,236,248,.35); }
.mk-bar i { top: -4px; width: 16px; height: 16px; margin-left: -8px; }
.rq-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rq-c { display: flex; flex-direction: column; gap: 1px; min-width: 0; background: var(--panel2); border-radius: 12px; padding: 8px; container-type: inline-size; overflow: hidden; }
.rq-c .rq-val { font-size: clamp(13px, 18cqi, 20px); }
@container (max-width: 260px) { .rq-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.mk-list, #hoy-mercados { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: var(--gap-md); align-items: start; }
.mk-card { padding: 16px 18px; cursor: pointer; display: flex; flex-direction: column; gap: var(--gap-sm); }
.mk-panel { padding: 16px 18px; display: flex; flex-direction: column; gap: var(--gap-xs); }
.mk-panel h3 { margin: 0; font-size: var(--fs-body); font-weight: 600; }
.mk-row { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm); }
.mk-name { font-size: var(--fs-head); font-weight: 600; margin: 0; }
.mk-lect { font-weight: 600; text-align: right; }
.mk-word { font-size: var(--fs-cap); font-weight: 500; }
.mk-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 4px; }
.mk-conf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.mk-pill { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: var(--fs-cap); font-weight: 500; background: rgba(124,140,255,.12); }
.mk-c-alta { background: rgba(60,240,166,.14); color: var(--ok); }
.mk-c-baja, .mk-c-sin-lectura { color: var(--muted); }
.mk-box { border: 1px solid var(--line); background: rgba(255,255,255,.02); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-cap); }
.mk-why { margin: 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.mk-tap { text-decoration: underline; color: #9FB0FF; }
.mk-more { border-top: 1px solid var(--line); padding-top: var(--gap-sm); display: flex; flex-direction: column; gap: 6px; cursor: default; }
.mk-more ul, .mk-ul { margin: 6px 0 0; padding-left: 1.1em; font-size: var(--fs-cap); display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
.mk-big-line { margin: 4px 0 0; }
.mk-big { font-size: var(--fs-title); font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.mk-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--gap-sm); }
.mk-map-line { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.mk-calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap-sm); margin-top: var(--gap-xs); }
.mk-calc label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-cap); color: var(--muted); }
.mk-calc select { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.mk-res { margin-top: var(--gap-sm); display: flex; flex-direction: column; gap: 6px; }
.mk-table { width: 100%; border-collapse: collapse; font-size: var(--fs-cap); font-variant-numeric: tabular-nums; }
.mk-table th, .mk-table td { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mk-table th { color: var(--muted); font-weight: 500; }
.mk-table .num { text-align: right; white-space: nowrap; }
details summary { cursor: pointer; }
.mk-foot { font-size: var(--fs-cap); color: var(--muted); border-top: 1px solid var(--line); padding-top: var(--gap-sm); margin: 0; }

.ap2-hoy { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 10px; }
.ap2-hoy-t { border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; background: linear-gradient(135deg, rgba(124,140,255,.16), rgba(60,240,166,.06)); border: 1px solid rgba(124,140,255,.30); min-width: 0; }
.ap2-hoy-t .e { font-size: 20px; line-height: 1; }
.ap2-hoy-t .v { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ap2-hoy-t .t { font-size: 12px; line-height: 1.3; }
.ap2-hoy-h { grid-column: 1 / -1; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.ap2-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
@media (min-width: 820px) {
  #sabemos-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #sabemos-grid > .ap2-card { grid-column: span 2; }
}
.ap2-card { --st: var(--ok); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 6px; border-top: 3px solid var(--st); container-type: inline-size; }
.ap2-top { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; }
.ap2-tag { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap2-st { font-weight: 500; color: var(--st); white-space: nowrap; }
.ap2-big { font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--st); white-space: nowrap; font-size: clamp(28px, 17cqi, 44px); }
.ap2-bar { position: relative; height: 8px; border-radius: 4px; background: rgba(232,236,248,.08); }
.ap2-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--st); }
.ap2-bar b { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--muted); border-radius: 1px; }
.ap2-h { font-weight: 600; font-size: 14px; line-height: 1.3; }
.ap2-use { font-size: 12px; color: var(--muted); }
.ap2-card details summary { font-size: 11px; color: var(--muted); list-style: none; }
.ap2-card details summary::before { content: '＋ '; }
.ap2-card details[open] summary::before { content: '－ '; }
.ap2-card details p { font-size: 12px; margin: 4px 0; color: var(--muted); }
.ftl-inst { margin-top: var(--gap-md); display: flex; align-items: center; gap: var(--gap-md); padding: 12px 14px; border-radius: 18px; background: linear-gradient(180deg, #162046, #111733); border: 1px solid rgba(60,240,166,.35); }
.ftl-inst[hidden] { display: none; }
.ftl-inst img { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.ftl-inst-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: var(--fs-cap); color: var(--muted); line-height: 1.4; }
.ftl-inst-txt strong { color: var(--fg); font-size: var(--fs-body); font-weight: 600; }
.ftl-share { width: 16px; height: 16px; vertical-align: -3px; color: #6FA8FF; }
.ftl-inst-btn { flex: none; border: 0; border-radius: 999px; padding: 10px 18px; min-height: 44px; background: var(--ok); color: #0B1020; font: inherit; font-weight: 600; cursor: pointer; }
.ftl-inst-x { flex: none; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; border-radius: 50%; }
.ftl-inst-x:hover { color: var(--fg); }

/* Cinta de precios en vivo (TradingView) */
.ftl-ticker { position: relative; margin: 8px 0 14px; border: 1px solid #232B4D; border-radius: 14px; overflow: hidden; background: #121831; }
.ftl-ticker .tradingview-widget-copyright { font-size: 11px; text-align: right; padding: 2px 10px 4px; }
.ftl-ticker .tradingview-widget-copyright a { color: #8A93B5; text-decoration: none; }
.ftl-ticker .tradingview-widget-container { position: relative; }
/* Capa transparente: los precios se mueven, pero tocarlos pregunta antes de salir de la app */
.ftl-ticker-tapa { position: absolute; inset: 0; z-index: 2; background: transparent; border: 0; padding: 0; cursor: pointer; }
.ftl-ticker-tapa[hidden] { display: none; }
.ftl-ticker-aviso { margin: 0; padding: 0 10px 6px; font-size: 12px; color: #FFB547; }
.ftl-salir { position: fixed; inset: 0; z-index: 50; background: rgba(5,8,20,.7); display: flex; align-items: center; justify-content: center; padding: 20px; }
.ftl-salir[hidden] { display: none; }
.ftl-salir-caja { background: #121831; border: 1px solid #232B4D; border-radius: 18px; padding: 20px; max-width: 360px; width: 100%; box-shadow: 0 20px 60px -20px rgba(0,0,0,.8); }
.ftl-salir-t { margin: 0 0 6px; font-weight: 600; font-size: 17px; color: #E8ECF8; }
.ftl-salir-x { margin: 0 0 16px; font-size: 14px; color: #8A93B5; }
.ftl-salir-bt { display: flex; flex-direction: column; gap: 8px; }
.ftl-salir-bt button { font: inherit; font-size: 15px; padding: 11px 14px; border-radius: 12px; cursor: pointer; border: 1px solid #232B4D; }
.ftl-bt-pri { background: #3CF0A6; color: #0B1020; border-color: #3CF0A6 !important; font-weight: 600; }
.ftl-bt-sec { background: transparent; color: #E8ECF8; }
.rq-pxbox { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 0; }
.rq-pxest { font-size: 11px; color: var(--muted); white-space: nowrap; }
.rq-pxest.vivo { color: #3CF0A6; }
/* Qué esperar del oro */
.ftl-esperar { display: flex; flex-direction: column; gap: 8px; }
.ftl-esp-h { margin: 0; font-weight: 600; font-size: 15px; }
.ftl-esp-fila { display: flex; align-items: baseline; gap: 10px; }
.ftl-esp-big { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.ftl-esp-txt { font-size: 14px; }
.ftl-esp-sub { margin: 6px 0 0; font-size: 14px; }
.ftl-esp-lista { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ftl-esp-cas { color: var(--muted); font-size: 12px; }
.ftl-esp-nota { margin: 0; font-size: 12px; color: var(--muted); }

.ftl-conf { display: inline-block; margin: 4px 0 2px; font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.ftl-esp-lista .ftl-conf { margin: 0; }

/* --- dato firma: solo en Feel the line --- */
.ftl-firma { border-radius: 14px; padding: 10px 12px; background: linear-gradient(135deg, rgba(124,140,255,.16), rgba(60,240,166,.07)); border: 1px solid rgba(124,140,255,.35); display: flex; flex-direction: column; gap: 4px; }
.ftl-firma-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.ftl-firma-sello { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: #FFB547; }
.ftl-firma-nuevo { font-size: 10px; color: #8A93B5; }
.ftl-firma-fila { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ftl-firma-tit { font-size: 13px; font-weight: 500; }
.ftl-firma-val { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ftl-firma-nota { margin: 0 0 2px; font-size: 11px; line-height: 1.35; color: #8A93B5; }
