:root {
  --bg: #080d13;
  --bg-soft: #0f1721;
  --panel: rgba(16, 25, 37, 0.78);
  --panel-border: rgba(166, 193, 213, 0.2);
  --ink: #eff6ff;
  --muted: #9bb2c7;
  --accent: #03d47a;
  --accent-soft: rgba(3, 212, 122, 0.14);
  --warn: #ffcc4d;
  --danger: #ff5e6b;
  --info: #58a6ff;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 26px 54px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top left, #15263b 0%, #0d1521 42%, #080d13 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

body {
  position: relative;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.bg-glow {
  position: fixed;
  width: 36rem;
  height: 36rem;
  border-radius: 999px;
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
}

.bg-glow--one {
  top: -12rem;
  left: -8rem;
  background: rgba(4, 255, 152, 0.15);
}

.bg-glow--two {
  bottom: -13rem;
  right: -10rem;
  background: rgba(65, 134, 255, 0.18);
}

.shell {
  width: min(1180px, 95vw);
  margin: 1.5rem auto 2.4rem;
  display: grid;
  gap: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 600;
}

h1 {
  margin: 0.35rem 0 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(1.8rem, 3.5vw, 2.7rem);
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
}

.subtitle {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.topbar__actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.56rem 0.95rem;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}

.btn--ghost {
  background: rgba(7, 14, 23, 0.7);
  color: #cfe2f1;
  border-color: rgba(173, 198, 217, 0.2);
}

.btn--primary {
  background: linear-gradient(145deg, #1cdf8f, #0abf77);
  color: #032012;
}

.pulse,
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.pulse {
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 1.1fr 1fr 1.55fr;
  align-items: center;
}

.pulse__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pulse__value {
  margin: 0.3rem 0 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(1.4rem, 2vw, 2rem);
  font-weight: 700;
}

.pulse__meta {
  margin: 0.34rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.gauge-track {
  position: relative;
  width: 100%;
  height: 0.7rem;
  background: linear-gradient(90deg, #07cf77 0%, #ffcb3f 58%, #ff5e6b 100%);
  border-radius: 999px;
  overflow: hidden;
}

.gauge-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(4, 8, 14, 0.58);
  border-right: 2px solid #e8f4ff;
  transition: width 220ms ease;
}

.gauge-text {
  margin: 0.45rem 0 0;
  font-size: 0.83rem;
  color: var(--muted);
}

.pulse__timeline {
  min-height: 140px;
}

#riskChart {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.9), rgba(12, 21, 33, 0.9));
  border: 1px solid rgba(173, 198, 217, 0.14);
}

.layout-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.2fr 1fr;
}

.panel {
  padding: 0.95rem;
}

.panel--wide {
  grid-column: span 2;
}

.panel__heading h2 {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1.06rem;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.panel__heading p {
  margin: 0.3rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.indicators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
}

.indicator-card {
  border: 1px solid rgba(173, 198, 217, 0.18);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  background: linear-gradient(180deg, rgba(11, 21, 32, 0.9), rgba(8, 14, 23, 0.85));
}

.indicator-card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.indicator-card__name {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.indicator-card__value {
  margin: 0.38rem 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.indicator-card__meta {
  margin: 0.36rem 0 0;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
}

.pill--ok {
  background: rgba(7, 207, 119, 0.18);
  color: #59f2aa;
}

.pill--watch {
  background: rgba(255, 204, 77, 0.18);
  color: #ffd46b;
}

.pill--danger {
  background: rgba(255, 94, 107, 0.2);
  color: #ff9aa3;
}

.sentiment-list,
.alerts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.58rem;
}

.sentiment-list li,
.alerts-list li {
  border: 1px solid rgba(173, 198, 217, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(10, 18, 30, 0.7);
  padding: 0.6rem;
}

.sentiment-row,
.alert-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.sentiment-row--toggle {
  width: 100%;
  border: 0;
  background: rgba(6, 14, 24, 0.38);
  color: inherit;
  padding: 0.56rem;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid rgba(173, 198, 217, 0.15);
}

.sentiment-row--toggle:hover {
  border-color: rgba(89, 242, 170, 0.38);
  background: rgba(8, 18, 31, 0.76);
}

.sentiment-row__right {
  display: grid;
  justify-items: end;
  gap: 0.18rem;
}

.sentiment-expand {
  font-size: 0.68rem !important;
  color: #8cb1ca !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sentiment-row strong,
.alert-row strong {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 0.95rem;
}

.sentiment-row span,
.alert-row span {
  font-size: 0.76rem;
  color: var(--muted);
}

.sentiment-score {
  font-weight: 700;
  font-size: 0.86rem;
}

.sentiment-score--positive {
  color: #59f2aa;
}

.sentiment-score--negative {
  color: #ff9aa3;
}

.sentiment-dialog {
  position: relative;
  width: min(900px, calc(100vw - 1.4rem));
  max-height: min(88vh, 820px);
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid rgba(166, 193, 213, 0.26);
  background: linear-gradient(180deg, rgba(14, 25, 38, 0.98), rgba(8, 14, 23, 0.98));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.56);
  padding: 0.9rem;
}

.sentiment-dialog__body {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.72rem;
}

.sentiment-human-hero {
  border: 1px solid rgba(166, 193, 213, 0.24);
  border-radius: 12px;
  background: rgba(8, 16, 27, 0.72);
  padding: 0.66rem;
}

.sentiment-human-hero__score {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1.05rem;
}

.sentiment-human-hero__summary {
  margin: 0.38rem 0 0;
  color: #d4e7f6;
  font-size: 0.86rem;
  line-height: 1.5;
}

.sentiment-human-hero__meta {
  margin: 0.38rem 0 0;
  color: #a8c3d7;
  font-size: 0.77rem;
}

.sentiment-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.sentiment-card {
  border: 1px solid rgba(166, 193, 213, 0.2);
  border-radius: 10px;
  background: rgba(8, 15, 24, 0.52);
  padding: 0.58rem;
}

.sentiment-card h4 {
  margin: 0;
  font-size: 0.9rem;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.sentiment-card p {
  margin: 0.38rem 0 0;
  color: #c0d8e9;
  font-size: 0.8rem;
  line-height: 1.46;
}

.sentiment-card ul {
  margin: 0.45rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.28rem;
}

.sentiment-card li {
  color: #d5e7f5;
  font-size: 0.79rem;
  line-height: 1.44;
}

.chatter-list {
  display: grid;
  gap: 0.5rem;
}

.chatter-item {
  border: 1px solid rgba(166, 193, 213, 0.22);
  border-radius: 10px;
  background: rgba(8, 15, 24, 0.63);
  padding: 0.55rem;
}

.chatter-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.chatter-meta {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  color: #a9c4d8;
  font-size: 0.72rem;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(146, 181, 207, 0.4);
  background: rgba(17, 30, 45, 0.85);
  color: #d6e8f7;
  padding: 0.14rem 0.44rem;
  font-size: 0.68rem;
}

.tone-badge {
  border-radius: 999px;
  padding: 0.14rem 0.42rem;
  font-size: 0.68rem;
  font-weight: 700;
}

.tone-badge--bullish {
  background: rgba(89, 242, 170, 0.2);
  color: #79ffc0;
}

.tone-badge--bearish {
  background: rgba(255, 94, 107, 0.2);
  color: #ffb2b9;
}

.tone-badge--mixed {
  background: rgba(170, 193, 210, 0.24);
  color: #d4e6f5;
}

.chatter-text {
  margin: 0.45rem 0 0;
  color: #e3f0fa;
  font-size: 0.84rem;
  line-height: 1.45;
}

.chatter-sub {
  margin: 0.38rem 0 0;
  color: #b8d1e3;
  font-size: 0.76rem;
  line-height: 1.44;
}

.sentiment-detail-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sentiment-metric {
  border: 1px solid rgba(166, 193, 213, 0.2);
  border-radius: 10px;
  background: rgba(8, 15, 24, 0.66);
  padding: 0.5rem;
}

.sentiment-metric__label {
  margin: 0;
  color: #9ab7cc;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sentiment-metric__value {
  margin: 0.2rem 0 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1.02rem;
}

.sentiment-block {
  border: 1px solid rgba(166, 193, 213, 0.2);
  border-radius: 10px;
  background: rgba(8, 15, 24, 0.52);
  padding: 0.58rem;
}

.sentiment-block h4 {
  margin: 0;
  font-size: 0.9rem;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.sentiment-block p {
  margin: 0.38rem 0 0;
  color: #c0d8e9;
  font-size: 0.8rem;
  line-height: 1.46;
}

.source-mix {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.36rem;
}

.source-row {
  display: grid;
  gap: 0.26rem;
}

.source-row__head {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: #b5cde1;
}

.source-row__bar {
  width: 100%;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(132, 160, 181, 0.24);
  overflow: hidden;
}

.source-row__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #59f2aa, #53b6ff);
}

.term-grid {
  margin-top: 0.46rem;
  display: grid;
  gap: 0.28rem;
}

.term-columns {
  margin-top: 0.46rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.term-column h5 {
  margin: 0;
  color: #a9c5db;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.term-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.78rem;
  color: #c3daea;
}

.term-row span:last-child {
  color: #a8c2d8;
}

.sentiment-post-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.45rem;
}

.sentiment-post-table th,
.sentiment-post-table td {
  border-bottom: 1px solid rgba(166, 193, 213, 0.14);
  text-align: left;
  padding: 0.42rem 0.26rem;
  vertical-align: top;
}

.sentiment-post-table th {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a8c4da;
}

.sentiment-post-table td {
  font-size: 0.78rem;
  color: #d8e8f5;
}

.sentiment-post-text {
  line-height: 1.44;
}

.sentiment-path {
  margin-top: 0.46rem;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.22rem;
  align-items: end;
  min-height: 48px;
}

.sentiment-path__bar {
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, rgba(89, 242, 170, 0.9), rgba(83, 182, 255, 0.62));
}

.sentiment-path__axis {
  margin-top: 0.34rem;
  font-size: 0.72rem;
  color: #9eb8cd;
}

.table-wrap {
  overflow-x: auto;
}

.holdings-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 690px;
}

.holdings-table th,
.holdings-table td {
  text-align: left;
  border-bottom: 1px solid rgba(173, 198, 217, 0.15);
  padding: 0.56rem 0.42rem;
}

.holdings-table th {
  color: #c7dbeb;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.holdings-table td {
  font-size: 0.84rem;
  color: #e3eef8;
}

.ticker-cell {
  display: grid;
  gap: 0.12rem;
}

.ticker-cell small {
  font-size: 0.72rem;
  color: var(--muted);
}

.action-text {
  font-weight: 600;
}

.action-text--normal {
  color: #5ef3ad;
}

.action-text--watch {
  color: #ffd46b;
}

.action-text--danger {
  color: #ff9aa3;
}

.footnote p {
  margin: 0;
  color: var(--muted);
  font-size: 0.79rem;
  text-align: center;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1px solid rgba(146, 181, 207, 0.38);
  background: rgba(17, 28, 43, 0.85);
  color: #bbd4e8;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.help-btn:hover {
  border-color: rgba(201, 225, 244, 0.62);
  color: #ecf7ff;
}

.help-btn--control {
  width: 1.25rem;
  height: 1.25rem;
}

.help-btn--thead {
  margin-left: 0.22rem;
  width: 1.02rem;
  height: 1.02rem;
  font-size: 0.66rem;
}

.help-btn--indicator {
  width: 1rem;
  height: 1rem;
  font-size: 0.64rem;
  flex-shrink: 0;
}

.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
}

.help-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 12, 0.68);
}

.help-dialog {
  position: relative;
  width: min(560px, calc(100vw - 1.4rem));
  border-radius: var(--radius);
  border: 1px solid rgba(166, 193, 213, 0.26);
  background: linear-gradient(180deg, rgba(14, 25, 38, 0.98), rgba(8, 14, 23, 0.98));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.56);
  padding: 0.9rem;
}

.help-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.help-dialog__head h3 {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1.02rem;
}

.help-dialog__close {
  border: 1px solid rgba(166, 193, 213, 0.34);
  border-radius: 999px;
  background: rgba(9, 19, 30, 0.95);
  color: #d9eaf7;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  cursor: pointer;
}

.help-dialog__body {
  margin: 0.62rem 0 0;
  color: #d1e4f4;
  line-height: 1.52;
  font-size: 0.9rem;
  white-space: pre-line;
}

@media (max-width: 980px) {
  .pulse {
    grid-template-columns: 1fr;
  }

  .layout-grid {
    grid-template-columns: 1fr;
  }

  .panel--wide {
    grid-column: auto;
  }

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

  .term-columns {
    grid-template-columns: 1fr;
  }

  .sentiment-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100vw - 1rem, 1000px);
    margin-top: 0.85rem;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar__actions {
    width: 100%;
  }

  .btn {
    flex: 1;
    justify-content: center;
  }

  .help-btn--control {
    width: 1.1rem;
    height: 1.1rem;
  }

  .sentiment-detail-grid {
    grid-template-columns: 1fr;
  }

  .sentiment-dialog {
    width: min(100vw - 0.9rem, 900px);
    padding: 0.72rem;
  }
}
