:root {
  --canvas: #0b1114;
  --canvas-2: #10181c;
  --surface: rgba(13, 21, 24, 0.92);
  --surface-strong: rgba(16, 26, 30, 0.98);
  --surface-soft: rgba(17, 32, 36, 0.72);
  --border: rgba(122, 150, 152, 0.22);
  --text: #edf5f2;
  --muted: rgba(237, 245, 242, 0.68);
  --faint: rgba(237, 245, 242, 0.44);
  --accent: #7dd4c2;
  --accent-strong: #46b8a7;
  --accent-2: #f5b86e;
  --bull: #52d1ac;
  --bear: #f1737f;
  --neutral: #7ab8ff;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.28);
  --font-display: "Space Grotesk", "IBM Plex Sans", sans-serif;
  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(82, 209, 172, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(245, 184, 110, 0.06), transparent 26%),
    linear-gradient(135deg, #081014, #0b1114 38%, #09161a 100%);
}

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

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.topbar,
.hero-strip,
.control-panel,
.chart-card,
.side-panel,
.footnote {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(19, 33, 38, 0.95), rgba(11, 18, 21, 0.96));
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  margin-bottom: 14px;
  background:
    linear-gradient(90deg, rgba(125, 212, 194, 0.08), transparent 46%),
    linear-gradient(180deg, rgba(17, 29, 33, 0.98), rgba(11, 18, 21, 0.98));
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(90deg, #000 30%, transparent 86%);
  pointer-events: none;
}

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

.brand-lockup {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  max-width: 820px;
}

.brand-logo {
  width: 68px;
  min-width: 68px;
  height: 68px;
}

.eyebrow,
.hero-kicker,
.chart-kicker,
.header-chip,
.detail-pill,
.status-copy,
.panel-note,
.footnote p,
label span {
  letter-spacing: 0.02em;
}

.eyebrow,
.hero-kicker,
.chart-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.02;
}

.lede {
  margin-top: 10px;
  max-width: 58ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.header-rail {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-content: flex-start;
}

.header-chip,
.detail-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(125, 212, 194, 0.2);
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
}

.header-chip {
  color: var(--text);
  background: rgba(12, 18, 21, 0.72);
}

.header-chip.subtle {
  color: var(--muted);
  border-color: rgba(122, 150, 152, 0.16);
}

.hero-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(260px, 0.82fr);
  gap: 18px;
  margin-bottom: 14px;
  padding: 20px 22px;
}

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

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

.hero-grid article {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(122, 150, 152, 0.16);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(18, 33, 37, 0.96), rgba(12, 18, 21, 0.88));
}

.hero-grid h2 {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 18px;
}

.hero-grid p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.hero-visual-frame {
  display: grid;
  align-items: stretch;
}

.hero-visual {
  width: 100%;
  height: 100%;
  min-height: 184px;
  object-fit: cover;
  border-radius: calc(var(--radius-lg) - 8px);
  border: 1px solid rgba(245, 184, 110, 0.18);
  background: linear-gradient(180deg, rgba(10, 16, 19, 0.72), rgba(10, 16, 19, 0.88));
}

.control-panel {
  margin-bottom: 14px;
  padding: 18px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}

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

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

select,
textarea,
button {
  border: 1px solid rgba(122, 150, 152, 0.18);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(7, 14, 17, 0.82);
}

select,
button {
  min-height: 44px;
}

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

textarea {
  width: 100%;
  min-height: 72px;
  max-height: 124px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}

textarea::placeholder {
  color: rgba(237, 245, 242, 0.32);
}

button {
  padding: 0 16px;
  font-weight: 600;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

#reloadButton {
  background: linear-gradient(180deg, rgba(125, 212, 194, 0.2), rgba(70, 184, 167, 0.14));
  border-color: rgba(125, 212, 194, 0.38);
}

.ghost-button {
  background: rgba(245, 184, 110, 0.08);
  border-color: rgba(245, 184, 110, 0.22);
  color: var(--accent-2);
}

.prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
  margin-top: 12px;
}

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

.button-group {
  display: grid;
  gap: 12px;
  align-content: stretch;
}

.status-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(122, 150, 152, 0.12);
}

.status-pill {
  font-weight: 600;
}

.status-pill.info {
  color: var(--neutral);
  border-color: rgba(122, 184, 255, 0.3);
}

.status-pill.success {
  color: var(--bull);
  border-color: rgba(82, 209, 172, 0.36);
}

.status-pill.warn {
  color: var(--accent-2);
  border-color: rgba(245, 184, 110, 0.36);
}

.status-pill.error {
  color: var(--bear);
  border-color: rgba(241, 115, 127, 0.34);
}

.status-copy {
  color: var(--muted);
  font-size: 12px;
}

#promptEcho {
  min-width: min(420px, 100%);
  flex: 1 1 300px;
}

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

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

.chart-card {
  min-width: 0;
}

.chart-card.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(125, 212, 194, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(125, 212, 194, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.25;
  pointer-events: none;
}

.chart-header,
.panel-block {
  position: relative;
  z-index: 1;
}

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

.chart-header h2,
.panel-title-row h3 {
  font-family: var(--font-display);
}

.chart-header h2 {
  margin-top: 4px;
  font-size: 22px;
}

#indicatorSubtitle,
#indicatorNote,
.panel-note,
.legend,
.metric-grid dt,
.signal-row span,
.signal-row time {
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 10px;
  max-width: 380px;
  font-size: 12px;
}

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

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

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

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

.price-chart,
.indicator-chart {
  width: 100%;
}

.price-chart {
  height: min(66vh, 680px);
  min-height: 420px;
}

.indicator-chart {
  height: 230px;
}

.side-panel {
  padding: 14px;
}

.panel-block + .panel-block {
  margin-top: 12px;
}

.panel-block {
  padding: 16px;
  border: 1px solid rgba(122, 150, 152, 0.14);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(16, 28, 33, 0.98), rgba(11, 18, 21, 0.92)),
    url("./assets/brand/hero.svg") center / cover no-repeat;
  background-blend-mode: screen, normal;
}

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

.panel-title-row span {
  color: var(--faint);
  font-size: 11px;
  white-space: nowrap;
}

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

.metric-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(122, 150, 152, 0.12);
  border-radius: 14px;
  background: rgba(6, 12, 15, 0.48);
}

.metric-grid dt {
  margin-bottom: 8px;
  font-size: 11px;
}

.metric-grid dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.4;
}

.preset-list {
  display: grid;
  gap: 10px;
}

.preset-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(122, 150, 152, 0.14);
  border-radius: 14px;
  background: rgba(8, 14, 17, 0.58);
}

.preset-item strong {
  font-size: 13px;
}

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

.preset-item.active {
  border-color: rgba(125, 212, 194, 0.36);
  box-shadow: inset 0 0 0 1px rgba(125, 212, 194, 0.12);
}

.signal-table {
  display: grid;
  gap: 10px;
  max-height: min(54vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.signal-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(122, 150, 152, 0.12);
  border-radius: 14px;
  background: rgba(5, 10, 12, 0.52);
  text-align: left;
  transition:
    border-color 140ms ease,
    transform 140ms ease,
    background 140ms ease;
}

.signal-row:hover,
.signal-row.is-active {
  border-color: rgba(125, 212, 194, 0.28);
  background: rgba(9, 18, 21, 0.84);
  transform: translateY(-1px);
}

.signal-row time {
  font-family: var(--font-mono);
  font-size: 11px;
}

.signal-row strong {
  display: block;
  font-size: 13px;
  line-height: 1.45;
}

.signal-row span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(122, 150, 152, 0.16);
  border-radius: 999px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.tag.bullish {
  color: var(--bull);
}

.tag.bearish {
  color: var(--bear);
}

.tag.neutral {
  color: var(--neutral);
}

.empty-state {
  padding: 18px;
  border: 1px dashed rgba(122, 150, 152, 0.22);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.footnote {
  margin-top: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(9, 15, 18, 0.92), rgba(6, 10, 12, 0.98));
}

.footnote p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 1220px) {
  .hero-strip,
  .workspace,
  .prompt-row {
    grid-template-columns: 1fr;
  }

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

  .header-rail {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw, calc(100vw - 18px));
    padding-top: 10px;
  }

  .topbar,
  .hero-strip,
  .control-panel,
  .side-panel,
  .footnote {
    border-radius: 20px;
  }

  .topbar,
  .chart-header {
    flex-direction: column;
  }

  .brand-lockup {
    flex-direction: column;
  }

  .brand-logo {
    width: 56px;
    min-width: 56px;
    height: 56px;
  }

  .hero-grid,
  .control-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .legend {
    justify-content: flex-start;
  }

  .price-chart {
    height: 54vh;
    min-height: 340px;
  }

  .indicator-chart {
    height: 210px;
  }

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

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

  .signal-table {
    max-height: none;
  }
}
