/*
 * Semáforo Inversor Bridge
 * Uses the theme's design tokens so imported data looks native.
 * Every custom property has a fallback for safety.
 */

.sib-table-wrap,
.sib-edition,
.sib-stats,
.sib-news,
.sib-phases,
.sib-cta,
.sib-faq,
.sib-disclaimer,
.sib-empty {
  --sib-black: var(--si-black, #080b0a);
  --sib-white: var(--si-white, #fff);
  --sib-paper: var(--si-paper, #f7f8f6);
  --sib-graphite: var(--si-graphite, #58605c);
  --sib-line: var(--si-line, rgba(8, 11, 10, .14));
  --sib-green: var(--si-green, #00b957);
  --sib-amber: var(--si-amber, #ffbf00);
  --sib-red: var(--si-red, #ff1d25);
  --sib-display: var(--si-font-display, "Helvetica Neue", Helvetica, Arial, sans-serif);
  color: var(--sib-black);
  font-family: var(--si-font-body, "Helvetica Neue", Helvetica, Arial, sans-serif);
}

/* ---------------------------------------------------------------- Tables */

.sib-table-wrap {
  border: 1px solid var(--sib-line);
  margin: 32px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sib-table {
  border-collapse: collapse;
  font-size: 14px;
  min-width: 780px;
  width: 100%;
}

.sib-table caption {
  color: var(--sib-graphite);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  padding: 16px 18px;
  text-align: left;
  text-transform: uppercase;
}

.sib-table th,
.sib-table td {
  border-bottom: 1px solid var(--sib-line);
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

.sib-table thead th {
  background: var(--sib-white);
  color: var(--sib-graphite);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

.sib-table tbody tr:last-child th,
.sib-table tbody tr:last-child td { border-bottom: 0; }
.sib-table tbody tr:hover { background: rgba(0, 185, 87, .05); }

.sib-num { font-variant-numeric: tabular-nums; text-align: right !important; }
.sib-strong { font-family: var(--sib-display); font-size: 17px; letter-spacing: -.02em; }
.sib-up { color: var(--si-green-dark, #008c42); }
.sib-down { color: var(--sib-red); }

.sib-col-rank {
  color: var(--sib-graphite);
  font-family: var(--sib-display);
  font-size: 15px;
  width: 56px;
}

.sib-col-name { font-weight: 700; min-width: 190px; }
.sib-col-name a { border-bottom: 1px solid transparent; color: inherit; text-decoration: none; }
.sib-col-name a:hover { border-bottom-color: var(--sib-green); }

.sib-ticker,
.sib-sub {
  color: var(--sib-graphite);
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  margin-top: 3px;
  text-transform: uppercase;
}

.sib-note { color: var(--sib-graphite); display: block; font-size: 12px; margin-top: 2px; }
.sib-link { border-bottom: 1px solid var(--sib-green); font-size: 12px; font-weight: 700; white-space: nowrap; }

/* ---------------------------------------------------------------- Pills */

.sib-pill {
  align-items: center;
  border: 1px solid var(--sib-line);
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  gap: 8px;
  letter-spacing: .08em;
  padding: 6px 11px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sib-pill i { border-radius: 50%; height: 8px; width: 8px; }
.sib-pill--green i { background: var(--sib-green); }
.sib-pill--yellow i { background: var(--sib-amber); }
.sib-pill--red i { background: var(--sib-red); }
.sib-pill--locked { color: var(--sib-graphite); }
.sib-pill--locked i { background: var(--sib-graphite); opacity: .45; }

/* ---------------------------------------------------------------- Edition */

.sib-edition { border-top: 2px solid var(--sib-black); margin: 32px 0; padding-top: 20px; }

.sib-edition__date {
  color: var(--sib-graphite);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  margin: 0 0 20px;
  text-transform: uppercase;
}

.sib-changes { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.sib-changes__group { border-left: 3px solid var(--sib-line); padding-left: 16px; }
.sib-changes__group--nueva-oportunidad { border-left-color: var(--sib-green); }
.sib-changes__group--cambio-a-compra { border-left-color: var(--sib-green); }
.sib-changes__group--cambio-a-watchlist { border-left-color: var(--sib-amber); }
.sib-changes__group--alerta-fundamental { border-left-color: var(--sib-red); }
.sib-changes__group--salida { border-left-color: var(--sib-graphite); }

.sib-changes__label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.sib-changes ul { list-style: none; margin: 0; padding: 0; }
.sib-changes li { font-size: 14px; margin-bottom: 10px; }
.sib-changes a { border-bottom: 1px solid var(--sib-green); }

/* ---------------------------------------------------------------- Stats */

.sib-stats {
  border: 1px solid var(--sib-line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 32px 0 14px;
}

@media (min-width: 700px) { .sib-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.sib-stat { border-bottom: 1px solid var(--sib-line); border-right: 1px solid var(--sib-line); padding: 22px 20px; }

.sib-stat__label {
  color: var(--sib-graphite);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.sib-stat__value {
  font-family: var(--sib-display);
  font-size: 34px;
  letter-spacing: -.045em;
  line-height: 1;
  margin: 0;
}

.sib-footnote { color: var(--sib-graphite); font-size: 13px; max-width: 62ch; }

/* ---------------------------------------------------------------- News */

.sib-news { list-style: none; margin: 32px 0; padding: 0; }
.sib-news__item { border-top: 1px solid var(--sib-line); padding: 24px 0; }
.sib-news__item:last-child { border-bottom: 1px solid var(--sib-line); }

.sib-news__meta {
  align-items: center;
  color: var(--sib-graphite);
  display: flex;
  flex-wrap: wrap;
  font-size: 10px;
  font-weight: 800;
  gap: 14px;
  letter-spacing: .12em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.sib-news__impact--alto { color: var(--sib-red); }
.sib-news__impact--medio { color: var(--si-green-dark, #008c42); }
.sib-news__item h3 { font-family: var(--sib-display); font-size: 24px; letter-spacing: -.035em; line-height: 1.1; margin: 0 0 10px; }
.sib-news__item h3 a { border-bottom: 1px solid transparent; }
.sib-news__item h3 a:hover { border-bottom-color: var(--sib-green); }
.sib-news__summary { margin: 0 0 8px; max-width: 70ch; }
.sib-news__source { color: var(--sib-graphite); font-size: 12px; margin: 0; }

/* ---------------------------------------------------------------- Method */

.sib-phases { counter-reset: none; list-style: none; margin: 32px 0; padding: 0; }

.sib-phase {
  border-top: 1px solid var(--sib-line);
  display: grid;
  gap: 24px;
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 26px 0;
}

.sib-phase:last-child { border-bottom: 1px solid var(--sib-line); }

.sib-phase__number {
  color: var(--sib-green);
  font-family: var(--sib-display);
  font-size: 26px;
  letter-spacing: -.04em;
  line-height: 1;
}

.sib-phase h3 {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  font-family: var(--sib-display);
  font-size: 26px;
  gap: 12px;
  letter-spacing: -.035em;
  margin: 0 0 8px;
}

.sib-phase__weight {
  border: 1px solid var(--sib-line);
  font-family: var(--si-font-body, Arial, sans-serif);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .1em;
  padding: 4px 8px;
}

.sib-phase p { margin: 0; max-width: 68ch; }

/* ---------------------------------------------------------------- CTA */

.sib-cta {
  align-items: center;
  background: var(--sib-black);
  color: var(--sib-white);
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: space-between;
  margin: 44px 0;
  padding: 40px;
}

.sib-cta h2 { font-family: var(--sib-display); font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -.045em; line-height: 1.02; margin: 0 0 12px; }
.sib-cta p { color: rgba(255, 255, 255, .74); margin: 0; max-width: 56ch; }
.sib-cta__action { flex-shrink: 0; }

.sib-cta .button {
  align-items: center;
  background: var(--sib-green);
  color: var(--sib-black);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 26px;
  letter-spacing: .07em;
  min-height: 52px;
  padding: 0 22px;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- FAQ */

.sib-faq { margin: 32px 0; }
.sib-faq__item { border-top: 1px solid var(--sib-line); padding: 18px 0; }
.sib-faq__item:last-child { border-bottom: 1px solid var(--sib-line); }

.sib-faq__item summary {
  cursor: pointer;
  font-family: var(--sib-display);
  font-size: 21px;
  letter-spacing: -.03em;
  list-style: none;
  padding-right: 32px;
  position: relative;
}

.sib-faq__item summary::-webkit-details-marker { display: none; }
.sib-faq__item summary::after { content: "+"; position: absolute; right: 0; top: 0; }
.sib-faq__item[open] summary::after { content: "–"; }
.sib-faq__item p { margin: 14px 0 0; max-width: 70ch; }

/* ---------------------------------------------------------------- Notices */

.sib-disclaimer {
  border-left: 3px solid var(--sib-amber);
  color: var(--sib-graphite);
  font-size: 13px;
  line-height: 1.6;
  margin: 44px 0 0;
  padding: 4px 0 4px 20px;
}

.sib-disclaimer p { margin: 0; }
.sib-disclaimer strong { color: var(--sib-black); }

.sib-empty {
  align-items: center;
  border: 1px dashed var(--sib-line);
  display: flex;
  gap: 20px;
  margin: 32px 0;
  padding: 34px;
}

.sib-empty p { margin: 0; max-width: 60ch; }
.sib-empty__dots { display: flex; flex-direction: column; gap: 6px; }
.sib-empty__dots i { background: var(--sib-line); border-radius: 50%; height: 10px; width: 10px; }
.sib-empty-inline { color: var(--sib-graphite); font-size: 14px; }

/* ---------------------------------------------------------------- Mobile */

@media (max-width: 782px) {
  .sib-cta { padding: 28px; }
  .sib-phase { gap: 14px; grid-template-columns: 48px minmax(0, 1fr); }
  .sib-phase h3 { font-size: 22px; }
  .sib-stat { padding: 18px 16px; }
  .sib-stat__value { font-size: 27px; }
  .sib-table-wrap::after {
    color: var(--sib-graphite);
    content: "";
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sib-table tbody tr { transition: none; }
}

/* ------------------------------------------------- Opt-in full-width tables */
/* Activado con [si_oportunidades ancho="completo"]. Rompe la columna de texto
 * y usa el ancho del contenedor del tema sin necesidad de tocar plantillas. */

.sib-table-wrap--full {
  margin-left: 50%;
  max-width: calc(100vw - 40px);
  transform: translateX(-50%);
  width: var(--si-shell, min(1280px, calc(100vw - 64px)));
}

/* ------------------------------------------------- Muro de pago por identidad */

.sib-row-locked { background: linear-gradient(90deg, rgba(0, 185, 87, .045), transparent 60%); }

.sib-locked-name {
  align-items: center;
  display: inline-flex;
  gap: 9px;
  font-weight: 700;
}

.sib-lock {
  border: 1.5px solid currentColor;
  border-radius: 2px;
  color: var(--sib-graphite);
  display: inline-block;
  height: 11px;
  position: relative;
  width: 14px;
}

.sib-lock::before {
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  content: "";
  height: 6px;
  left: 50%;
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  width: 8px;
}

.sib-blur {
  color: var(--sib-graphite);
  letter-spacing: .12em;
  opacity: .45;
  user-select: none;
}

.sib-unlock {
  background: var(--sib-green);
  color: #080b0a;
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 7px 11px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sib-unlock:hover { background: #12d66b; }

.sib-change-locked strong { color: var(--sib-graphite); font-style: italic; font-weight: 600; }

.sib-locked-block { margin: 48px 0 0; }
.sib-locked-block__title { font-family: var(--si-font-display, sans-serif); font-size: clamp(22px, 3vw, 32px); letter-spacing: -.035em; margin: 0 0 10px; }
.sib-locked-block__lead { color: var(--si-graphite, #58605c); margin: 0; max-width: 62ch; }
.sib-locked-block__cta { margin: 22px 0 0; }
.sib-unlock--big { font-size: 11px; min-height: 50px; padding: 16px 24px; }
