:root {
  --bg: #f5f7fa; --panel: #ffffff; --text: #1f2328; --muted: #5f6b7a; --border: #d8dee6;
  --navy: #2c5282; --accent: #1a4d8f; --danger: #b42318;
  --testing-bg: #d4e8f7; --testing-fg: #1a5276;
  --review-bg: #fff1c2; --review-fg: #7a5c00;
  --progress-bg: #dde7f7; --progress-fg: #2c5282;
  --human-bg: #fde8d0; --human-fg: #7a4a1a;
  --blocked-bg: #ffd9dd; --blocked-fg: #8b1a1a;
  --idle-bg: #eef0f3; --idle-fg: #6b7280;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 4px 0 14px; line-height: 1.25; }
h2 { font-size: 17px; margin: 0 0 10px; }

.top { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
.top a, .top .link { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 17px; }
.top nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 14px; }

main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 48px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 0 0 14px; }
.narrow { max-width: 440px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.step-card { display: block; color: inherit; text-decoration: none; margin: 0; transition: border-color .15s, box-shadow .15s; }
.step-card:hover { border-color: var(--navy); box-shadow: 0 2px 10px rgba(44, 82, 130, .12); }
.step-card h2 { margin: 8px 0 6px; }
.step-id { font-weight: 700; color: var(--navy); }

.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.meta { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.next { font-size: 14px; margin: 6px 0; }
.internal-note { color: var(--muted); font-size: 13px; }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.flash { background: #fff4e5; border: 1px solid #f5c26b; border-radius: 6px; padding: 8px 12px; }
.note { background: #f6f8fa; border-left: 3px solid var(--navy); padding: 8px 12px; margin: 10px 0 0; font-size: 14px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.testing { background: var(--testing-bg); color: var(--testing-fg); }
.badge.review { background: var(--review-bg); color: var(--review-fg); }
.badge.progress { background: var(--progress-bg); color: var(--progress-fg); }
.badge.human { background: var(--human-bg); color: var(--human-fg); }
.badge.blocked { background: var(--blocked-bg); color: var(--blocked-fg); }
.badge.idle { background: var(--idle-bg); color: var(--idle-fg); }

.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.items li:first-child { border-top: 0; }
.num { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 13px; align-items: center; justify-content: center; margin-right: 6px; vertical-align: 2px; }
.runs-table td { vertical-align: middle; }
.runs-table th:last-child, .runs-table td:last-child { text-align: center; width: 40px; }
.nowrap { white-space: nowrap; }
.runs, .files { list-style: none; margin: 0; padding: 0; }
.runs li, .files li { padding: 8px 0; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.runs li:first-child, .files li:first-child { border-top: 0; }
.runs a, .files a { font-weight: 600; word-break: break-word; }
details summary { cursor: pointer; color: var(--accent); font-size: 14px; padding: 6px 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.tabs a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; text-decoration: none; }
.tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
iframe.report { width: 100%; height: 75vh; min-height: 420px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

.comment { border-top: 1px solid var(--border); padding: 10px 0; }
.comment:first-of-type { border-top: 0; }
.comment .body { white-space: pre-wrap; margin: 4px 0; word-break: break-word; }

label { display: block; font-size: 14px; margin: 0 0 12px; }
input:not([type=checkbox]), textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
input:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: 0; }
button, .button { font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
button.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }
.top button.link { color: #fff; }
.comment button.link { color: var(--muted); font-size: 12px; }
form.inline { display: inline; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 16px; margin: 6px 0 14px; }
.check { display: flex; gap: 8px; align-items: baseline; margin: 0; padding: 4px 0; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; background: var(--navy); color: #fff; padding: 8px 10px; font-weight: 600; }
td { border-top: 1px solid var(--border); padding: 8px 10px; vertical-align: top; }
tr.inactive td { color: var(--muted); }
.scroll-x { overflow-x: auto; }

@media (max-width: 600px) {
  h1 { font-size: 19px; }
  .facts { grid-template-columns: 1fr; }
  .facts dt { margin-top: 6px; }
  iframe.report { height: 70vh; }
}
.runs-table .results { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; }
.runs-table tr.draft td { opacity: .6; }
details.all-runs { margin-top: 12px; }
details.all-runs > summary { cursor: pointer; font-weight: 600; color: var(--navy, #2c5282); padding: 6px 0; }

/* "How the bot works" guide card */
.guide .markdown h3 { font-size: 15px; margin: 16px 0 6px; }
.guide .markdown p, .guide .markdown li { font-size: 14px; line-height: 1.55; }
.guide .markdown ul, .guide .markdown ol { padding-left: 20px; margin: 4px 0 8px; }
.guide .markdown table { margin: 6px 0 10px; }
.guide .markdown th, .guide .markdown td { border: 1px solid var(--border, #ddd); padding: 6px 8px; text-align: left; vertical-align: top; }
.guide .markdown blockquote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid #2c5282; background: #f4f7fb; }
.guide details:not(.panel) { margin-top: 12px; }
.guide details summary { cursor: pointer; font-weight: 600; }
/* page sections as an accordion */
details.panel > summary { list-style: none; cursor: pointer; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary h2 { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
details.panel > summary h2::before { content: ""; display: inline-block; width: 0; height: 0; border-style: solid;
  border-width: 5px 0 5px 8px; border-color: transparent transparent transparent var(--navy, #2c5282); transition: transform .15s; }
details.panel[open] > summary h2::before { transform: rotate(90deg); }
details.panel[open] > summary { margin-bottom: 10px; }
/* Questions for ABS */
.questions .count { font-size: 12px; font-weight: 600; background: #fdf3d8; color: #7a5c00; border-radius: 10px; padding: 2px 8px; }
.questions .question { border: 1px solid #e2e8f0; border-radius: 6px; padding: 10px 12px; margin: 8px 0; background: #fff; }
.questions .qid { display: inline-block; font-weight: 700; color: #fff; background: #2c5282; border-radius: 4px; padding: 0 6px; font-size: 12px; }
.questions .finding { color: #4a5568; font-size: 13px; margin: 6px 0; }
.questions .ask { font-weight: 600; margin: 6px 0; }
.questions .answer { font-size: 13px; background: #eef7ee; padding: 6px 8px; border-radius: 4px; }
.questions details > summary { cursor: pointer; font-size: 13px; color: #2c5282; }
.questions textarea { width: 100%; margin: 6px 0; }
.questions details.decided { margin-top: 10px; }
