:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b6862;
  --line: #dedbd4;
  --rail: #c9c5bc;
  --running: #0f766e;
  --needs: #b45309;
  --blocked: #b42318;
  --waiting: #8a867e;
  --done: #3f7d3a;
  --question-bg: #fdf3e3;
  --focus: #0f766e;
  --p1: #a3472e;
  --p2: #4d6b2f;
  --p3: #2f5f6b;
  --p4: #7a5a1e;
  --p5: #6b3f5c;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --surface: #1f1e1c;
    --text: #edebe6;
    --muted: #a19d95;
    --line: #34322e;
    --rail: #4a4741;
    --running: #2bb3a3;
    --needs: #e59a3a;
    --blocked: #f0705f;
    --waiting: #8f8b83;
    --done: #74b06c;
    --question-bg: #2e2416;
    --focus: #2bb3a3;
    --p1: #e0876c;
    --p2: #9cbf6e;
    --p3: #6fb0c0;
    --p4: #d7b066;
    --p5: #c98bb4;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

button { font: inherit; color: inherit; }
button:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.bar-left, .bar-right { display: flex; align-items: center; gap: 16px; min-width: 0; }
.wordmark { font-weight: 700; letter-spacing: 0.01em; }
select {
  font: inherit;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  max-width: 60vw;
}
.live { font-size: 14px; color: var(--muted); white-space: nowrap; }
.live::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--done);
  vertical-align: 1px;
}
.live.stale::before { background: var(--needs); }
.who { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 14px; }

main { max-width: 1120px; margin: 0 auto; padding: 32px; }

.signin { max-width: 440px; margin: 12vh auto 0; }
.signin h1 { font-size: 28px; margin: 0 0 8px; }
.signin p { color: var(--muted); }
.primary {
  margin-top: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  cursor: pointer;
}
.error { color: var(--blocked); }

.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.board-head h1 { font-size: 30px; margin: 0; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters button {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.people { display: flex; gap: 32px; flex-wrap: wrap; margin: 20px 0 12px; }
.person { display: flex; align-items: center; gap: 10px; }
.person-facts { font-size: 14px; color: var(--muted); }
.person-facts strong { color: var(--text); font-weight: 600; }
.person-facts .ask { color: var(--needs); font-weight: 600; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.progress { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); margin-bottom: 24px; }
.progress span { display: block; height: 100%; }

.done-toggle { background: none; border: 0; padding: 0 0 8px; cursor: pointer; color: var(--done); font-weight: 600; }
.done-list { list-style: none; margin: 0 0 16px; padding: 0 0 0 28px; color: var(--muted); }
.done-list li { padding: 2px 0; }

.rail { list-style: none; margin: 0; padding: 0; }
.step { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 0 16px; padding-bottom: 28px; }
.step::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--rail);
}
.step:last-child::before { display: none; }
.mark { width: 28px; height: 28px; display: grid; place-items: center; }
.mark i { display: block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--waiting); background: var(--bg); }
.step[data-status="active"] .mark i { border-color: var(--running); background: var(--running); box-shadow: 0 0 0 4px color-mix(in srgb, var(--running) 22%, transparent); }
.step[data-status="needs-you"] .mark i { border-color: var(--needs); background: var(--needs); transform: rotate(45deg); border-radius: 2px; }
.step[data-status="blocked"] .mark i { border-color: var(--blocked); background: var(--blocked); border-radius: 2px; }

.step-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.step-title { font-size: 21px; font-weight: 650; margin: 0; }
.chip { font-size: 13px; font-weight: 600; padding: 1px 8px; border-radius: 4px; color: #fff; white-space: nowrap; }
.chip[data-status="active"] { background: var(--running); }
.chip[data-status="needs-you"] { background: var(--needs); }
.chip[data-status="blocked"] { background: var(--blocked); }
.chip[data-status="pending"] { background: transparent; color: var(--waiting); border: 1px solid var(--line); }
.owner { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.owner .avatar { width: 20px; height: 20px; font-size: 10px; }
.detail { margin: 4px 0 0; color: var(--muted); max-width: 80ch; }

.agents { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.agent { display: grid; grid-template-columns: 20px auto 1fr; gap: 2px 10px; align-items: center; }
.agent img { width: 20px; height: 20px; object-fit: contain; }
/* The OpenAI mark is stored light for dark terminals; darken it on a light page. */
@media (prefers-color-scheme: light) { .agent img[src$="/openai.png"] { filter: invert(1); } }
.agent .alt { display: inline-grid; place-items: center; width: 20px; height: 20px; font-size: 10px; font-weight: 700; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.agent-name { font-weight: 600; white-space: nowrap; }
.agent-meta { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-meta .time { color: var(--running); font-variant-numeric: tabular-nums; }
.agent-doing { grid-column: 2 / -1; font: 13px/1.4 ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workers { margin: 8px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 14px; }

.question { margin: 12px 0 0; padding: 10px 14px; border-left: 3px solid var(--needs); background: var(--question-bg); border-radius: 0 6px 6px 0; max-width: 80ch; }
.question .for { display: block; font-size: 13px; font-weight: 600; color: var(--needs); margin-bottom: 2px; }
.answered { margin: 8px 0 0; color: var(--muted); font-size: 14px; max-width: 80ch; }

.empty { color: var(--muted); }

@media (max-width: 640px) {
  .bar { padding: 10px 16px; flex-wrap: wrap; }
  main { padding: 20px 16px; }
  .board-head h1 { font-size: 24px; }
  .step-title { font-size: 18px; }
  .agent-meta { white-space: normal; grid-column: 2 / -1; }
}
