:root {
  --bg: #0b1020;
  --panel: #151d34;
  --panel-soft: #1c2642;
  --text: #e6ebff;
  --muted: #93a0c5;
  --up: #ff4d4f;
  --down: #21c36f;
  --neutral: #7f8ea8;
  --warning: #ffb020;
  --critical: #ff7875;
  --line: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", sans-serif;
  background: linear-gradient(180deg, #080d1b 0%, #10172b 100%);
  color: var(--text);
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.tag {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 77, 79, 0.12);
  color: #ffc7c7;
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 16px;
}

.top-grid {
  grid-template-columns: 1fr 1fr 1.4fr;
  margin-bottom: 16px;
}

.metrics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.card {
  background: rgba(21, 29, 52, 0.92);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.timeline-card {
  margin-bottom: 16px;
}

.label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.price {
  font-size: 40px;
  font-weight: 700;
  color: var(--up);
}

.subtext,
.summary,
.levels {
  color: var(--muted);
  margin-top: 10px;
}

.subtext.compact {
  margin-top: 6px;
  font-size: 13px;
}

.trade-action {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
}

.trade-action.long,
.signal.long,
.pill.long,
.timeframe-direction.long {
  color: var(--up);
}

.trade-action.short,
.signal.short,
.pill.short,
.timeframe-direction.short {
  color: var(--down);
}

.trade-action.neutral,
.signal.neutral,
.pill.neutral,
.timeframe-direction.neutral {
  color: var(--neutral);
}

.trade-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.signal {
  font-size: 36px;
  font-weight: 700;
}

.metric-list {
  display: grid;
  gap: 10px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.metric-row span {
  color: var(--muted);
}

.metric-row strong {
  text-align: right;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-head-stack {
  align-items: flex-start;
}

.section-head h2,
.card h2 {
  margin: 0;
  font-size: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

.pill.muted {
  color: var(--muted);
}

.alerts-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.filter-button {
  border: 1px solid rgba(147, 160, 197, 0.28);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-button:hover {
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--text);
}

.filter-button.active {
  color: var(--text);
  background: rgba(255, 176, 32, 0.12);
  border-color: rgba(255, 176, 32, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 176, 32, 0.18);
}

.resonance-score {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.history-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.history-meta {
  text-align: right;
}

.resonance-history {
  height: 82px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-top: 12px;
}

.history-empty {
  color: var(--muted);
  font-size: 13px;
}

.history-bar-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 100%;
}

.history-bar-wrap.latest {
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.12));
}

.history-bar {
  width: 100%;
  min-width: 8px;
  border-radius: 8px 8px 4px 4px;
  background: rgba(127, 142, 168, 0.55);
}

.history-bar.long {
  background: linear-gradient(180deg, rgba(255, 77, 79, 0.35) 0%, rgba(255, 77, 79, 0.92) 100%);
}

.history-bar.short {
  background: linear-gradient(180deg, rgba(33, 195, 111, 0.35) 0%, rgba(33, 195, 111, 0.92) 100%);
}

.history-bar.neutral {
  background: linear-gradient(180deg, rgba(127, 142, 168, 0.3) 0%, rgba(127, 142, 168, 0.88) 100%);
}

.timeframe-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.timeframe-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--panel-soft);
}

.timeframe-item.long {
  box-shadow: inset 0 0 0 1px rgba(255, 77, 79, 0.18);
}

.timeframe-item.short {
  box-shadow: inset 0 0 0 1px rgba(33, 195, 111, 0.18);
}

.timeframe-item.neutral {
  box-shadow: inset 0 0 0 1px rgba(127, 142, 168, 0.18);
}

.timeframe-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.timeframe-name {
  font-size: 16px;
  font-weight: 700;
}

.timeframe-score,
.timeframe-reasons {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 6px;
}

.alerts-list,
.news-list,
.positions-list,
.timeline-list {
  display: grid;
  gap: 12px;
}

.alert-item,
.news-item,
.position-item,
.timeline-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--panel-soft);
}

.alert-item.high,
.timeline-item.high {
  box-shadow: inset 0 0 0 1px rgba(255, 176, 32, 0.22);
}

.alert-item.medium,
.timeline-item.medium {
  box-shadow: inset 0 0 0 1px rgba(127, 142, 168, 0.22);
}

.alert-item.critical,
.timeline-item.critical {
  box-shadow: inset 0 0 0 1px rgba(255, 120, 117, 0.28);
}

.alert-head {
  display: grid;
  gap: 6px;
}

.alert-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.alert-title {
  font-size: 15px;
  font-weight: 700;
}

.alert-severity {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.alert-severity.critical {
  color: #ffd0d0;
  background: rgba(255, 120, 117, 0.16);
}

.alert-severity.high {
  color: #ffe0a6;
  background: rgba(255, 176, 32, 0.14);
}

.alert-severity.medium {
  color: #d9e2ff;
  background: rgba(127, 142, 168, 0.14);
}

.alert-severity.low {
  color: #d9e2ff;
  background: rgba(127, 142, 168, 0.1);
}

.timeline-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  padding-left: 12px;
}

.timeline-axis {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  background: var(--neutral);
}

.timeline-dot.long {
  background: var(--up);
}

.timeline-dot.short {
  background: var(--down);
}

.timeline-line {
  width: 2px;
  flex: 1;
  min-height: 24px;
  background: rgba(255, 255, 255, 0.08);
}

.timeline-content {
  min-width: 0;
}

.timeline-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}

.timeline-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(127, 142, 168, 0.16);
}

.timeline-badge.alert {
  background: rgba(255, 176, 32, 0.16);
  color: #ffe3b3;
}

.timeline-badge.direction {
  background: rgba(255, 77, 79, 0.16);
  color: #ffd2d2;
}

.timeline-badge.price {
  background: rgba(33, 195, 111, 0.16);
  color: #c7ffe0;
}

.timeline-time,
.alert-meta,
.alert-message,
.position-meta,
.news-meta,
.news-summary,
.news-empty,
.timeline-meta,
.timeline-message {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.timeline-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.news-item {
  display: block;
  text-decoration: none;
  color: inherit;
}

.news-title,
.position-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

@media (max-width: 1040px) {
  .top-grid,
  .metrics-grid,
  .timeframe-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .hero,
  .section-head,
  .section-head-stack {
    flex-direction: column;
    align-items: flex-start;
  }

  .alerts-toolbar {
    justify-content: flex-start;
  }

  .timeline-item {
    grid-template-columns: 16px minmax(0, 1fr);
  }
}
