:root {
  --bg: #fafafa; --surface: #fff; --ink: #15171a; --muted: #6b7178; --line: #e6e8eb;
  --blue: #2f57d6; --green: #138a5b; --red: #c0392b; --amber: #b7791f;
  --radius: 12px; --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.6; }
h1, h2, h3 { font-weight: 500; }
h2 { font-size: 20px; margin: 0 0 4px; }
h3 { font-size: 16px; margin: 0 0 4px; }
.lede { color: var(--muted); margin: 0 0 16px; max-width: 60ch; }
code, pre { font-family: var(--mono); font-size: 13px; }

.signin { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.signin-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; max-width: 420px; text-align: center; }
.signin-note { color: var(--muted); font-size: 13px; margin: 14px 0 18px; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { font-weight: 600; letter-spacing: 0.04em; }
.nav { display: flex; gap: 4px; }
.nav button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); cursor: pointer; font: inherit; }
.nav button.active { background: #eef1fb; color: var(--blue); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.who button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 10px; cursor: pointer; font: inherit; }

.main { max-width: 920px; margin: 0 auto; padding: 28px 24px; }
.view { animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.path-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 18px;
}
.path-note span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 24px; }
.profile-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 6px; }
.profile-card:hover { border-color: #c8cdd4; }
.profile-card.selected { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.profile-card strong { font-weight: 500; }
.profile-card span { color: var(--muted); font-size: 13px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.setup-steps {
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--line);
  overflow: hidden;
  margin: 0 0 14px;
}
.setup-steps div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  background: var(--surface);
  padding: 9px 12px;
}
.setup-steps strong {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #eef1fb;
  color: var(--blue);
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}
.setup-steps span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.kv { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.kv span { width: 110px; color: var(--muted); font-size: 13px; }
.kv code { background: #f3f4f6; padding: 4px 8px; border-radius: 6px; overflow: auto; flex: 1; white-space: nowrap; }
.mini { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 12px; }
.snippet { background: #f3f4f6; border-radius: 8px; padding: 12px; overflow: auto; white-space: pre; margin: 10px 0 16px; }
.safe-note {
  margin: -4px 0 16px;
  border-left: 3px solid var(--blue);
  padding-left: 10px;
  color: var(--muted);
  font-size: 13px;
}

.grade-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.grade-option { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.grade-option label { font-size: 13px; color: var(--muted); }
.grade-option select, .grade-option input { font: inherit; padding: 7px; border: 1px solid var(--line); border-radius: 8px; }
.option-help {
  min-height: 40px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.tape-example {
  color: var(--muted);
  font-size: 13px;
}
.tape-example summary {
  cursor: pointer;
  color: var(--blue);
}
.tape-example pre {
  margin: 8px 0 0;
  max-height: 150px;
  white-space: pre-wrap;
}
.btn { border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font: inherit; }
.btn.primary { background: var(--blue); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.status { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.verdict { display: flex; gap: 16px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.verdict-badge { font-weight: 600; font-size: 12px; letter-spacing: 0.06em; padding: 6px 10px; border-radius: 6px; background: #eef1fb; color: var(--blue); white-space: nowrap; }
.verdict-badge.earned { background: #e6f4ec; color: var(--green); }
.verdict-badge.cost { background: #fbeae8; color: var(--red); }
.verdict-badge.neutral { background: #f1f2f4; color: var(--muted); }
.verdict-body strong { font-size: 17px; font-weight: 500; }
.verdict-net { margin-top: 4px; }
.verdict-units, .verdict-meta { color: var(--muted); font-size: 13px; }
.verdict-meta { margin-top: 6px; }
.result-boundary {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.chart-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.chart-legend { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chart-legend .dot.baseline { background: #9aa0a6; margin-left: 8px; }
.chart-legend .dot.treated { background: var(--blue); margin-left: 16px; }
.twin-chart svg { width: 100%; height: 200px; }
.twin-svg .grid { stroke: var(--line); }
.twin-svg .line { fill: none; stroke-width: 1.6; }
.twin-svg .line.baseline { stroke: #9aa0a6; }
.twin-svg .line.treated { stroke: var(--blue); }
.twin-svg .fork { stroke: var(--amber); stroke-dasharray: 3 3; }

.diff-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.diff-row { background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.diff-row span { color: var(--muted); font-size: 12px; }
.diff-row strong { font-weight: 500; }

.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; cursor: pointer; }
.history-item:hover { border-color: #c8cdd4; }
.history-item > div:first-child { display: flex; flex-direction: column; }
.history-item span { color: var(--muted); font-size: 13px; }
.history-verdict { margin-left: auto; font-weight: 500; }
.history-verdict.earned { color: var(--green); }
.history-verdict.cost { color: var(--red); }
.history-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.empty { color: var(--muted); list-style: none; padding: 16px 0; }

.publish-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.publish-link { color: var(--muted); font-size: 13px; }
.publish-link a { color: var(--blue); }
.promote-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.exam-status { color: var(--muted); font-size: 13px; }
.cert-exam { margin-top: 14px; padding: 12px 14px; background: #e6f4ec; border: 1px solid #bfe0cd; border-radius: var(--radius); color: var(--green); font-size: 14px; }
.exam-badge { font-weight: 600; font-size: 12px; letter-spacing: 0.05em; margin-right: 6px; }

.cert-page { max-width: 760px; margin: 0 auto; padding: 32px 24px; }
.cert-error { color: var(--red); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.cert { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.cert-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.cert-mark { font-weight: 600; letter-spacing: 0.08em; font-size: 13px; }
.cert-mark span { color: var(--blue); }
.cert-board-link { color: var(--blue); font-size: 13px; text-decoration: none; }
.cert-agent { color: var(--muted); margin: 0 0 16px; }
.cert-manifest { color: var(--muted); font-size: 12px; margin: 16px 0 0; font-family: var(--mono); }
.cert-claims { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.cert-claims p { color: var(--muted); font-size: 12px; margin: 6px 0; }
.cert-claims strong { color: var(--ink); font-weight: 500; }

.board-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.board-row { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.board-row .rank { font-weight: 600; color: var(--muted); width: 24px; text-align: right; }
.board-who { display: flex; flex-direction: column; }
.board-who span { color: var(--muted); font-size: 13px; }
.board-verdict { margin-left: auto; font-weight: 500; }
.board-verdict.earned { color: var(--green); }
.board-verdict.cost { color: var(--red); }
.board-view { color: var(--blue); font-size: 13px; text-decoration: none; }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .who { width: 100%; margin-left: 0; justify-content: space-between; }
  .main { padding: 22px 16px; }
  .grade-row { grid-template-columns: 1fr; }
  .kv { align-items: flex-start; flex-wrap: wrap; }
  .kv span { width: 100%; }
  .kv code { min-width: 0; width: 100%; }
  .verdict { flex-direction: column; }
}
