/* Terminal Silvercross — línea gráfica tomada de silvercrosscv.com:
   negro puro, blanco, Montserrat y el verde menta #4ACEAB de su sitio. */

:root {
  --negro: #000000;
  --panel: #0a0a0b;
  --panel-2: #101012;
  --panel-3: #17181b;
  --linea: #1e1f23;
  --linea-viva: #2b2d33;
  --texto: #ffffff;
  --suave: #9aa0a8;
  --tenue: #5e646d;
  --menta: #4aceab;
  --menta-8: rgba(74, 206, 171, 0.08);
  --menta-20: rgba(74, 206, 171, 0.2);
  --rojo: #ff5f56;
  --ambar: #e8b44a;
  --radio: 4px;
  --ancho: 1440px;
  --nav: 232px;
  --barra: 60px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--negro);
  color: var(--texto);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { overflow-x: hidden; }

a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* ------------------------------------------------------------ barra superior */

.barra {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--barra);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--linea);
  z-index: 60;
}
.barra__logo { height: 19px; width: auto; display: block; }
.barra__sep { width: 1px; height: 24px; background: var(--linea); }

.barra__nombre {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tenue);
  white-space: nowrap;
}
.barra__der { margin-left: auto; display: flex; align-items: center; gap: 18px; }

.pastilla {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--linea-viva);
  border-radius: 100px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--suave);
  white-space: nowrap;
}
.pastilla--viva { border-color: var(--menta-20); color: var(--menta); }
.punto {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--tenue); flex: none;
}
.pastilla--viva .punto { background: var(--menta); animation: latido 2.4s ease-in-out infinite; }
@keyframes latido { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.reloj { font-size: 12px; color: var(--suave); }
.reloj b { color: var(--texto); font-weight: 500; }

/* -------------------------------------------------------------- disposición */

.envoltura { display: flex; padding-top: var(--barra); min-height: 100vh; }

.nav {
  position: fixed;
  top: var(--barra); bottom: 0; left: 0;
  width: var(--nav);
  border-right: 1px solid var(--linea);
  padding: 22px 0;
  display: flex; flex-direction: column;
  overflow-y: auto;
  z-index: 50;
}
.nav__grupo {
  font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--tenue); padding: 0 24px 10px;
}
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 24px;
  font-size: 13px; color: var(--suave);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.nav a:hover { color: var(--texto); background: var(--panel); }
.nav a[aria-current='page'] {
  color: var(--texto); border-left-color: var(--menta); background: var(--panel-2);
}
.nav__icono { width: 15px; height: 15px; flex: none; opacity: 0.85; }
.nav__pie {
  margin-top: auto; padding: 20px 24px 0;
  font-size: 10.5px; line-height: 1.7; color: var(--tenue);
  border-top: 1px solid var(--linea);
}

.lienzo {
  flex: 1; min-width: 0;
  margin-left: var(--nav);
  padding: 30px 30px 80px;
  max-width: var(--ancho);
}

.vista { display: none; }
.vista.activa { display: block; animation: entrar 0.28s ease; }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- encabezado */

.titulo { margin-bottom: 22px; }
.titulo h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.titulo p { margin: 7px 0 0; font-size: 13px; color: var(--suave); max-width: 68ch; line-height: 1.6; }

.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; align-items: center; }
.filtros__etq { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tenue); margin-right: 4px; }

.chip {
  padding: 6px 13px;
  border: 1px solid var(--linea-viva);
  background: transparent;
  color: var(--suave);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { color: var(--texto); border-color: var(--suave); }
.chip[aria-pressed='true'] {
  background: var(--menta); border-color: var(--menta); color: #04120e; font-weight: 600;
}

select.chip { appearance: none; padding-right: 30px; background-image: none; }
select.chip option { background: var(--panel-2); color: var(--texto); }

/* --------------------------------------------------------------------- rejilla */

.rejilla { display: grid; gap: 14px; }
.r-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.r-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.r-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.r-2-1 { grid-template-columns: minmax(0, 1fr) 330px; }
.r-1-2 { grid-template-columns: 1fr 2fr; }
.mt { margin-top: 14px; }

/* ---------------------------------------------------------------------- panel */

.panel {
  background: var(--panel);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  padding: 18px 20px;
  min-width: 0;
}
.panel--limpio {
  padding: 0; overflow: hidden;
  /* Así el área con scroll ocupa todo el alto del panel y dos paneles
     vecinos de distinta altura no dejan un hueco muerto abajo. */
  display: flex; flex-direction: column;
}
.panel--limpio > .desplaza { flex: 1 1 auto; min-height: 0; max-height: 460px; }
.panel__cab {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.panel__cab h3 { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); font-weight: 600; }
.panel__nota { font-size: 11px; color: var(--tenue); }
.panel--limpio .panel__cab { padding: 18px 20px 0; margin-bottom: 12px; }

/* ----------------------------------------------------------------- indicador */

.dato__etq {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--tenue); margin-bottom: 12px;
}
.dato__val { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.dato__val small { font-size: 16px; color: var(--suave); font-weight: 500; margin-left: 2px; }
.dato__pie { margin-top: 10px; font-size: 12px; color: var(--suave); line-height: 1.5; }
.dato--nuestro .dato__val { color: var(--menta); }

.sube { color: var(--menta); }
.baja { color: var(--rojo); }
.neutro { color: var(--suave); }

.insignia {
  display: inline-block; padding: 2px 7px; border-radius: 3px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
}
.insignia--menta { background: var(--menta-20); color: var(--menta); }
.insignia--roja { background: rgba(255, 95, 86, 0.16); color: var(--rojo); }
.insignia--gris { background: var(--panel-3); color: var(--suave); }

/* ---------------------------------------------------------------------- tabla */

.tabla-caja { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  padding: 10px 12px;
  position: sticky; top: 0;
  background: var(--panel-2);
  text-align: left; font-weight: 600;
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--tenue);
  border-bottom: 1px solid var(--linea);
  white-space: nowrap;
  z-index: 2;
}
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(30, 31, 35, 0.7);
  color: var(--suave);
  white-space: nowrap;
}
tbody tr:hover td { background: var(--panel-2); }
tbody td.fuerte { color: var(--texto); }
.der { text-align: right; }
tr.nuestra td { background: var(--menta-8); color: var(--texto); }
tr.nuestra td:first-child { box-shadow: inset 2px 0 0 var(--menta); }
tr.nuestra:hover td { background: rgba(74, 206, 171, 0.13); }
.desplaza { max-height: 460px; overflow-y: auto; }
.desplaza::-webkit-scrollbar { width: 8px; height: 8px; }
.desplaza::-webkit-scrollbar-thumb { background: var(--linea-viva); border-radius: 8px; }
.desplaza::-webkit-scrollbar-track { background: transparent; }

.recorta { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------------- barras */

.barrita { position: relative; height: 4px; background: var(--panel-3); border-radius: 2px; overflow: hidden; min-width: 70px; }
.barrita span { position: absolute; inset: 0 auto 0 0; background: #3a3d44; border-radius: 2px; }
tr.nuestra .barrita span { background: var(--menta); }

.duelo-fila { display: grid; grid-template-columns: 130px 1fr 1fr; gap: 12px; align-items: center; margin-bottom: 14px; font-size: 12px; }
.duelo-fila__nom { color: var(--suave); }
.duelo-barra { height: 22px; display: flex; align-items: center; gap: 8px; }
.duelo-barra i { display: block; height: 100%; border-radius: 2px; }
.duelo-barra--izq { flex-direction: row-reverse; }
.duelo-barra--izq i { background: var(--menta); }
.duelo-barra--der i { background: var(--linea-viva); }
.duelo-barra b { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--suave); white-space: nowrap; }

/* ---------------------------------------------------------------------- gráficos */

.grafico { width: 100%; display: block; overflow: visible; }
.grafico text { font-family: var(--sans); font-size: 9.5px; fill: var(--tenue); }
.leyenda { display: flex; gap: 18px; font-size: 11px; color: var(--suave); margin-top: 12px; flex-wrap: wrap; }
.leyenda i { display: inline-block; width: 10px; height: 2px; margin-right: 7px; vertical-align: middle; }

/* ------------------------------------------------------------------------ pie */

.pie {
  margin-top: 40px; padding-top: 22px;
  border-top: 1px solid var(--linea);
  font-size: 11px; color: var(--tenue); line-height: 1.8;
}
.pie strong { color: var(--suave); font-weight: 600; }
.pie a { color: var(--suave); text-decoration: none; border-bottom: 1px solid var(--linea-viva); }
.pie a:hover { color: var(--menta); }

.cargando { padding: 40px; text-align: center; color: var(--tenue); font-size: 12.5px; }
.vacio { padding: 26px 20px; color: var(--tenue); font-size: 12.5px; text-align: center; }

/* ----------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .r-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r-3, .r-2-1, .r-1-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  :root { --barra: 54px; }
  .nav {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    width: auto; height: 56px;
    flex-direction: row; padding: 0;
    border-right: none; border-top: 1px solid var(--linea);
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(14px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav__grupo, .nav__pie { display: none; }
  .nav a {
    /* Las seis entradas tienen que caber en 375 px sin obligar a arrastrar. */
    flex: 1 1 0; min-width: 0;
    flex-direction: column; gap: 3px;
    justify-content: center; padding: 8px 2px;
    font-size: 9px; letter-spacing: 0.01em;
    border-left: none; border-top: 2px solid transparent;
  }
  .nav a span {
    max-width: 100%; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
  }
  .nav a[aria-current='page'] { border-left: none; border-top-color: var(--menta); }
  .nav__icono { width: 14px; height: 14px; }
  .lienzo { margin-left: 0; padding: 18px 14px 90px; }

  /* La barra no puede empujar el reloj fuera de la pantalla. */
  .barra { padding: 0 12px; gap: 10px; overflow: hidden; }
  .barra__nombre, .barra__sep { display: none; }
  .barra__logo { height: 16px; flex: none; }
  .barra__der { gap: 8px; min-width: 0; }
  .pastilla { padding: 4px 8px; font-size: 9px; letter-spacing: 0.06em; gap: 5px; }
  .reloj { font-size: 10.5px; white-space: nowrap; }

  .r-4, .r-2 { grid-template-columns: 1fr; }
  .titulo h1 { font-size: 21px; }
  .titulo p { font-size: 12.5px; }
  .dato__val { font-size: 28px; }
  .duelo-fila { grid-template-columns: 84px 1fr 1fr; gap: 8px; font-size: 11px; }
  .duelo-barra b { font-size: 10px; }
  .recorta { max-width: 16ch; }
  .panel { padding: 15px 14px; }
  .panel--limpio .panel__cab { padding: 15px 14px 0; }
}

@media (max-width: 420px) {
  .nav a span { font-size: 8.5px; }
  /* En pantallas muy angostas el reloj se queda: en un terminal de mercado la
     hora importa. Lo que se va es la palabra "Quito". */
  .reloj__ciudad { display: none; }
  .pastilla span:not(.punto) { font-size: 8.5px; }
}

/* La cinta lleva nueve columnas: se aprieta para que quepan sin barra
   horizontal en un escritorio normal. */
#cinta table { font-size: 12px; }
#cinta thead th, #cinta tbody td { padding-left: 10px; padding-right: 10px; }
#cinta .recorta { max-width: 22ch; }
@media (max-width: 1180px) { #cinta .recorta { max-width: 26ch; } }

/* En móvil el gráfico de trayectoria se aplastaba al escalar por ancho:
   se le fija un alto legible. */
@media (max-width: 860px) {
  #grafTrayectoria svg { min-height: 200px; }
  #grafCurva svg { min-height: 190px; }
  /* La columna de barras es decorativa: en pantalla angosta estorba. */
  #rankingOficial th:last-child, #rankingOficial td:last-child,
  #rankingPropio th:last-child,  #rankingPropio td:last-child,
  #contrapartes th:last-child,   #contrapartes td:last-child,
  #tablaEmisores th:last-child,  #tablaEmisores td:last-child { display: none; }
}

/* ------------------------------------------------- herramientas de clientes */

.formulario {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: end;
  margin-bottom: 20px;
}
.formulario label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--tenue);
}
.campo {
  background: var(--panel-2);
  border: 1px solid var(--linea-viva);
  border-radius: var(--radio);
  color: var(--texto);
  font-family: var(--mono);
  font-size: 13px;
  padding: 9px 11px;
  width: 100%;
  text-transform: none; letter-spacing: 0;
}
.campo:focus { outline: none; border-color: var(--menta); }
select.campo { appearance: none; cursor: pointer; }
select.campo option { background: var(--panel-2); color: var(--texto); }
.chip--accion {
  grid-column: 1 / -1;
  background: var(--menta); border-color: var(--menta);
  color: #04120e; font-weight: 600; padding: 9px 16px; font-size: 12.5px;
}
.chip--accion:hover { filter: brightness(1.08); color: #04120e; }

.veredicto { border-top: 1px solid var(--linea); padding-top: 18px; }
.veredicto__titular { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.veredicto__detalle { margin-top: 8px; font-size: 12.5px; color: var(--suave); line-height: 1.6; }

/* Regla de percentiles: dónde cae la tasa dentro del rango del mercado.
   Tiene que leerse de un vistazo desde el otro lado de una mesa de reuniones,
   así que la barra va clara y la aguja bien marcada. */
.regla { margin: 24px 0 6px; }
.regla__barra {
  position: relative; height: 12px; border-radius: 6px;
  background: #23262c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.regla__caja {
  position: absolute; top: 0; bottom: 0;
  background: rgba(74, 206, 171, 0.32);
  box-shadow: inset 0 0 0 1px rgba(74, 206, 171, 0.55);
  border-radius: 6px;
}
.regla__aguja {
  position: absolute; top: -9px; bottom: -9px; width: 3px;
  background: var(--menta); border-radius: 2px;
  box-shadow: 0 0 0 2px #000, 0 0 10px rgba(74, 206, 171, 0.7);
}
.regla__pies {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 14px; font-size: 10px; color: var(--tenue);
  font-family: var(--mono);
}
.regla__pies span:nth-child(2) { color: var(--menta); }

.hist { display: flex; align-items: flex-end; gap: 2px; height: 60px; margin-top: 16px; }
.hist i { flex: 1; background: #262930; border-radius: 1px 1px 0 0; min-height: 1px; }
.hist i.marcada { background: var(--menta); }

.jugada__num {
  font-family: var(--mono); font-size: 11px; color: var(--menta);
  letter-spacing: 0.1em; margin-bottom: 8px;
}
.jugada h4 { font-size: 14px; margin-bottom: 8px; }
.jugada p { margin: 0; font-size: 12.5px; color: var(--suave); line-height: 1.65; }

@media (max-width: 860px) {
  .formulario { grid-template-columns: 1fr; }
}

/* Calendario de vencimientos: barras verticales, una por mes. */
.calendario {
  display: flex; align-items: flex-end; gap: 6px;
  height: 150px; margin-top: 18px;
}
.calendario__mes {
  flex: 1; min-width: 0; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 5px;
}
.calendario__monto {
  font-size: 9px; color: var(--suave); white-space: nowrap;
}
.calendario__barra {
  width: 100%; background: var(--menta-20);
  box-shadow: inset 0 0 0 1px rgba(74, 206, 171, 0.45);
  border-radius: 2px 2px 0 0; min-height: 4px;
}
.calendario__mes:hover .calendario__barra { background: rgba(74, 206, 171, 0.4); }
.calendario__etq { font-size: 9px; color: var(--tenue); white-space: nowrap; }

.aviso {
  margin: 18px 0 0; padding: 12px 16px;
  border: 1px solid var(--linea); border-left: 2px solid var(--linea-viva);
  border-radius: var(--radio);
  font-size: 11.5px; color: var(--tenue); line-height: 1.6;
}

@media (max-width: 860px) {
  .calendario { height: 120px; gap: 3px; }
  .calendario__monto { display: none; }
}
