/* ============================================
   Los más sugeridos — estilos de la vista (prefijo sg-)
   Sólo usa las variables de la web (css/variables.css), así que sigue al tema
   claro y al oscuro. Lo carga index.html detrás de tema.css.
   ============================================ */

.sg { max-width: 1180px; margin: 0 auto; min-width: 0; }
/* La columna principal es un elemento flex: sin esto, el índice de meses (chips que
   no se parten) la ensanchaba más que la pantalla en el móvil. */
.main, .page-content { min-width: 0; }

/* ── Cabecera ── */
.sg-titulo { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-2); }
.sg-titulo h2 { display: flex; align-items: center; gap: var(--space-3); margin: 0; font-size: var(--text-3xl); color: var(--text-primary); }
.sg-titulo h2 svg { width: 30px; height: 30px; color: var(--accent-primary); }
.sg-intro { margin: 0 0 var(--space-5); max-width: 78ch; color: var(--text-muted); font-size: var(--text-base); line-height: var(--leading-relaxed); }

/* ── Índice de meses ── */
.sg-indice { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 4px; margin-bottom: var(--space-6); scrollbar-width: thin; contain: inline-size; }
.sg-indice button { flex: 0 0 auto; color: var(--text-secondary); background: var(--bg-primary); border: 1px solid var(--border-secondary); border-radius: var(--radius-full); padding: 5px 13px; font: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold); cursor: pointer; }
.sg-indice button:hover { border-color: var(--border-active); color: var(--text-primary); }
.sg-indice button.actual { background: var(--warning-soft); border-color: var(--border-active); }

/* ── Mes ── */
.sg-mes { margin-bottom: var(--space-8); scroll-margin-top: 90px; }
.sg-mes-cab { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); text-align: left; background: transparent; border: 0; border-bottom: 2px solid var(--border-secondary); padding: 0 0 var(--space-3); cursor: pointer; font: inherit; color: inherit; }
.sg-mes-cab:hover { border-bottom-color: var(--border-active); }
.sg-mes-nombre { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.sg-mes-nombre h3 { margin: 0; font-family: 'Permanent Marker', 'Rubik', sans-serif; font-weight: 400; font-size: 1.45rem; line-height: 1.2; color: var(--accent-secondary); letter-spacing: .01em; }
.sg-mes-meta { display: block; font-size: var(--text-sm); color: var(--text-muted); margin-top: 3px; }
.sg-chev { flex: 0 0 auto; width: 22px; height: 22px; color: var(--text-muted); transition: transform .2s; }
.sg-chev svg { width: 22px; height: 22px; }
.sg-mes-cab[aria-expanded="true"] .sg-chev { transform: rotate(180deg); }
.sg-resumen { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.sg-mes-cab[aria-expanded="true"] ~ .sg-resumen { display: none; }
.sg-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-tertiary); border: 1px solid var(--border-primary); border-radius: var(--radius-full); padding: 3px 11px 3px 4px; font-size: var(--text-sm); color: var(--text-secondary); }
.sg-chip b { font-family: var(--font-mono); font-weight: var(--weight-bold); color: var(--text-primary); }
.sg-chip .sg-n-mini { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--accent-gradient); color: #1d1e22; font-size: 11px; font-weight: var(--weight-bold); }
.sg-mes-cuerpo { margin-top: var(--space-5); }
.sg-mes-cuerpo[hidden] { display: none; }
.sg-aviso { margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); background: var(--warning-soft); border-left: 3px solid var(--border-active); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; }
/* Dos columnas mientras cada tarjeta mida al menos 380 px: con menos, la escalera de
   precios no cabe y se pasa a una. */
.sg-rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: var(--space-5); }

/* ── Bloque de un valor ── */
.sg-bloque { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.sg-cab { display: flex; align-items: center; gap: var(--space-3); }
.sg-rango { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bg-tertiary); border: 1px solid var(--border-secondary); font-family: var(--font-mono); font-weight: var(--weight-bold); font-size: var(--text-sm); color: var(--text-secondary); }
.sg-bloque:first-child .sg-rango { background: var(--accent-gradient); border-color: var(--border-active); color: #1d1e22; }
.sg-valor { min-width: 0; flex: 1; }
.sg-ticker { display: block; font-family: var(--font-mono); font-weight: var(--weight-extrabold); font-size: var(--text-xl); line-height: 1.15; color: var(--text-primary); }
.sg-empresa { display: block; font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-n { flex: 0 0 auto; }

.sg-quien { display: flex; align-items: center; gap: var(--space-3); }
.sg-avatares { display: flex; flex: 0 0 auto; }
.sg-avatares .avatar { flex: 0 0 auto; width: 34px; height: 34px; margin-left: -9px; border: 2px solid var(--bg-primary); box-shadow: 0 0 0 1px var(--border-secondary); font-size: 12px; }
.sg-avatares .avatar:first-child { margin-left: 0; }
.sg-nombres { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.4; min-width: 0; }

.sg-origen { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.sg-origen.calculado::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: -1px; border-radius: 50%; border: 1.5px dashed var(--text-muted); }
.sg-origen.analista::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: -1px; border-radius: 50%; background: var(--text-secondary); }

/* ── La escalera de precios ── */
.sg-rr { display: flex; flex-direction: column; gap: var(--space-3); }
.sg-rr-cab { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.sg-rr-cab > span:first-child { font-size: 10.5px; font-weight: var(--weight-bold); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--text-muted); }
.sg-ratio { font-size: var(--text-sm); color: var(--text-muted); }
.sg-ratio b { font-family: var(--font-mono); font-weight: var(--weight-extrabold); font-size: var(--text-lg); color: var(--text-primary); margin-left: 4px; }
.sg-ratio small { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-muted); }

.sg-graf { position: relative; }
.sg-barra { position: absolute; left: 0; top: 0; bottom: 0; width: 14px; }
.sg-tramo { position: absolute; left: 0; width: 14px; display: block; }
.sg-tramo-recompensa { background: rgba(21, 128, 61, .32); border-radius: 7px 7px 0 0; }
.sg-tramo-riesgo { background: rgba(207, 46, 46, .32); border-radius: 0 0 7px 7px; }
.sg-graf.calculado .sg-tramo-recompensa { background: repeating-linear-gradient(135deg, rgba(21,128,61,.34) 0 5px, rgba(21,128,61,.14) 5px 10px); }
.sg-graf.calculado .sg-tramo-riesgo { background: repeating-linear-gradient(135deg, rgba(207,46,46,.34) 0 5px, rgba(207,46,46,.14) 5px 10px); }
.sg-fuera { background: repeating-linear-gradient(180deg, var(--text-muted) 0 3px, transparent 3px 7px); opacity: .55; width: 4px; left: 5px; }
.sg-cables { position: absolute; left: 0; top: 0; overflow: visible; }
.sg-etiquetas { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }
.sg-et { position: absolute; left: 76px; right: 0; height: 28px; display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.sg-et .n { flex: 0 0 auto; width: 104px; font-size: 10.5px; font-weight: var(--weight-bold); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--text-muted); }
.sg-et b { flex: 0 0 auto; font-family: var(--font-mono); font-weight: var(--weight-bold); font-size: var(--text-lg); color: var(--text-primary); }
.sg-et em { font-style: normal; font-family: var(--font-mono); font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--text-muted); }
.sg-et.objetivo b, .sg-et.objetivo em { color: var(--success); }
.sg-et.stop b, .sg-et.stop em { color: var(--danger); }
/* El recuadro del precio actual sobresale por la izquierda para que sus cifras
   queden en la misma columna que las de las otras tres etiquetas. */
.sg-et.ahora { left: 70px; padding: 0 10px 0 5px; background: var(--warning-soft); border: 1px solid var(--border-active); border-radius: var(--radius-md); right: auto; }
.sg-et.ahora .n { color: var(--text-accent); }
.sg-et.ahora b { color: var(--text-primary); }
.sg-et.ahora em { color: var(--text-secondary); }
.sg-ahora { margin: 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.sg-sin-regla { padding: var(--space-3) var(--space-4); border: 1px dashed var(--border-secondary); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--text-muted); line-height: 1.45; }

/* ── La frase ── */
.sg-frase { margin: 0; padding: 2px 0 2px var(--space-4); border-left: 3px solid var(--border-active); }
.sg-frase p { margin: 0 0 4px; font-size: var(--text-base); line-height: 1.55; font-style: italic; color: var(--text-secondary); }
.sg-frase cite { font-style: normal; font-size: var(--text-sm); color: var(--text-muted); }
.sg-frase cite b { color: var(--text-secondary); font-weight: var(--weight-semibold); }

/* ── Pie del bloque ── */
.sg-pie { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border-primary); }
.sg-estado { font-size: 12px; font-weight: var(--weight-semibold); border-radius: var(--radius-full); padding: 2px 10px; border: 1px solid transparent; white-space: nowrap; }
.sg-estado.abierta { background: var(--info-soft); color: var(--info); }
.sg-estado.pendiente { background: var(--warning-soft); color: var(--warning); }
.sg-estado.objetivo { background: var(--success-soft); color: var(--success); }
.sg-estado.stop { background: var(--danger-soft); color: var(--danger); }
.sg-estado.caducada { background: var(--neutral-soft); color: var(--text-muted); }

.sg-detalle { width: 100%; }
.sg-detalle summary { cursor: pointer; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-accent); list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
.sg-detalle summary::-webkit-details-marker { display: none; }
.sg-detalle summary::after { content: '▾'; font-size: 11px; transition: transform .15s; }
.sg-detalle[open] summary::after { transform: rotate(180deg); }
.sg-tabla-envoltorio { overflow-x: auto; margin: var(--space-2) 0 var(--space-2); }
.sg-tabla { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.sg-tabla th { text-align: left; font-size: 10.5px; font-weight: var(--weight-bold); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--text-muted); background: var(--bg-tertiary); padding: 6px 8px; white-space: nowrap; }
.sg-tabla { font-size: 12.5px; }
.sg-tabla th { padding: 6px 6px; }
.sg-tabla td { padding: 8px 6px; border-top: 1px solid var(--border-primary); vertical-align: middle; white-space: nowrap; }
.sg-tabla td.num { font-family: var(--font-mono); font-weight: var(--weight-semibold); }
.sg-tabla tr.fuera td { opacity: .5; }
.sg-tabla .quien { display: flex; align-items: center; gap: 7px; white-space: normal; min-width: 118px; line-height: 1.25; }
.sg-tabla .quien small { display: block; color: var(--text-muted); font-size: 11px; }
.sg-punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 5px; vertical-align: 1px; }
.sg-punto.propio { background: var(--text-secondary); }
.sg-punto.calc { border: 1.5px dashed var(--text-muted); }
.sg-enlace { display: inline-block; margin-top: 2px; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-accent); text-decoration: none; }
.sg-enlace:hover { text-decoration: underline; }

/* ── Cómo se calcula ── */
.sg-nota { margin-top: var(--space-8); }
.sg-nota h3 { margin: 0 0 var(--space-3); font-size: var(--text-lg); }
.sg-nota ul { margin: 0 0 var(--space-3); padding-left: 1.2em; color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.6; }
.sg-nota li { margin-bottom: 4px; }
.sg-nota p { margin: 0; font-size: var(--text-sm); color: var(--text-muted); line-height: 1.55; }

/* ── Pantallas pequeñas ── */
@media (max-width: 768px) {
  .sg-titulo h2 { font-size: var(--text-2xl); }
  .sg-mes-nombre h3 { font-size: 1.2rem; }
  .sg-bloque { padding: var(--space-4); }
  .sg-et .n { width: 92px; font-size: 10px; letter-spacing: .05em; }
  .sg-et b { font-size: var(--text-base); }
}
@media (max-width: 420px) {
  .sg-et { gap: 6px; }
  .sg-et .n { width: 78px; font-size: 9.5px; }
  .sg-et em { font-size: 12px; }
}
