:root {
  --bg: #0b1020;
  --card: #121a2f;
  --text: #e8eefc;
  --muted: #9aa8c7;
  --accent: #5b8cff;
  --good: #3ddc97;
  --bad: #ff6b6b;
  --line: #243049;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2750 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
h1 { margin: 0; font-size: 1.4rem; letter-spacing: 0.02em; }
.sub { margin: 0.25rem 0 0; color: #9aa8c7; font-size: 0.9rem; }
.pill {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: #1b2744;
  border: 1px solid var(--line);
  font-size: 0.85rem;
}
.pill.ok { border-color: #2f6b4f; color: var(--good); }
.pill.bad { border-color: #7a3030; color: var(--bad); }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem 1.5rem 2rem;
}
@media (min-width: 1100px) {
  .grid { grid-template-columns: 420px 1fr; }
}
.card {
  background: color-mix(in srgb, var(--card) 92%, black);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem 1.2rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
h2 { margin: 0 0 0.9rem; font-size: 1.05rem; }
h3 { margin: 1.2rem 0 0.5rem; font-size: 0.95rem; color: #b7c4e0; }
.row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.checks {
  grid-template-columns: 1fr;
}
label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: #9aa8c7;
}
.checks label {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
}
input, select, button, pre {
  font: inherit;
}
input, select {
  background: #0d1528;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
}
button {
  width: 100%;
  margin-top: 0.4rem;
  background: linear-gradient(180deg, #6b98ff, #4576e6);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary {
  background: #1b2744;
  border: 1px solid var(--line);
  width: auto;
}
.progress { margin-top: 0.9rem; }
.progress.hidden { display: none; }
.bar {
  height: 8px;
  background: #0d1528;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3ddc97, #5b8cff);
  transition: width 0.25s ease;
}
#progress-text { margin-top: 0.4rem; font-size: 0.85rem; color: #9aa8c7; }
.meta { font-size: 0.85rem; color: #9aa8c7; margin-bottom: 0.7rem; }
.table-wrap { overflow: auto; max-height: 360px; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th, td { padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #152038; }
td.mono, #code { font-family: var(--mono); }
#code {
  background: #0a1222;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  max-height: 420px;
  overflow: auto;
  font-size: 0.75rem;
  white-space: pre-wrap;
}
footer {
  padding: 0 1.5rem 1.5rem;
  color: #7f8db0;
  font-size: 0.8rem;
}
.ok-text { color: var(--good); }
.bad-text { color: var(--bad); }

.detail { margin-top: 1rem; }
.detail.hidden { display: none; }
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.detail-head h3 { margin: 0; }
.equity-legend {
  font-size: 0.78rem;
  color: #9aa8c7;
  font-family: var(--mono);
}
#equity-canvas {
  width: 100%;
  height: 320px;
  margin-top: 0.6rem;
  background: #0a1222;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: block;
}
.hint {
  margin: 0.45rem 0 0.8rem;
  font-size: 0.8rem;
  color: #7f8db0;
}
tr.selected {
  background: rgba(91, 140, 255, 0.12);
}
