:root {
  --bg: #f4f5f2; --panel: #ffffff; --ink: #1c2321; --muted: #66706c; --line: #dfe3de;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #e2f1ee;
  --ok: #1a7f4b; --ok-soft: #e3f3ea; --warn: #9a6200; --warn-soft: #fbefd5;
  --bad: #b3261e; --bad-soft: #fbe6e4; --idle: #6b7280; --idle-soft: #eceeed;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615; --panel: #1b211f; --ink: #e7ecea; --muted: #9aa5a1; --line: #2c3532;
    --accent: #3fb8ab; --accent-ink: #06201d; --accent-soft: #17332f;
    --ok: #5fd08f; --ok-soft: #17301f; --warn: #e8b454; --warn-soft: #33290f;
    --bad: #f08a80; --bad-soft: #3a1b18; --idle: #9aa5a1; --idle-soft: #242b29;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 0; }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 24px; }
.grow { flex: 1; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.top { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: 14px; }
.operator { color: var(--muted); font-size: 12px; }
.operator input { width: 120px; margin-left: 4px; }

main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 60px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head { margin-bottom: 14px; }
.crumb { color: var(--muted); font-size: 12px; margin-bottom: 4px; }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 6px 12px; border-radius: 7px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.ghost { background: transparent; }
button.small { padding: 2px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
textarea { width: 100%; min-height: 70px; font-family: var(--mono); font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.grid { display: grid; gap: 12px; }
.facts { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 18px; }
.fact .k { color: var(--muted); font-size: 12px; }
.fact .v { font-size: 15px; font-weight: 600; margin: 2px 0; }
.fact .d { color: var(--muted); font-size: 12px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--idle-soft); color: var(--idle); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.run { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--accent-soft); }
.tablewrap { overflow-x: auto; }

/* 四段流水 */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 4px 0 16px; }
.step { position: relative; padding: 10px 12px 10px 34px; background: var(--panel); border: 1px solid var(--line); border-left-width: 0; }
.step:first-child { border-left-width: 1px; border-radius: 10px 0 0 10px; }
.step:last-child { border-radius: 0 10px 10px 0; }
.step .n { position: absolute; left: 10px; top: 11px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--idle-soft); color: var(--idle); }
.step.done .n { background: var(--ok); color: #fff; }
.step.live .n { background: var(--accent); color: var(--accent-ink); }
.step.fail .n { background: var(--bad); color: #fff; }
.step .t { font-weight: 600; }
.step .s { color: var(--muted); font-size: 12px; }
.mini { display: inline-flex; gap: 3px; vertical-align: middle; }
.mini i { width: 22px; height: 6px; border-radius: 3px; background: var(--idle-soft); }
.mini i.done { background: var(--ok); }
.mini i.live { background: var(--accent); }
.mini i.fail { background: var(--bad); }

.stage { margin-bottom: 14px; }
.stage > .row { margin-bottom: 8px; }
.stage .num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 3px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 7px; padding: 6px 10px; font-size: 12px; margin: 8px 0; }
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.flow { font-family: var(--mono); font-size: 12px; white-space: pre; overflow-x: auto; color: var(--muted); margin: 0; }
.events li { margin: 2px 0; font-size: 12px; }
.events { margin: 0; padding-left: 18px; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); padding: 0; width: min(560px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog form { padding: 18px 20px; display: grid; gap: 10px; }
dialog label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
dialog label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
dialog pre { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 10px; max-height: 60vh; overflow: auto; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; margin: 0; }
dialog.wide { width: min(900px, 94vw); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 8px; max-width: 80vw; z-index: 20; }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 820px) {
  .steps { grid-template-columns: 1fr 1fr; }
  .step { border-left-width: 1px; border-radius: 0 !important; }
  .cols { grid-template-columns: 1fr; }
  .brand small, .operator { display: none; }
}
