:root {
  --pico-font-size: 15px;
  --ok: #1f7a4d;
  --ok-bg: #e3f4ea;
  --warn: #8a5a00;
  --warn-bg: #fdf1d8;
  --bad: #a3262a;
  --bad-bg: #fbe4e4;
  --run: #1d5fb0;
  --run-bg: #e3edfb;
  --idle: #5b6270;
  --idle-bg: #eceef2;
}
.topbar nav { padding-block: 0.25rem; }
.brand { font-weight: 600; text-decoration: none; }
.muted { color: var(--pico-muted-color); }
.small, button.small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
form.inline { display: inline-block; margin: 0; }
form.inline button { margin: 0; }
.right { float: right; font-size: 0.85rem; }
.flash { padding: 0.6rem 0.9rem; border-radius: 6px; background: var(--run-bg); color: var(--run); }
.error { color: var(--bad); }
.login { max-width: 420px; margin: 3rem auto; }

.start .row { display: flex; gap: 0.5rem; margin-bottom: 0.25rem; }
.start .row input { flex: 1; margin: 0; }
.start .row button { margin: 0; width: auto; }
.start { margin-bottom: 1.5rem; }

.runs td { vertical-align: top; }
.runs .title { font-size: 0.85rem; color: var(--pico-muted-color); max-width: 42ch; }

.badge { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; vertical-align: middle; white-space: nowrap; }
.s-queued { background: var(--idle-bg); color: var(--idle); }
.s-running { background: var(--run-bg); color: var(--run); }
.s-waiting_human { background: var(--warn-bg); color: var(--warn); }
.s-succeeded { background: var(--ok-bg); color: var(--ok); }
.s-failed { background: var(--bad-bg); color: var(--bad); }

.status-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.status-head h2 { margin-bottom: 0.2rem; }
.title-lg { font-size: 1.05rem; margin-bottom: 0.5rem; }
.facts { display: flex; gap: 1.25rem; margin: 0; }
.facts dt { font-size: 0.72rem; color: var(--pico-muted-color); text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 0; }

.phases { display: flex; list-style: none; padding: 0; margin: 1rem 0; gap: 0.25rem; flex-wrap: wrap; }
.phases li { list-style: none; flex: 1; min-width: 90px; text-align: center; padding: 0.35rem 0.25rem; font-size: 0.8rem; border-radius: 4px; background: var(--idle-bg); color: var(--idle); }
.phases li.done { background: var(--ok-bg); color: var(--ok); }
.phases li.now { font-weight: 700; background: var(--run-bg); color: var(--run); }
.phases li.now.waiting_human { background: var(--warn-bg); color: var(--warn); }
.phases li.now.failed { background: var(--bad-bg); color: var(--bad); }
.reason { padding: 0.6rem 0.9rem; border-radius: 6px; }
.reason.waiting_human { background: var(--warn-bg); }
.reason.failed { background: var(--bad-bg); }
.reason.setup { background: var(--run-bg); color: var(--run); }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 1rem 0 2rem; }
.actions > a[role="button"], .actions button, .actions .danger-menu > summary {
  margin: 0; padding: 0 0.9rem; height: 2.4rem; line-height: 2.4rem; font-size: 0.9rem; display: inline-flex; align-items: center; white-space: nowrap; box-sizing: border-box; }
button.danger { background: var(--bad); border-color: var(--bad); }

section { margin-bottom: 2.25rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head h2 { margin: 0; }

.waiting { border-left: 4px solid var(--warn); background: var(--warn-bg); }
.qa { border: 1px solid var(--pico-muted-border-color); border-radius: 6px; padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; }
.qa summary { font-size: 0.92rem; }
.answer-chip { margin-left: 0.5rem; font-size: 0.8rem; color: var(--ok); }
.answer { border-left: 3px solid var(--ok); padding-left: 0.75rem; margin-top: 0.75rem; }
.msg-body { font-size: 0.9rem; line-height: 1.5; }
.msg-body pre { font-size: 0.8rem; }
.mention { color: var(--run); font-weight: 600; }

.thread { display: flex; flex-direction: column; gap: 0.5rem; max-height: 560px; overflow-y: auto; padding-right: 0.25rem; }
.msg { border-radius: 6px; padding: 0.5rem 0.75rem; background: var(--idle-bg); }
.msg.human { background: var(--ok-bg); }
.msg .meta { font-size: 0.8rem; margin-bottom: 0.2rem; }

.pr-item { padding: 0.75rem 1rem; margin-bottom: 0.75rem; }
.pr-item header { padding-bottom: 0.4rem; margin-bottom: 0.4rem; }
.md { font-size: 0.9rem; }
.md pre, pre { font-size: 0.8rem; max-height: 520px; overflow: auto; }
details > summary code { font-size: 0.85rem; }

.timeline { list-style: none; padding: 0; font-size: 0.85rem; max-height: 420px; overflow-y: auto; }
.timeline li { list-style: none; padding: 0.2rem 0; border-bottom: 1px solid var(--pico-muted-border-color); }

.branch-line { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.commits { font-size: 0.88rem; }
.commits td { padding: 0.3rem 0.5rem; vertical-align: top; }

.problem { border: 1px solid var(--bad); background: var(--bad-bg); padding: 0.6rem 0.9rem; border-radius: 8px; margin-bottom: 0.75rem; }
.problem-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.problem-line { color: var(--bad); font-size: 0.9rem; margin: 0.25rem 0; }
.problem-more summary { font-size: 0.8rem; color: var(--pico-muted-color); }
.problem-more .kv { margin-top: 0.4rem; }
.problem-more pre, .act pre { font-size: 0.78rem; max-height: 280px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0.25rem 0; }

.activity-box { border: 1px solid var(--pico-muted-border-color); border-radius: 8px; padding: 0.5rem 0.9rem; }
.activity-box > summary { display: flex; gap: 0.6rem; align-items: baseline; }
.act-list { max-height: 520px; overflow-y: auto; margin-top: 0.5rem; }
.act { border-bottom: 1px solid var(--pico-muted-border-color); padding: 0; margin: 0; }
.act > summary { display: flex; gap: 0.5rem; align-items: center; padding: 0.3rem 0.2rem; font-size: 0.84rem; list-style: none; cursor: pointer; }
.act > summary::-webkit-details-marker { display: none; }
.act > summary::after { display: none !important; }
.act[data-flat] > summary { cursor: default; }
.act .t { color: var(--pico-muted-color); font-variant-numeric: tabular-nums; flex: 0 0 4.2rem; }
.act .dot { flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.act.err .dot { background: var(--bad); }
.act.err > summary { background: var(--bad-bg); }
.act .tool { font-size: 0.75rem; color: var(--pico-muted-color); flex: 0 0 auto; }
.act .line { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act .line.mono { font-family: var(--pico-font-family-monospace); font-size: 0.78rem; }
.act .line.say { color: var(--pico-muted-color); font-style: italic; }
.act .err-text { color: var(--bad); }
.agent { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 0 0.4rem; border-radius: 4px; background: var(--idle-bg); color: var(--idle); white-space: nowrap; }

.waiting-q summary { font-weight: 600; font-size: 0.9rem; }
.waiting > header { margin-bottom: 0.4rem; }

.danger-menu { display: inline-block; position: relative; margin: 0; padding: 0; border: none; }
.danger-menu > summary { list-style: none; cursor: pointer; }
.danger-menu > summary::-webkit-details-marker { display: none; }
.danger-menu > summary::after { display: none !important; content: none !important; }
.danger-box { position: absolute; right: 0; top: 2.6rem; z-index: 5; min-width: 320px; display: flex; flex-direction: column; gap: 0.5rem; background: var(--pico-background-color); border: 1px solid var(--bad); border-radius: 8px; padding: 0.75rem; }
.danger-box form { margin: 0; }
.danger-box button { width: 100%; margin: 0; }

/* Connections: the who-can-start setting, and the .env fallback note. */
.fallback { font-size: 0.85rem; margin: 0 0 1.5rem; }
.setting-card { display: grid; gap: 0.75rem; border: 1px solid var(--pico-muted-border-color); border-radius: 8px; padding: 1rem 1.1rem; margin: 0.25rem 0 1.5rem; }
.setting-card > div > small { display: block; margin-top: 0.15rem; }
.setting-card code { font-size: 0.8rem; padding: 0.05rem 0.3rem; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
@media (max-width: 640px) { .choices { grid-template-columns: 1fr; } }
.choice { display: flex; gap: 0.65rem; align-items: flex-start; margin: 0; padding: 0.7rem 0.85rem; border: 1px solid var(--pico-muted-border-color); border-radius: 6px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--pico-primary); box-shadow: 0 0 0 1px var(--pico-primary); }
.choice input[type="radio"] { margin: 0.2rem 0 0; flex: none; }
.choice small { display: block; margin-top: 0.15rem; color: var(--pico-muted-color); font-size: 0.8rem; line-height: 1.35; }
.setting-card button { justify-self: start; margin: 0; width: auto; }
.row-actions { white-space: nowrap; text-align: right; vertical-align: top; }
.row-actions > form, .row-actions > .danger-menu { display: inline-block; margin: 0 0 0 0.25rem; vertical-align: top; }
.row-actions button, .row-actions summary[role="button"] { margin: 0; width: auto; padding: 0.25rem 0.6rem; font-size: 0.8rem; line-height: 1.4; }
.edit-box { border-color: var(--pico-muted-border-color); min-width: 360px; text-align: left; white-space: normal; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08); }
.edit-box label { font-size: 0.85rem; }
.edit-box input, .edit-box select { margin-bottom: 0.5rem; }
.resume-form { display: grid; gap: 0.6rem; margin: 0; }
.resume-form textarea { margin: 0; }
.resume-form button { justify-self: start; margin: 0; width: auto; }
.list-head { display: flex; justify-content: flex-end; margin: 0.5rem 0 0.25rem; }
.segmented { display: inline-flex; width: auto; margin: 0; border: 1px solid var(--pico-muted-border-color); border-radius: 6px; overflow: hidden; box-shadow: none; }
.segmented a { display: block; padding: 0.3rem 0.8rem; font-size: 0.82rem; text-decoration: none; color: var(--pico-muted-color); }
.segmented a + a { border-left: 1px solid var(--pico-muted-border-color); }
.segmented a.on { background: var(--pico-primary); color: var(--pico-primary-inverse); }
.note { font-size: 0.82rem; margin: 0; padding: 0.45rem 0.7rem; border-radius: 6px; background: var(--idle-bg); }
.note.warn { background: var(--warn-bg); color: var(--warn); }

/* Smoke test form on the dashboard. */
.smoke { margin: -0.75rem 0 1.5rem; }
.smoke summary { font-size: 0.9rem; color: var(--pico-muted-color); }
.smoke .row { display: flex; gap: 0.5rem; margin: 0.5rem 0 0.25rem; }
.smoke .row select { flex: 1; margin: 0; }
.smoke .row button { margin: 0; width: auto; }

/* The run's browser screenshots. */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.shots figure { margin: 0; }
.shots img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); display: block; }
.shots figcaption { margin-top: 0.25rem; font-size: 0.8rem; overflow-wrap: anywhere; }

/* A ticket's preview card on its run page. */
.preview-card { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.preview-card > div:first-child { flex: 1 1 20rem; }
.preview-card .row-actions a[role="button"] { margin: 0 0 0 0.25rem; width: auto; padding: 0.25rem 0.6rem; font-size: 0.8rem; }
