:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1b1f24;
  --muted: #6b7280;
  --line: #e2e5ea;
  --accent: #1f6feb;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #b3261e;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.top {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem;
  align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  background: #111827; color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 600; }
.nav { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.nav a { color: #dbeafe; text-decoration: none; }
.nav a:hover { text-decoration: underline; }

main { max-width: 900px; margin: 0 auto; padding: 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 1rem;
}
.card.narrow { max-width: 520px; margin: 2rem auto; }

h1 { font-size: 1.35rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }

.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.space { justify-content: space-between; }
.inline { display: inline; }

.stack { display: flex; flex-direction: column; gap: .75rem; }

label { display: block; font-weight: 500; }
label.small { font-weight: 400; font-size: .875rem; }
label.big { font-size: 1.05rem; }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }

input[type=text], input[type=password], textarea, select {
  width: 100%; padding: .6rem .7rem; margin-top: .25rem;
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button {
  display: inline-block;
  padding: .6rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff; color: var(--ink);
  font: inherit; cursor: pointer; text-decoration: none;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: #fff; border-color: var(--bad); color: var(--bad); }
button.link { background: none; border: none; color: #dbeafe; padding: 0; }
button:disabled { opacity: .5; cursor: not-allowed; }

.alert { padding: .7rem .9rem; border-radius: 8px; margin: .5rem 0; }
.alert.error { background: #fdecea; color: #7f1d1d; border: 1px solid #f5c2c0; }
.alert.warn { background: #fff8e6; color: #6b4b00; border: 1px solid #f0dca4; }

.bar { height: 10px; background: #e6e9ee; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); transition: width .4s ease; }

.stages { list-style: none; padding: 0; margin: .75rem 0; }
.stages li { padding: .25rem 0 .25rem 1.5rem; position: relative; color: var(--muted); }
.stages li::before { content: "○"; position: absolute; left: 0; }
.stages li.current { color: var(--ink); font-weight: 600; }
.stages li.current::before { content: "◐"; color: var(--accent); }

.log { margin: .25rem 0; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; }

.status { font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; background: #eef1f5; color: #374151; }
.status-ready { background: #e6f4ea; color: #14532d; }
.status-failed { background: #fdecea; color: #7f1d1d; }
.status-awaiting_answers { background: #fff4e5; color: #7c4a03; }
.status-running { background: #e8f0fe; color: #1e3a8a; }

.tasklist { list-style: none; padding: 0; margin: 0; }
.tasklist li { display: flex; flex-direction: column; gap: .15rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.tasklist li:last-child { border-bottom: none; }
.tasklist a { text-decoration: none; color: inherit; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.projects, .facts, .files, .checks, .notes { padding-left: 1.1rem; margin: .5rem 0; }
.files code, code { background: #f1f3f6; padding: .05rem .3rem; border-radius: 4px; font-size: .9em; }

.question { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; margin: 0; }
.question legend { font-weight: 600; padding: 0 .3rem; }
.tag { font-size: .75rem; background: #e8f0fe; color: #1e3a8a; border-radius: 999px; padding: .1rem .45rem; }

.checks li { margin: .25rem 0; }
.check-ok::marker { color: var(--ok); }
.check-warn::marker { color: var(--warn); }
.check-fail::marker { color: var(--bad); }

pre, .md {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .7rem;
  font-size: .875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  max-height: 28rem;
  overflow: auto;
}
details.quote pre { max-height: 12rem; }
summary { cursor: pointer; padding: .25rem 0; }

.foot { max-width: 900px; margin: 0 auto; padding: 1rem; color: var(--muted); font-size: .8rem; }

@media (max-width: 600px) {
  main { padding: .6rem; }
  .card { padding: .8rem; }
  h1 { font-size: 1.2rem; }
}
