/* Stock detail sentiment dialog: clear hierarchy with a bounded chart viewport. */
#stockDetailModal .sentiment-detail-dialog {
  max-width: min(1120px, calc(100vw - 2rem));
}

#stockDetailModal .modal-content {
  overflow: hidden;
  border: 1px solid rgba(111, 145, 177, 0.25);
  border-radius: 16px;
  background: #0e1726;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.025);
}

#stockDetailModal .modal-header,
#stockDetailModal .modal-footer {
  border-color: rgba(148, 163, 184, 0.12);
  background: rgba(20, 31, 48, 0.95);
}

#stockDetailModal .modal-header {
  min-height: 62px;
  padding: 0.9rem 1.25rem;
}

#stockDetailModal .modal-title {
  color: #eff6ff;
  font-size: 1rem;
  font-weight: 650;
}

#stockDetailModal .modal-body {
  padding: clamp(1rem, 2.4vw, 1.5rem);
}

#stockDetailModal .sentiment-detail-grid {
  --bs-gutter-x: 1rem;
  --bs-gutter-y: 1rem;
}

#stockDetailModal .sentiment-summary-card,
#stockDetailModal .sentiment-trend-card {
  overflow: hidden;
  min-height: 360px;
  border: 1px solid rgba(105, 137, 169, 0.2);
  border-radius: 13px;
  background: linear-gradient(150deg, #141f30, #111b2a 70%);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

#stockDetailModal .sentiment-summary-card .card-header,
#stockDetailModal .sentiment-trend-card .card-header {
  min-height: 56px;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.012);
}

#stockDetailModal .sentiment-summary-card .card-body {
  display: flex;
  flex-direction: column;
  padding: 1.1rem;
}

#stockDetailModal .sentiment-score-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.95rem;
  border: 1px solid rgba(105, 137, 169, 0.16);
  border-radius: 12px;
  background: radial-gradient(ellipse at 100% 0%, rgba(0, 232, 157, 0.09), transparent 60%), rgba(5, 13, 23, 0.42);
}

#stockDetailModal .sentiment-company-lockup {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

#stockDetailModal .sentiment-company-logo {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 5px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  background: #f8fafc;
  object-fit: contain;
}

#stockDetailModal .sentiment-company-lockup > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#stockDetailModal .sentiment-company-ticker {
  color: #f1f5f9;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0.025em;
}

#stockDetailModal .sentiment-company-name {
  overflow: hidden;
  color: #93a3b7;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#stockDetailModal .sentiment-score-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
}

#stockDetailModal .sentiment-score-value > small {
  color: #8292a7;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

#stockDetailModal .sentiment-score-value > strong {
  margin: 0.22rem 0;
  border: 0;
  background: none;
  color: #e7f1fc;
  font: 750 2rem/1 ui-monospace, "Cascadia Code", monospace;
  letter-spacing: -0.055em;
}

#stockDetailModal .sentiment-score-value--up > strong { color: #34d399; }
#stockDetailModal .sentiment-score-value--info > strong { color: #38bdf8; }
#stockDetailModal .sentiment-score-value--down > strong { color: #fb7185; }
#stockDetailModal .sentiment-score-value--warn > strong { color: #fbbf24; }
#stockDetailModal .sentiment-score-value--neutral > strong { color: #cbd5e1; }

#stockDetailModal .sentiment-scale-hint {
  color: #66778d;
  font: 600 0.59rem/1 ui-monospace, "Cascadia Code", monospace;
}

#stockDetailModal .sentiment-decision-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

#stockDetailModal .sentiment-decision-item {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(105, 137, 169, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
}

#stockDetailModal .sentiment-decision-item > span {
  color: #8292a7;
  font-size: 0.72rem;
}

#stockDetailModal .sentiment-decision-item > strong {
  width: fit-content;
  font-size: 0.9rem;
}

#stockDetailModal .sentiment-reasoning {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

#stockDetailModal .sentiment-reasoning h6 {
  margin: 0 0 0.5rem;
  color: #9aabc0;
  font-size: 0.67rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

#stockDetailModal .sentiment-reasoning h6 i { color: #40dbb0; }

#stockDetailModal .sentiment-reasoning ul {
  padding-left: 1rem;
  color: #c1ccda;
  font-size: 0.8rem;
  line-height: 1.5;
}

#stockDetailModal .sentiment-reasoning li {
  margin: 0.35rem 0;
  padding-left: 0.15rem;
}

#stockDetailModal .sentiment-trend-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

#stockDetailModal .sentiment-trend-range {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(0, 232, 157, 0.16);
  border-radius: 7px;
  color: #7cdaba;
  background: rgba(0, 232, 157, 0.045);
  font: 600 0.65rem ui-monospace, "Cascadia Code", monospace;
}

#stockDetailModal .sentiment-trend-card .card-body {
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1rem 0.7rem;
}

/* Fixed height is essential: Chart.js uses maintainAspectRatio:false and must not
   size its own parent through flex/content height feedback. Keep this fixed at all breakpoints. */
#stockDetailModal .sentiment-detail-chart {
  position: relative;
  flex: none;
  width: 100%;
  height: 270px;
  min-height: 270px;
  max-height: 270px;
}

#stockDetailModal .sentiment-trend-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.65rem;
  color: #75869c;
  font-size: 0.68rem;
}

#stockDetailModal .sentiment-trend-foot i {
  margin-right: 0.3rem;
  color: #2dd4a2;
  font-size: 0.48rem;
  vertical-align: 0.1em;
}

@media (max-width: 767px) {
  #stockDetailModal .sentiment-summary-card,
  #stockDetailModal .sentiment-trend-card { min-height: 0; }
  #stockDetailModal .sentiment-score-value > strong { font-size: 1.7rem; }
  #stockDetailModal .sentiment-detail-chart {
    flex: none;
    height: 270px;
    min-height: 270px;
    max-height: 270px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #stockDetailModal *, #stockDetailModal *::before, #stockDetailModal *::after { scroll-behavior: auto; }
}
