.bh-tv-strip {
  background: #06070a;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.bh-tv-strip .bh-tv-widget {
  min-height: 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.bh-tv-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--bh-line, rgba(255, 255, 255, .12));
  border-radius: 20px;
  background:
    radial-gradient(circle at 16% 0%, rgba(31, 128, 255, .22), transparent 34%),
    rgba(13, 20, 32, .78);
  box-shadow: var(--bh-shadow, 0 18px 50px rgba(0, 0, 0, .22));
  backdrop-filter: blur(18px);
}

[data-theme="light"] .bh-tv-card {
  background:
    radial-gradient(circle at 16% 0%, rgba(31, 128, 255, .2), transparent 34%),
    rgba(255, 255, 255, .74);
}

.bh-tv-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 0;
}

.bh-tv-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--bh-blue, #1f80ff);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.bh-tv-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #12c99b;
  box-shadow: 0 0 18px rgba(18, 201, 155, .8);
}

.bh-tv-card__head strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1;
}

.bh-tv-card__head span:not(.bh-tv-kicker) {
  color: var(--bh-ink-muted, #6b7890);
  font-size: 14px;
  line-height: 1.35;
}

.bh-tv-widget {
  position: relative;
  width: 100%;
  height: var(--tv-height, 520px);
  min-height: var(--tv-height, 520px);
  padding: 14px;
}

/* Un símbolo rechazado por TradingView no debe conservar la altura del gráfico. */
.bh-tv-widget.bh-tv-error,
.bh-tv-widget.bh-tv-limited {
  height: auto;
  min-height: 0;
  padding: 0;
}

.bh-tv-widget--compact {
  height: 46px;
  min-height: 46px;
  padding: 0;
}

.bh-tv-widget .tradingview-widget-container,
.bh-tv-widget .tradingview-widget-container__widget,
.bh-tv-widget iframe {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100%;
}

/* Todos los embeds comparten el tema del documento. Algunos widgets tardan
   en pintar el iframe o dejan una capa transparente; este fondo evita el
   flash blanco en oscuro y el flash negro en claro. */
[data-theme="dark"] .bh-tv-widget,
[data-theme="dark"] .bh-tv-widget .tradingview-widget-container,
[data-theme="dark"] .bh-tv-widget .tradingview-widget-container__widget,
[data-theme="dark"] .bh-tv-widget iframe,
.bh-tv-widget[data-tv-theme="dark"],
.bh-tv-widget[data-tv-theme="dark"] .tradingview-widget-container,
.bh-tv-widget[data-tv-theme="dark"] .tradingview-widget-container__widget,
.bh-tv-widget[data-tv-theme="dark"] iframe {
  background: #08090b !important;
  color-scheme: dark;
}
[data-theme="light"] .bh-tv-widget,
[data-theme="light"] .bh-tv-widget .tradingview-widget-container,
[data-theme="light"] .bh-tv-widget .tradingview-widget-container__widget,
[data-theme="light"] .bh-tv-widget iframe,
.bh-tv-widget[data-tv-theme="light"],
.bh-tv-widget[data-tv-theme="light"] .tradingview-widget-container,
.bh-tv-widget[data-tv-theme="light"] .tradingview-widget-container__widget,
.bh-tv-widget[data-tv-theme="light"] iframe {
  background: #f7fbff !important;
  color-scheme: light;
}

/* El marco del widget también debe tener el tema aplicado mientras TradingView
   carga (o si un navegador conserva un estilo antiguo del embed). Así el panel
   no aparece blanco en oscuro ni negro en claro entre una recarga y otra. */
[data-theme="dark"] .bh-tv-widget[data-tv-widget="market-overview"],
[data-theme="dark"] .bh-tv-widget[data-tv-widget="market-overview"] .tradingview-widget-container,
[data-theme="dark"] .bh-tv-widget[data-tv-widget="market-overview"] .tradingview-widget-container__widget {
  background: #08090b !important;
  color-scheme: dark;
}
[data-theme="light"] .bh-tv-widget[data-tv-widget="market-overview"],
[data-theme="light"] .bh-tv-widget[data-tv-widget="market-overview"] .tradingview-widget-container,
[data-theme="light"] .bh-tv-widget[data-tv-widget="market-overview"] .tradingview-widget-container__widget {
  background: #f7fbff !important;
  color-scheme: light;
}

.bh-tv-widget .tradingview-widget-container {
  position: relative;
  min-height: calc(var(--tv-height, 520px) - 28px);
}

.bh-tv-widget .tradingview-widget-container__widget {
  min-height: calc(var(--tv-height, 520px) - 28px);
}

.bh-tv-widget iframe {
  min-height: calc(var(--tv-height, 520px) - 28px) !important;
}

.bh-tv-widget--compact .tradingview-widget-container,
.bh-tv-widget--compact .tradingview-widget-container__widget,
.bh-tv-widget--compact iframe {
  min-height: 46px !important;
}

.bh-tv-skeleton {
  position: absolute;
  inset: 14px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, .12), transparent),
    linear-gradient(135deg, rgba(31, 128, 255, .18), rgba(18, 201, 155, .12));
  background-size: 220% 100%, 100% 100%;
  animation: bhTvPulse 1.4s ease-in-out infinite;
}

.bh-tv-widget--compact .bh-tv-skeleton {
  inset: 0;
  border-radius: 0;
}

@keyframes bhTvPulse {
  0% { background-position: 180% 0, 0 0; }
  100% { background-position: -80% 0, 0 0; }
}

.bh-tv-ready .bh-tv-skeleton {
  display: none;
}

.bh-tv-fallback {
  display: grid;
  place-items: center;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  min-height: inherit;
  padding: 28px;
  color: var(--bh-ink-muted, #6b7890);
  text-align: center;
}

.bh-tv-widget.bh-tv-error .bh-tv-fallback,
.bh-tv-widget.bh-tv-limited .bh-tv-fallback {
  min-height: 0;
  padding: 24px clamp(16px, 4vw, 34px);
  border: 1px solid var(--bh-line, rgba(255, 255, 255, .12));
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(31, 128, 255, .08), rgba(18, 201, 155, .06));
}

.bh-tv-widget.bh-tv-error .bh-tv-fallback-mascot,
.bh-tv-widget.bh-tv-limited .bh-tv-fallback-mascot {
  width: 52px;
  height: 62px;
}

.bh-tv-widget.bh-tv-error .bh-tv-fallback strong,
.bh-tv-widget.bh-tv-limited .bh-tv-fallback strong {
  display: inline-block;
  color: var(--bh-ink, #f6f8fb);
  font-size: 15px;
}

.bh-tv-widget.bh-tv-error .bh-tv-fallback span,
.bh-tv-widget.bh-tv-limited .bh-tv-fallback span {
  display: inline-block;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
}

.bh-tv-fallback-mascot {
  width: 72px;
  height: 86px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(31,128,255,.2));
}

.bh-tv-data-fallback {
  display: grid;
  gap: 18px;
  min-height: calc(var(--tv-height, 520px) - 28px);
  padding: 28px clamp(18px, 4vw, 42px);
  border: 1px solid var(--bh-line, rgba(255, 255, 255, .12));
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(31, 128, 255, .08), rgba(18, 201, 155, .06));
  color: var(--bh-ink, #f6f8fb);
}

.bh-tv-data-fallback-head,
.bh-tv-data-fallback-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bh-tv-data-fallback-head > div {
  display: grid;
  gap: 5px;
}

.bh-tv-data-fallback-head strong {
  font-size: clamp(18px, 2.4vw, 26px);
}

.bh-tv-data-fallback-head small,
.bh-tv-data-fallback-foot span {
  color: var(--bh-ink-muted, #6b7890);
  font-size: 12px;
}

.bh-tv-data-fallback-price {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bh-tv-data-fallback-chart {
  display: block;
  width: 100%;
  height: clamp(190px, 30vw, 320px);
  overflow: visible;
}

.bh-tv-data-fallback-grid {
  fill: none;
  stroke: var(--bh-line, rgba(104, 160, 220, .2));
  stroke-width: .35;
}

.bh-tv-data-fallback-line {
  fill: none;
  stroke: #19d5a2;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.bh-tv-data-fallback-line.is-down {
  stroke: #f26d72;
}

.bh-tv-data-fallback-foot {
  align-items: flex-end;
}

.bh-tv-data-fallback-foot span {
  line-height: 1.45;
}

.bh-tv-data-fallback-change {
  color: #19d5a2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bh-tv-data-fallback-change.is-down {
  color: #f26d72;
}

@media (max-width: 560px) {
  .bh-tv-data-fallback-head,
  .bh-tv-data-fallback-foot {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .bh-tv-fallback { grid-template-columns: 1fr; }
}

.bh-tv-retry {
  margin-top: 14px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid rgba(31, 128, 255, .45);
  border-radius: 10px;
  background: rgba(31, 128, 255, .12);
  color: var(--bh-ink, #f6f8fb);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.bh-tv-retry:hover {
  background: rgba(31, 128, 255, .22);
  border-color: rgba(31, 128, 255, .72);
}

.bh-tv-external {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

[data-theme="light"] .bh-tv-widget.bh-tv-error .bh-tv-fallback,
[data-theme="light"] .bh-tv-widget.bh-tv-limited .bh-tv-fallback {
  background: linear-gradient(135deg, rgba(31, 128, 255, .07), rgba(18, 160, 140, .06));
}

[data-theme="light"] .bh-tv-widget.bh-tv-error .bh-tv-fallback strong,
[data-theme="light"] .bh-tv-widget.bh-tv-limited .bh-tv-fallback strong {
  color: var(--bh-ink, #0a0d12);
}

.bh-tv-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scrollbar-width: none;
}

.bh-tv-tabs::-webkit-scrollbar {
  display: none;
}

.bh-tv-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  appearance: none;
  border: 1px solid var(--bh-line, rgba(255, 255, 255, .14));
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: var(--bh-ink, #f6f8fb);
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  padding: 10px 15px;
}

.bh-tv-tab.is-active {
  border-color: rgba(31, 128, 255, .72);
  background: var(--bh-blue, #1f80ff);
  color: #fff;
  box-shadow: 0 12px 26px rgba(31, 128, 255, .28);
}

[data-theme="light"] .bh-tv-tab {
  background: rgba(255, 255, 255, .7);
  color: var(--bh-ink, #0a0d12);
}

[data-theme="light"] .bh-tv-tab.is-active {
  border-color: rgba(31, 128, 255, .68);
  background: rgba(31, 128, 255, .14);
  color: var(--bh-blue, #1f80ff);
  box-shadow: inset 0 0 0 1px rgba(31, 128, 255, .18), 0 12px 26px rgba(31, 128, 255, .16);
}

.bh-tv-tab-panel {
  display: none;
}

.bh-tv-tab-panel.is-active {
  display: block;
}

.bh-tv-market {
  display: grid;
  gap: 14px;
}

.bh-tv-market .market-board {
  padding: 0;
}

.bh-tv-company-grid {
  display: grid;
  gap: 16px;
  padding: 14px;
  min-width: 0;
  max-width: 100%;
}

.bh-tv-company-grid .bh-tv-widget {
  --tv-height: 620px;
  min-width: 0;
  max-width: 100%;
}

.bh-tv-company-grid .bh-tv-widget[data-tv-widget="technical-analysis"],
.bh-tv-company-grid .bh-tv-widget[data-tv-widget="company-profile"],
.bh-tv-company-grid .bh-tv-widget[data-tv-widget="fundamental-data"] {
  --tv-height: 500px;
}

@media (max-width: 768px) {
  .bh-tv-card__head {
    align-items: flex-start;
    flex-direction: column;
  }

  .bh-tv-widget {
    height: var(--tv-mobile-height, 440px);
    min-height: var(--tv-mobile-height, 440px);
    padding: 10px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .bh-tv-widget .tradingview-widget-container,
  .bh-tv-widget .tradingview-widget-container__widget,
  .bh-tv-widget iframe {
    width: 100% !important;
    max-width: 100% !important;
    min-height: calc(var(--tv-mobile-height, 440px) - 20px) !important;
  }

  .bh-tv-company-grid .bh-tv-widget {
    --tv-mobile-height: 460px;
  }

  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="symbol-overview"] {
    --tv-mobile-height: 460px !important;
  }

  /* El gráfico avanzado conserva sus herramientas, pero no necesita la
     altura de escritorio en una pantalla estrecha. */
  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="advanced-chart"] {
    --tv-mobile-height: 480px !important;
  }

  /* symbol-info no refluye correctamente por debajo de 360px: ampliamos el
     viewport interno y lo reducimos visualmente para que el precio completo
     quepa sin scroll horizontal, manteniendo el panel dentro de la tarjeta. */
  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="symbol-info"] {
    --tv-mobile-height: 300px !important;
    overflow: hidden;
  }

  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="symbol-info"] iframe {
    width: 116% !important;
    max-width: none !important;
    transform: scale(.86);
    transform-origin: top left;
  }

  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="symbol-info"] .tradingview-widget-container,
  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="symbol-info"] .tradingview-widget-container__widget {
    max-width: none;
    overflow: visible;
  }

  .bh-tv-company-grid .bh-tv-tab-panel,
  .bh-tv-company-grid .bh-tv-widget,
  .bh-tv-company-grid .tradingview-widget-container {
    min-width: 0;
    max-width: 100%;
  }

  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="technical-analysis"],
  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="market-overview"] {
    --tv-mobile-height: 460px !important;
  }

  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="company-profile"] {
    --tv-mobile-height: 520px !important;
  }

  .bh-tv-company-grid .bh-tv-widget[data-tv-widget="fundamental-data"] {
    --tv-mobile-height: 500px !important;
  }

  .bh-tv-company-grid .bh-tv-tabs--inside {
    gap: 6px;
    padding: 5px 4px;
    scroll-padding-inline: 4px;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .bh-tv-company-grid .bh-tv-tabs--inside::-webkit-scrollbar {
    display: none;
  }

  .bh-tv-company-grid .bh-tv-tabs--inside .bh-tv-tab {
    min-height: 38px;
    padding-inline: 12px;
    font-size: 12px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .bh-tv-company-grid .bh-tv-tab-panel.is-active {
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }
}

/* En móvil el gráfico sigue siendo el embed real de TradingView, pero el
   usuario dispone de una vista a pantalla completa para leer velas y ejes sin
   forzar un iframe de 300px dentro de una tarjeta estrecha. */
@media (max-width: 768px) {
}
