@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap');
:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #0f1117;
  --muted: #6b7280;
  --line: #ececf1;
  --line-strong: #d9dae0;
  --accent: #3a4bdc;
  --accent-soft: #eef0ff;
  --pos: #16a34a;
  --neg: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,17,23,.04), 0 8px 24px rgba(16,17,23,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Top bar */
.topbar {
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; letter-spacing: -0.01em;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.topbar-note { color: var(--muted); font-size: 12px; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
.footer {
  border-top: 1px solid var(--line);
  padding: 20px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.muted { color: var(--muted); margin: 4px 0 0; }
.back { color: var(--muted); font-size: 12px; }
.back:hover { color: var(--ink); }

/* Buttons */
.btn {
  appearance: none; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 10px; font-size: 13px;
  cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { background: #fafafe; border-color: #c7c9d1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Grid of cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.card-link { display: block; padding: 16px; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { font-weight: 600; letter-spacing: -0.01em; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  background: #f3f4f8; color: var(--muted);
}
.badge.buy { background: #e7f7ec; color: #15803d; }
.badge.sell { background: #fdecec; color: #b91c1c; }
.badge.hold { background: #f3f4f8; color: #4b5563; }

.card-spark { height: 50px; margin: 10px 0 6px; }
.card-spark svg { width: 100%; height: 50px; display: block; }

.card-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 6px; }
.card-row .right { text-align: right; }
.label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.value { font-variant-numeric: tabular-nums; font-weight: 600; }
.value.big { font-size: 24px; letter-spacing: -0.02em; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* Progress bar */
.bar {
  height: 6px; background: #f1f2f6; border-radius: 999px;
  overflow: hidden; margin-top: 10px;
}
.bar.large { height: 10px; margin-top: 14px; }
.bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #7c8cff, var(--accent));
  border-radius: 999px;
  transition: width .3s ease;
}

/* Panels */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.panel-head .legend { flex-wrap: wrap; row-gap: 4px; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;}
.controls label { color: var(--muted); font-size: 12px; }
.controls input[type="number"] {
  width: 70px; padding: 6px 8px; border: 1px solid var(--line-strong);
  border-radius: 8px; font: inherit; color: var(--ink); background: #fff;
}

.threshold-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.threshold-control input[type="range"] {
  width: 130px;
  accent-color: var(--accent);
  cursor: pointer;
  background: transparent;
}

#bt-threshold-val {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
  min-width: 38px;
  display: inline-block;
  text-align: right;
}

.muted.small {
  font-size: 12px;
  margin: -6px 0 14px;
}

.muted.small b {
  color: var(--ink);
  font-weight: 600;
}


/* Price block */
.price-block { text-align: right; }

/* Predict grid */
.predict-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 16px;
}
.metric .value { font-size: 16px; }
.metric .value.big { font-size: 28px; }

/* Charts */
.chart-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}
.chart { width: 100%; height: 340px; }

/* Legend */
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; align-items: center; }
.legend .sw {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 6px;
}

/* Stats row */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-row .metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fcfcfe;
}

@media (max-width: 720px) {
  .predict-grid { grid-template-columns: 1fr 1fr; }
  .chart { height: 260px; }
}