:root {
  --bg: #0d1117; --panel: #161b22; --border: #30363d; --fg: #e6edf3;
  --muted: #8b949e; --accent: #2f81f7; --pos: #3fb950; --neg: #f85149;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* login */
body.login { display: grid; place-items: center; min-height: 100vh; }
.auth-card { width: min(92vw, 380px); text-align: center; }
.auth-card h1 { margin: 0 0 4px; letter-spacing: -0.5px; }
.reg { margin-top: 18px; text-align: left; border-top: 1px solid var(--border); padding-top: 14px; }
.reg summary { cursor: pointer; color: var(--muted); }
.input {
  width: 100%; margin: 8px 0; padding: 10px; border-radius: 8px;
  border: 1px solid var(--border); background: #0b0f14; color: var(--fg);
}
.btn {
  width: 100%; padding: 11px 14px; margin-top: 8px; cursor: pointer;
  border-radius: 8px; border: 1px solid var(--border); background: var(--panel);
  color: var(--fg); font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.tiny { width: auto; padding: 5px 10px; font-size: 12px; font-weight: 500; }
.msg { min-height: 20px; margin-top: 12px; font-size: 13px; }
.msg.error { color: var(--neg); }
.msg.ok { color: var(--pos); }

/* app shell */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--panel);
  position: sticky; top: 0; z-index: 2;
}
.brand { font-weight: 700; letter-spacing: -0.3px; }
.status { display: flex; align-items: center; gap: 10px; }
.pill {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: #0b0f14; color: var(--muted);
}
.pill.live { color: var(--pos); border-color: var(--pos); }
.pill.closed { color: var(--muted); }

.grid {
  display: grid; gap: 16px; padding: 20px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  max-width: 1200px; margin: 0 auto;
}
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; }
.kpi { grid-column: 1 / -1; }
.kpi-main { display: flex; align-items: baseline; gap: 12px; }
.kpi-main b { font-size: 30px; }
.kpi-main .muted { margin-right: 4px; }
.chip { padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 600; background: #0b0f14; }
.chip.pos { color: var(--pos); } .chip.neg { color: var(--neg); }
.kpi-row { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 14px; }
.kpi-row div { display: flex; flex-direction: column; }
.kpi-row b { font-size: 17px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.list li:last-child { border-bottom: none; }
.tag {
  display: inline-block; min-width: 40px; text-align: center; padding: 1px 6px;
  border-radius: 5px; font-size: 11px; font-weight: 700; background: #0b0f14;
  border: 1px solid var(--border);
}
#curve { width: 100%; height: 140px; }
.empty { padding: 8px 0; }

.card.wide { grid-column: 1 / -1; }
#sig-history td:last-child, #sig-history th:last-child { text-align: left; }
.pill.pre { color: #d29922; border-color: #d29922; }
