:root {
  --bg: #0b1120;
  --panel: #111827;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.4;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 60ch;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 24px 0 16px;
}

button, .file-label {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

button:hover:not(:disabled), .file-label:hover { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }

#runBtn {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #04121c;
  font-weight: 600;
}
#runBtn:disabled { background: var(--panel); color: var(--text); border-color: var(--border); }

.horizon-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}
.horizon-label input {
  width: 64px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 0.9rem;
}

.samples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0 0 16px;
  font-size: 0.82rem;
}
.samples-label { color: var(--muted); }
.sample { display: inline-flex; align-items: center; gap: 6px; }
.sample a { color: var(--accent); text-decoration: none; font-family: ui-monospace, monospace; }
.sample a:hover { text-decoration: underline; }
.sample a.dl { color: var(--muted); font-size: 0.95rem; text-decoration: none; }
.sample a.dl:hover { color: var(--accent); }
.sample a.browse { color: var(--muted); font-style: italic; }
.sample a.browse:hover { color: var(--accent); }

.chart-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 10px;
  position: relative;
}

#chart {
  width: 100%;
  height: 360px;
  display: block;
}

.tip {
  position: absolute;
  display: none;
  pointer-events: none;
  z-index: 5;
  background: rgba(2, 6, 23, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.8rem;
  color: var(--text);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.tip b { color: #fff; font-weight: 600; }
.tip .tip-idx { color: var(--muted); }
.tip .tip-tag {
  display: inline-block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 6px;
}
.tip .tip-tag.history { background: rgba(148, 163, 184, 0.25); color: #cbd5e1; }
.tip .tip-tag.forecast { background: rgba(56, 189, 248, 0.25); color: var(--accent); }
.tip .tip-band { color: var(--muted); margin-top: 3px; }

.legend {
  display: flex;
  gap: 18px;
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 6px;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.sw.hist { background: #94a3b8; }
.sw.fc { background: var(--accent); }
.sw.band { background: rgba(56,189,248,0.3); height: 10px; border-radius: 3px; }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.8rem;
}
.status { color: var(--accent); font-family: ui-monospace, monospace; }
.meta { color: var(--muted); font-family: ui-monospace, monospace; }

.about {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.about h2 { font-size: 1rem; margin: 0 0 8px; }
.about p { color: var(--muted); font-size: 0.88rem; margin: 0 0 14px; max-width: 68ch; }
.about p a, .about .links a { color: var(--accent); text-decoration: none; }
.about p a:hover, .about .links a:hover { text-decoration: underline; }
.about .links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.about .links li {
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline;
  font-size: 0.85rem;
}
.about .links span { color: var(--muted); min-width: 170px; }
.about .links a { font-family: ui-monospace, monospace; word-break: break-all; }
