:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --buy: #3fb950;
  --sell: #f85149;
  --hold: #d29922;
  --accent: #58a6ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.site-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.site-logo:hover { text-decoration: none; }

.live-dot { color: var(--buy); font-size: 0.8rem; }

.site-links { display: flex; gap: 1rem; flex-wrap: wrap; }

.site-links a {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.site-links a:hover,
.site-links a.active { color: var(--text); }

.footer a { color: var(--accent); }

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.symbol {
  color: var(--muted);
  font-size: 0.9rem;
  margin-left: 0.75rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-demo {
  background: #d2992233;
  color: var(--hold);
  border: 1px solid var(--hold);
}

.badge-live {
  background: #3fb95033;
  color: var(--buy);
  border: 1px solid var(--buy);
}

.btn-notify {
  background: #21262d;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-notify:hover {
  background: #30363d;
}

.btn-notify.enabled {
  border-color: var(--buy);
  color: var(--buy);
}

.btn-notify.denied {
  border-color: var(--sell);
  color: var(--sell);
  opacity: 0.8;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

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

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.card h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.signal-card {
  grid-column: 1;
}

.indicators-card {
  grid-column: 2;
}

.stats-card {
  grid-column: 1 / -1;
}

.chart-card {
  grid-column: 1 / -1;
}

.history-card {
  grid-column: 1 / -1;
}

.label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.signal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.confidence {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--border);
  text-transform: capitalize;
}

.signal {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0.5rem 0 1rem;
  letter-spacing: 0.05em;
}

.signal.buy { color: var(--buy); }
.signal.sell { color: var(--sell); }
.signal.hold { color: var(--hold); }

.probability-panel {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.prob-row {
  margin-bottom: 0.75rem;
}

.prob-row:last-of-type {
  margin-bottom: 0.5rem;
}

.prob-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.prob-name {
  font-weight: 600;
  letter-spacing: 0.05em;
}

.buy-text { color: var(--buy); }
.sell-text { color: var(--sell); }

.prob-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.prob-bar-track {
  height: 10px;
  background: #21262d;
  border-radius: 999px;
  overflow: hidden;
}

.prob-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.buy-bar { background: linear-gradient(90deg, #238636, var(--buy)); }
.sell-bar { background: linear-gradient(90deg, #b62324, var(--sell)); }

.prob-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.price-row {
  display: flex;
  gap: 2rem;
  margin-bottom: 1rem;
}

.price {
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.value {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.level.sl .value { color: var(--sell); }
.level.tp .value { color: var(--buy); }

.reasons {
  list-style: none;
  font-size: 0.85rem;
  color: var(--muted);
}

.reasons li {
  padding: 0.3rem 0;
  border-top: 1px solid var(--border);
}

.reasons li:first-child {
  border-top: none;
}

.indicator-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 500px) {
  .indicator-grid,
  .levels {
    grid-template-columns: 1fr 1fr;
  }
}

.news-status {
  margin-top: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.news-status.clear {
  background: #3fb95022;
  color: var(--buy);
}

.news-status.blocked {
  background: #f8514922;
  color: var(--sell);
}

#price-chart {
  max-height: 320px;
}

.history-list {
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.history-item .sig {
  font-weight: 600;
  min-width: 3rem;
}

.history-item .sig.buy { color: var(--buy); }
.history-item .sig.sell { color: var(--sell); }

.footer {
  margin-top: 2rem;
  text-align: center;
  padding: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-value.positive { color: var(--buy); }
.stat-value.negative { color: var(--sell); }

.backtest-box {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.backtest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-small {
  background: #21262d;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
}

.btn-small:hover {
  background: #30363d;
}

#backtest-result {
  font-size: 0.85rem;
  line-height: 1.6;
}
