/**
 * PSX index detail page — quote stats + TradingView chart.
 */
.lw-index-detail-page {
  --lw-index-label: #00568a;
  --lw-index-label-muted: #00568a;
}

.lw-index-detail-page .lw-index-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.lw-index-detail-updated {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

.lw-index-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lw-index-detail-alert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #00568a;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lw-index-detail-alert:hover,
.lw-index-detail-alert:focus-visible {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #00568a;
  text-decoration: none;
  outline: none;
}

.lw-index-detail-page .lw-index-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-bottom: 14px;
}

.lw-index-detail-page .lw-index-nav-item {
  text-decoration: none;
  display: block;
  min-width: 0;
}

.lw-index-detail-page .lw-index-card-change {
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lw-index-detail-page .lw-index-volume {
  margin-top: 6px;
}

@media (max-width: 1100px) {
  .lw-index-detail-page .lw-index-rail {
    display: flex;
    gap: 9px;
    width: calc(100% + 8px);
    margin-right: -8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .lw-index-detail-page .lw-index-rail::-webkit-scrollbar {
    display: none;
  }

  .lw-index-detail-page .lw-index-nav-item {
    flex: 0 0 152px;
    min-height: 88px;
    scroll-snap-align: start;
  }
}

.lw-index-detail-quote {
  margin-bottom: 14px;
  padding: 18px 20px;
}

.lw-index-detail-hero {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.4fr);
  gap: 18px 24px;
  align-items: center;
}

.lw-index-detail-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--lw-index-label);
}

.lw-index-detail-page .lw-index-card-title,
.lw-index-detail-page .lw-index-volume > span:first-child {
  color: var(--lw-index-label);
  font-weight: 700;
}

.lw-index-detail-page .lw-index-volume {
  color: var(--lw-index-label-muted);
}

.lw-index-detail-page .lw-index-volume strong {
  color: #0f172a;
  font-weight: 700;
}

.lw-index-detail-price {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.05;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.lw-index-detail-change {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lw-index-detail-change.is-up {
  background: #dcfce7;
  color: #15803d;
}

.lw-index-detail-change.is-down {
  background: #fee2e2;
  color: #b91c1c;
}

.lw-index-detail-change.is-flat {
  background: #f1f5f9;
  color: #475569;
}

.lw-index-detail-ohlc {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.lw-index-detail-stat span {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--lw-index-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lw-index-detail-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.lw-index-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.lw-index-detail-panel {
  padding: 14px 16px;
}

.lw-index-detail-panel--wide {
  grid-column: 1 / -1;
}

.lw-index-detail-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.lw-index-detail-metrics--cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lw-index-detail-metric span {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--lw-index-label);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lw-index-detail-page .lw-card-head h2 {
  color: var(--lw-index-label);
  font-weight: 800;
}

.lw-index-detail-page .lw-tool-eyebrow {
  color: #00568a;
  font-weight: 700;
}

.lw-index-detail-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.lw-index-detail-metric strong.is-up {
  color: #15803d;
}

.lw-index-detail-metric strong.is-down {
  color: #b91c1c;
}

.lw-index-detail-pivots {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.lw-index-detail-range-bar {
  margin-top: 14px;
  width: 100%;
}

.lw-index-detail-range-track {
  position: relative;
  display: block;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dc2626 0%, #ea580c 42%, #ca8a04 58%, #16a34a 100%);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
}

.lw-index-detail-range-marker {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #1d4ed8;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.28);
  transform: translate(-50%, -50%);
}

.lw-index-detail-range-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.lw-index-detail-range-label {
  display: block;
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 700;
  color: #334155;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.lw-index-detail-range-label--low {
  text-align: left;
  justify-self: start;
}

.lw-index-detail-range-label--high {
  text-align: right;
  justify-self: end;
}

.lw-index-detail-chart-card {
  margin-bottom: 14px;
  padding: 14px 16px 16px;
}

.lw-index-detail-movement {
  margin-bottom: 14px;
  padding: 14px 16px;
}

.lw-index-detail-movement .lw-table td.num.lw-up,
.lw-index-detail-movement .lw-table td.num.lw-down {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lw-index-detail-movement-meta {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.lw-index-detail-breadth {
  margin: 10px 0 14px;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.82rem;
  color: #334155;
  margin-bottom: 8px;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-line strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-adv strong {
  color: #0b8f5f;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-dec strong {
  color: #cf3f4d;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-unch strong {
  color: #64748b;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-sep {
  color: #cbd5e1;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-bar {
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #f1f5f9;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-seg {
  flex: 0 0 auto;
  min-width: 0;
  height: 100%;
  transition: width 0.35s ease;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-seg.lw-up {
  background: #0b8f5f;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-seg.lw-down {
  background: #cf3f4d;
}

.lw-index-detail-page .lw-index-detail-breadth .lw-breadth-seg.lw-neutral {
  background: #94a3b8;
}

.lw-index-detail-heatmap-card {
  margin-bottom: 14px;
  padding: 14px 16px 16px;
  overflow: visible;
}

.lw-index-detail-heatmap-host {
  min-height: 680px;
}

.lw-index-detail-heatmap-host .lhm-canvas,
.lw-index-detail-heatmap-host .lhm-canvas .lhm-tile,
.lw-index-detail-heatmap-host .lhm-canvas .lhm-sector-label {
  touch-action: pan-y;
  overscroll-behavior: auto;
}

.lw-index-detail-page .lhm-pane-heatmap .lhm-canvas {
  min-height: 620px;
}

.lw-index-detail-page .lhm-container {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: visible;
}

.lw-index-detail-chart-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.lw-index-detail-chart-wrap {
  min-height: 520px;
  height: 520px;
  margin-top: 10px;
  border-radius: 12px;
  overflow: visible;
  border: 1px solid #e2e8f0;
  background: #fff;
  touch-action: pan-y;
  overscroll-behavior: auto;
}

#lwIndexDetailChartContainer {
  min-height: 520px;
  height: 520px;
  width: 100%;
}

@media (max-width: 720px) {
  .lw-index-detail-chart-wrap,
  #lwIndexDetailChartContainer {
    min-height: 400px;
    height: 400px;
  }
}

@media (max-width: 960px) {
  .lw-index-detail-hero {
    grid-template-columns: 1fr;
  }

  .lw-index-detail-ohlc {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lw-index-detail-pivots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .lw-index-detail-grid {
    grid-template-columns: 1fr;
  }

  .lw-index-detail-metrics--cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lw-index-detail-chart-head .lw-range-tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
}
