:root {
  --bg: #0b0f19;
  --surface: #141925;
  --surface2: #1c2235;
  --border: #2a3045;
  --text: #e2e5ed;
  --text-dim: #8b91a7;
  --accent: #6c8cff;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --radius: 10px;
  --maxw: 520px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding: 0;
}

a { color: var(--accent); text-decoration: none; }

h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-dim); }
h3 { font-size: 0.95rem; font-weight: 600; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* Header / Navigation */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 1.15rem; font-weight: 700; color: var(--accent); }
.nav-links { display: flex; gap: 12px; flex-wrap: wrap; }
.nav-links a {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface2); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.card-value { font-size: 1.3rem; font-weight: 700; }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-grid .card { margin-bottom: 0; }

/* Market state badge */
.state-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}
.state-wait { background: rgba(251,191,36,0.15); color: var(--yellow); }
.state-no-trade { background: rgba(107,114,128,0.2); color: var(--text-dim); }
.state-trade { background: rgba(52,211,153,0.15); color: var(--green); }
.state-closed { background: rgba(107,114,128,0.1); color: var(--text-dim); }
.state-research { background: rgba(108,140,255,0.15); color: var(--accent); }
.state-data { background: rgba(248,113,113,0.15); color: var(--red); }
.state-stale { background: rgba(251,146,60,0.15); color: var(--orange); }

/* Decision card — dominant */
.decision-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  margin-bottom: 16px;
  text-align: center;
}
.decision-card .decision-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.decision-card .decision-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.decision-card .decision-reason {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 8px;
}
.decision-card.research .decision-value { color: var(--accent); }

/* Price */
.price-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.price-main { font-size: 2.2rem; font-weight: 800; }
.price-change { font-size: 1rem; font-weight: 600; }
.price-change.up { color: var(--green); }
.price-change.down { color: var(--red); }
.price-change.flat { color: var(--text-dim); }

/* Info rows */
.info-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-dim); }
.info-value { font-weight: 600; }

/* Sections */
.section { margin-bottom: 16px; }
.section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
}

/* Why / What-if */
.why-list { list-style: none; padding: 0; }
.why-list li {
  padding: 4px 0;
  font-size: 0.9rem;
  color: var(--text);
  position: relative;
  padding-left: 16px;
}
.why-list li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
}

/* Research banner */
.research-banner {
  background: rgba(108,140,255,0.1);
  border: 1px solid rgba(108,140,255,0.25);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}
.research-banner strong { color: var(--accent); }

/* Warning banner */
.warning-banner {
  background: rgba(251,146,60,0.1);
  border: 1px solid rgba(251,146,60,0.25);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--orange);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 24px 0;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { text-align: left; padding: 8px 4px; color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--border); }
.data-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }

/* Loading / Error states */
.loading { color: var(--text-dim); font-size: 0.9rem; text-align: center; padding: 24px; }
.error-msg { color: var(--red); font-size: 0.85rem; padding: 8px; background: rgba(248,113,113,0.1); border-radius: 6px; margin: 8px 0; }

/* Freshness */
.freshness { font-size: 0.75rem; color: var(--text-dim); margin-top: 4px; }
.freshness.stale { color: var(--orange); }

/* Instrument tabs (index page) */
.instrument-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.instrument-tab {
  padding: 8px 20px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}
.instrument-tab.active { border-color: var(--accent); color: var(--accent); background: rgba(108,140,255,0.1); }

/* Mobile */
@media (max-width: 600px) {
  .container { padding: 0 12px; }
  .nav-links { gap: 6px; }
  .nav-links a { font-size: 0.75rem; padding: 3px 6px; }
  .card-grid { grid-template-columns: 1fr; }
  .decision-card .decision-value { font-size: 1.6rem; }
  .price-main { font-size: 1.8rem; }
  .card { padding: 12px; }
}

/* Desktop: wider container */
@media (min-width: 768px) {
  :root { --maxw: 640px; }
}
