@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --canvas: #090b0d;
  --surface: #121719;
  --surface-2: #171d1f;
  --surface-3: #1d2528;
  --text: #f2f2ec;
  --muted: rgba(242, 242, 236, 0.68);
  --faint: rgba(242, 242, 236, 0.44);
  --border: rgba(211, 216, 194, 0.12);
  --accent: #bfd64c;
  --accent-2: #66c8c0;
  --danger: #ff7f5f;
  --neutral: #92a8ff;
  --warn: #f0bd6c;
  --shadow: 0 28px 72px rgba(0, 0, 0, 0.34);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-body: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(191, 214, 76, 0.13), transparent 26%),
    radial-gradient(circle at top right, rgba(102, 200, 192, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(191, 214, 76, 0.04), transparent 18rem),
    var(--canvas);
}

img {
  display: block;
  max-width: 100%;
}

button,
select,
input {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(18, 23, 25, 0.88);
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1600px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: stretch;
}

.brand-lockup,
.hero-chip,
.market-strip,
.control-bar,
.chart-card,
.side-panel,
.insight-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(18, 23, 25, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 18px 20px;
}

.brand-logo {
  width: 80px;
  height: auto;
  flex: 0 0 auto;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 8px;
  font-size: clamp(24px, 2.6vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 18px;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 14px;
}

.brand-copy p,
.chart-header p,
.insight-card__header p,
.market-strip__meta,
.panel-title-row span,
.rule-list p,
.signal-row span {
  color: var(--muted);
}

.brand-copy p {
  margin-top: 10px;
  max-width: 56rem;
  font-size: 13px;
  line-height: 1.6;
}

.hero-chip {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  overflow: hidden;
}

.hero-chip img {
  width: 112px;
  min-width: 112px;
  border-radius: 18px;
}

.hero-chip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.hero-chip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.nav-pill {
  min-width: max-content;
  padding: 11px 14px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(18, 23, 25, 0.78);
}

.nav-pill.is-active {
  border-color: rgba(191, 214, 76, 0.46);
  background: linear-gradient(180deg, rgba(191, 214, 76, 0.22), rgba(191, 214, 76, 0.08));
  color: var(--text);
}

.market-strip {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 18px;
}

.market-strip__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: 12px;
}

.pulse-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pulse-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(191, 214, 76, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.pulse-chip strong,
.pulse-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pulse-chip strong {
  font-size: 12px;
}

.pulse-chip span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.control-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr)) minmax(240px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding: 16px;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: var(--faint);
  font-size: 11px;
}

select,
input,
button {
  min-height: 42px;
}

select,
input {
  width: 100%;
  padding: 0 12px;
}

input::placeholder {
  color: rgba(242, 242, 236, 0.34);
}

.prompt-field {
  min-width: 0;
}

.control-actions {
  display: flex;
  gap: 10px;
}

.control-actions button {
  padding: 0 14px;
}

button {
  border-color: rgba(191, 214, 76, 0.3);
  background: linear-gradient(180deg, rgba(191, 214, 76, 0.18), rgba(191, 214, 76, 0.08));
}

.ghost-button {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.chart-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.chart-card {
  overflow: hidden;
}

.chart-card.compact {
  box-shadow: none;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  padding: 18px 18px 12px;
}

.chart-header p {
  margin-top: 5px;
  font-size: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
}

.dot.bull {
  background: var(--accent);
}

.dot.bear {
  background: var(--danger);
}

.dot.neutral {
  background: var(--neutral);
}

.price-chart {
  height: 580px;
}

.indicator-chart {
  height: 210px;
}

.side-panel {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.panel-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(23, 29, 31, 0.92);
  padding: 14px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-title-row span {
  min-width: max-content;
  font-size: 11px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 0;
}

.metric-grid div {
  min-width: 0;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

dt {
  color: var(--faint);
  font-size: 11px;
}

dd {
  margin: 4px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 14px;
}

.rule-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.62;
}

.signal-table {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  margin-top: 12px;
  padding-right: 2px;
}

.signal-row,
.table-row {
  display: grid;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(8, 11, 13, 0.58);
}

.signal-row {
  grid-template-columns: 80px minmax(0, 1fr) auto;
}

.signal-row time {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.signal-row strong,
.table-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.signal-row button,
.table-row button {
  all: unset;
  display: grid;
  grid-template-columns: inherit;
  gap: inherit;
  align-items: center;
  grid-column: 1 / -1;
  width: 100%;
  cursor: pointer;
}

.signal-row button > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.signal-row button > div span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-row:hover,
.signal-row.is-selected,
.table-row:hover {
  border-color: rgba(191, 214, 76, 0.4);
  background: rgba(191, 214, 76, 0.08);
}

.tag {
  min-width: max-content;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-style: normal;
}

.tag.bullish {
  background: rgba(191, 214, 76, 0.12);
  color: var(--accent);
}

.tag.bearish {
  background: rgba(255, 127, 95, 0.12);
  color: var(--danger);
}

.tag.neutral {
  background: rgba(146, 168, 255, 0.16);
  color: var(--neutral);
}

.insight-layout {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.insight-card {
  display: none;
  padding: 18px;
}

.insight-card.is-active {
  display: block;
}

.insight-card__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.insight-card__header p {
  max-width: 46rem;
  font-size: 13px;
  line-height: 1.62;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
}

.analysis-summary,
.analysis-narrative,
.score-card,
.summary-bands div,
.narrative-block,
.heat-card {
  border-radius: var(--radius-md);
}

.analysis-summary {
  display: grid;
  gap: 12px;
}

.score-card,
.summary-bands div,
.narrative-block,
.heat-card,
.data-table .table-row {
  border: 1px solid var(--border);
  background: rgba(8, 11, 13, 0.58);
}

.score-card {
  padding: 18px;
}

.score-card span,
.summary-bands span {
  display: block;
  color: var(--faint);
  font-size: 11px;
}

.score-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(52px, 5vw, 76px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.score-card small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.summary-bands {
  display: grid;
  gap: 10px;
}

.summary-bands div {
  padding: 12px 14px;
}

.summary-bands strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.analysis-narrative {
  display: grid;
  gap: 12px;
}

.narrative-block {
  padding: 14px;
}

.bullet-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.bullet-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  line-height: 1.62;
  font-size: 13px;
}

.data-table {
  display: grid;
  gap: 10px;
}

.table-head,
.table-row {
  display: grid;
  grid-template-columns: 64px 120px 1.4fr repeat(4, minmax(0, 0.8fr));
}

.table-head {
  color: var(--faint);
  padding: 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table-cell,
.table-head span {
  min-width: 0;
}

.table-cell {
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.table-cell.mono {
  font-family: var(--font-mono);
}

.heat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.heat-card {
  padding: 16px;
}

.heat-card__top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.heat-card__top strong {
  font-size: 16px;
}

.heat-score {
  font-family: var(--font-mono);
  font-size: 24px;
}

.heat-card p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.heat-meters {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.meter-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}

.meter-row span {
  color: var(--faint);
}

.meter-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.meter-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.empty-state {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1200px) {
  .topbar,
  .workspace,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .hero-chip {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .side-panel {
    position: static;
  }

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

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

@media (max-width: 900px) {
  .control-bar {
    grid-template-columns: 1fr 1fr;
  }

  .prompt-field,
  .control-actions {
    grid-column: 1 / -1;
  }

  .table-head,
  .table-row {
    grid-template-columns: 60px 108px 1.2fr repeat(2, minmax(0, 0.8fr));
  }

  .table-head span:nth-child(n + 6),
  .table-row .table-cell:nth-child(n + 6) {
    display: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 16px, 1600px);
    padding-top: 10px;
  }

  .brand-lockup {
    align-items: start;
    padding: 14px;
  }

  .brand-logo {
    width: 68px;
  }

  .section-nav {
    overflow: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .section-nav::-webkit-scrollbar {
    display: none;
  }

  .pulse-rail,
  .heat-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .chart-header,
  .insight-card__header {
    display: grid;
  }

  .legend {
    justify-content: start;
  }

  .price-chart {
    height: 420px;
  }

  .indicator-chart {
    height: 170px;
  }

  .signal-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .signal-row .tag {
    grid-column: 2;
    justify-self: start;
  }

  .table-head {
    display: none;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  .table-cell {
    white-space: normal;
  }

  .table-cell::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 88px;
    margin-right: 8px;
    color: var(--faint);
    font-size: 11px;
  }
}
