/* FlowHub — hand-written CSS, no build step, no CDN. */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #dfe3ee;
  --text: #1d2438;
  --muted: #6b7590;
  --primary: #3556d6;
  --primary-dark: #2a44ac;
  --ok: #16794c;
  --ok-bg: #e6f6ed;
  --err: #b3261e;
  --err-bg: #fdeceb;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --info: #23548f;
  --info-bg: #eaf2fd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 28, 55, .06), 0 8px 24px rgba(20, 28, 55, .05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code.key {
  font: 12px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: #eef1f9;
  color: #48507a;
  padding: 2px 6px;
  border-radius: 5px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 12px; top: 12px; z-index: 50;
  background: var(--surface); padding: 8px 12px; border-radius: 6px;
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar__inner {
  max-width: 1120px; margin: 0 auto;
  padding: 10px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #6c8bff);
  color: #fff; font-size: 13px; letter-spacing: .5px;
}
.topnav { display: flex; gap: 4px; margin-right: auto; }
.topnav__link {
  padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 14px;
}
.topnav__link:hover { background: #f0f3fb; text-decoration: none; }
.topnav__link.is-active { background: #eaefff; color: var(--primary-dark); font-weight: 600; }
.topbar__user { display: flex; align-items: center; gap: 10px; }
.topbar__meta { display: flex; flex-direction: column; line-height: 1.25; }
.topbar__name { font-size: 13px; font-weight: 600; }
.avatar {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: #eaefff; color: var(--primary-dark);
  font-size: 12px; font-weight: 700;
}
.inline-form { display: inline; margin: 0; }

/* ------------------------------------------------------------------ layout */
.page {
  flex: 1 0 auto;
  width: 100%; max-width: 1120px;
  margin: 0 auto; padding: 26px 20px 40px;
}
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted); font-size: 12.5px;
  padding: 12px 20px;
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
}

/* -------------------------------------------------------------------- auth */
.auth-layout .page {
  display: flex; align-items: center; justify-content: center;
  padding-top: 48px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.auth-card__head { margin-bottom: 18px; }
.auth-card__head h1 { margin: 0 0 6px; font-size: 20px; }
.auth-card__head p { margin: 0; font-size: 13.5px; }
.auth-card__foot { margin: 18px 0 0; font-size: 13.5px; color: var(--muted); text-align: center; }

/* OAuth 同意页（/oauth/authorize）的事实清单：左边标签、右边内容，窄屏换行。 */
.oauth-facts {
  margin: 0 0 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 13.5px;
}
.oauth-facts dt { color: var(--muted); }
.oauth-facts dd { margin: 0; overflow-wrap: anywhere; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 13px; font-weight: 600; color: #3a4260; }
.field__input {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14.5px; background: #fdfdff; color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field__input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(53, 86, 214, .14);
}
.field__input.is-invalid { border-color: var(--err); }
.field__hint { font-size: 12px; color: var(--muted); }
.field__error { font-size: 12.5px; color: var(--err); }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; font-size: 14px; font-weight: 600;
  font-family: inherit; text-decoration: none; line-height: 1.3;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: transparent; border-color: var(--border); color: #47506e; }
.btn--ghost:hover { background: #f2f4fb; }
.btn--danger { background: var(--err); color: #fff; }
.btn--danger:hover { background: #8f1d17; }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.btn--block { width: 100%; }

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 18px;
  overflow: hidden;
}
.card__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.card__title { margin: 0; font-size: 16.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card__desc { margin: 6px 0 0; font-size: 13.5px; }
.card__actions { display: flex; align-items: center; gap: 10px; }
.empty-card { padding: 26px; }
.empty-card h2 { margin-top: 0; }
.empty { padding: 18px; margin: 0; color: var(--muted); font-size: 14px; }
.card--danger .card__head { border-bottom-color: #f3d3d1; }
.card--danger .card__title { color: var(--err); }

/* ------------------------------------------------------------- settings forms */
.form--grid {
  padding: 16px 18px;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}
.form--grid .field--wide { grid-column: 1 / -1; }
.form--grid .field--action { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.form--inline {
  padding: 16px 18px;
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.form--inline .field { min-width: 240px; }
.form--inline .btn { margin-bottom: 1px; }
.card--danger .form--inline { border-bottom: none; }
textarea.field__input { resize: vertical; font-family: inherit; }
select.field__input { height: 38px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #3a4260; }
.checkbox input { width: 15px; height: 15px; }
.avatar--sm { width: 26px; height: 26px; font-size: 11px; }
.member { display: inline-flex; align-items: center; gap: 8px; }

/* ------------------------------------------ 成员批量勾选（加入 / 移出） */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.checkbox--bare { gap: 0; }
.table--select th.select-col, .table--select td.select-col { width: 40px; padding-right: 0; }
.member-add { border-top: 1px solid var(--border); padding: 16px 18px 4px; }
.member-add__title { margin: 0 0 10px; font-size: 14px; }
.member-filter { padding: 0 0 12px; border-bottom: 1px solid #eef1f8; }
.member-filter .field--grow { flex: 1 1 320px; }
.member-list {
  max-height: 320px; overflow-y: auto;
  padding: 6px 18px; display: flex; flex-direction: column; gap: 2px;
}
.member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  font-size: 14px;
}
.member-row:hover { background: #f5f7fd; }
.member-row[hidden] { display: none; }
.member-row input[type="checkbox"] { width: 15px; height: 15px; flex: none; }
.member-row__name { font-weight: 600; }
.member-row code.key { margin-left: auto; }
.member-list__empty { padding: 10px 8px; margin: 0; }
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px 14px; border-top: 1px solid #eef1f8;
}
.bulk-bar__actions { display: flex; align-items: center; gap: 10px; }

.stat-grid {
  display: grid; gap: 14px; margin-top: 18px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat__value { font-size: 24px; font-weight: 700; }
.stat__label { font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------------ tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 18px; text-align: left; border-bottom: 1px solid #eef1f8; }
.table th {
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: #fafbff; font-weight: 600;
}
.table th.num, .table td.num { text-align: right; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbff; }

/* -------------------------------------------------------------- modal (弹窗) */
/* Opened by the URL fragment (:target), so it also works without JavaScript;
   app.js only adds Escape / backdrop / focus behaviour on top.
   `.is-open` is the JS-only variant (sheet picker: 动态内容，没法用 :target). */
.modal { display: none; }
.modal:target,
.modal.is-open {
  display: flex; align-items: center; justify-content: center;
  position: fixed; inset: 0; z-index: 40; padding: 20px;
}
.modal__backdrop { position: absolute; inset: 0; background: rgba(17, 24, 45, .45); }
.modal__panel {
  position: relative; width: 100%; max-width: 440px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.modal__panel--wide { max-width: 640px; }
.modal__body { padding: 16px 18px; max-height: min(60vh, 520px); overflow: auto; }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.modal__title { margin: 0; font-size: 16px; }
.modal__close {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  color: var(--muted); font-size: 20px; line-height: 1;
}
.modal__close:hover { background: #f2f4fb; text-decoration: none; }
.modal__panel > .flash-stack { margin: 14px 18px 0; }
.modal .form { padding: 16px 18px; }
.modal__actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--border); background: #fafbff;
}
.modal__foot { margin: 12px 0 0; }

/* 选生效 sheet 的弹框 */
.sheet-group { margin: 0 0 16px; }
.sheet-group:last-of-type { margin-bottom: 0; }
.sheet-group__title { margin: 0 0 2px; font-size: 14px; }
.sheet-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px; margin-top: 8px;
}
.sheet-item {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px;
  background: #fdfdff; font-size: 13px; cursor: pointer;
}
.sheet-item:hover { border-color: var(--primary); background: #f7f9ff; }
.sheet-item input { margin: 0; }
.sheet-item__index {
  min-width: 20px; text-align: center; font-size: 11.5px; color: var(--muted);
}
.sheet-item__name { word-break: break-all; }
.modal__error { margin: 12px 0 0; color: var(--err); font-size: 12.5px; }

/* ------------------------------------------------- 模板：节点链路 / 编辑器 */
/* 列表页：一条模板 = 一串节点卡片，箭头表示「上一个完成后才轮到下一个」。 */
.flow {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 18px;
  margin: 0; padding: 16px 18px; list-style: none;
}
.flow__step {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 150px; max-width: 230px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: #fbfcff;
}
.flow__step:not(:last-child)::after {
  content: "→"; position: absolute; right: -16px; top: 50%;
  transform: translateY(-50%); color: var(--muted); font-size: 15px;
}
.flow__step--auto { background: #f6f7fb; }
.flow__step--unknown { border-style: dashed; }
/* 上游没完成 ⇒ 变灰、不可操作 */
.flow__step--blocked {
  opacity: .55;
  background: #f2f3f7;
  border-style: dashed;
}
.flow__step--blocked:hover { background: #f2f3f7; }
.flow__step--running { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(53, 86, 214, .12); }
.flow__step--done { background: #f4fbf7; border-color: #bfe6d1; }
.flow__actions { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.flow__actions .muted { font-size: 12px; }
.flow__form { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.flow__input {
  display: block; margin-top: 4px; padding: 4px 6px;
  background: #eef1f9; border-radius: 6px;
  font-size: 12.5px; color: #48507a; word-break: break-all;
}
.field__input--sm { padding: 5px 8px; font-size: 13px; }
.flow__file {
  font-size: 12.5px; word-break: break-all;
  padding: 3px 6px; border-radius: 6px; background: #eef1f9; color: #48507a;
}
.flow__file:hover { background: #e3e9fa; text-decoration: none; }

/* 文件拖放区（节点输入） */
.dropzone {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; margin: 0;
  border: 1px dashed var(--border); border-radius: 8px;
  background: #fdfdff; cursor: pointer;
}
.dropzone:hover { border-color: var(--primary); background: #f7f9ff; }
.dropzone.is-dragover { border-color: var(--primary); background: #eef3ff; }
.dropzone.is-filled { border-style: solid; border-color: #bfe6d1; background: #f4fbf7; }
.dropzone__input {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.dropzone:focus-within { outline: 2px solid rgba(53, 86, 214, .35); outline-offset: 1px; }
.dropzone__title { font-size: 13px; font-weight: 600; color: #3a4260; }
.dropzone__hint { font-size: 12px; color: var(--muted); word-break: break-all; }

/* 文件位一行：拖放区 + 「从SVN选择」（项目配了案子 SVN 根目录才有，docs/decisions/0031） */
.slot-row { display: flex; align-items: center; gap: 8px; }
.slot-row .dropzone { flex: 1 1 auto; }
.slot-row__svn { flex: 0 0 auto; }

/* 「从SVN选择」浏览弹框：面包屑 + 过滤框 + 文件夹 / 文件列表 */
.svn-crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 6px 8px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 8px; background: #fafbfe;
  font-size: 12.5px;
}
.svn-crumb {
  border: 0; background: none; padding: 2px 4px; border-radius: 4px;
  color: var(--primary); cursor: pointer; font-size: 12.5px;
}
.svn-crumb:hover { background: #eef1fb; text-decoration: underline; }
.svn-crumb__sep { color: var(--muted); }
.svn-filter { margin-bottom: 8px; }
.svn-filter__input {
  width: 100%; padding: 7px 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.svn-filter__input:focus {
  outline: 2px solid rgba(53, 86, 214, .35); outline-offset: 1px;
  border-color: var(--primary);
}
.svn-list { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; }
.svn-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; text-align: left; font-size: 13px;
}
.svn-row--folder {
  width: 100%; cursor: pointer; color: #3a4260;
  font: inherit; font-size: 13px;
}
.svn-row--folder:hover { border-color: var(--primary); background: #f7f9ff; }
.svn-row__arrow { color: var(--primary); flex: 0 0 auto; }
.svn-row__name { flex: 1 1 auto; word-break: break-all; }
.svn-row__meta { flex: 0 0 auto; }
.svn-row--file.is-disabled { color: var(--muted); background: #f7f8fb; }
.svn-row--file.is-disabled .svn-row__name { text-decoration: line-through; }

.flow__top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
/* 节点卡片上的「checklist 通过百分比」进度条（checklist 节点用它代替「处理详情」） */
.node-progress { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.node-progress__track {
  display: block; height: 6px; border-radius: 999px; background: #e6e9f4; overflow: hidden;
}
.node-progress__bar { display: block; height: 100%; background: var(--ok); }
.node-progress__label { font-size: 12px; color: #48507a; }
.node-progress__label.muted { color: var(--muted); }
/* 后台处理的实时进度 / 失败原因（static/js/node_status.js 会更新这里） */
.flow__status { display: block; color: var(--info); }
.flow__status.is-error { color: var(--err); word-break: break-word; }
.flow__index {
  display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: #eaefff; color: var(--primary-dark);
  font-size: 11.5px; font-weight: 700;
}
.flow__name { font-weight: 600; }
.flow__hint { display: block; }

/* 系统详情页的工作流卡片 */
.workflow-head { padding: 14px 18px 0; }
.workflow-name { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.workflow-note { margin: 0; padding: 0 18px 16px; }
.workflow-empty { padding: 16px 18px; }
.workflow-empty p { margin-top: 0; }
.workflow-empty .form--inline { padding-left: 0; padding-right: 0; border-bottom: none; }

/* 节点「处理详情」弹窗：输入文件 / 生效 sheet / 自动出的截图 / 提交记录 */
.detail__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 0; }
.detail__meta .status-chip { margin-right: 0; }
.detail__block + .detail__block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.detail__title { margin: 0 0 6px; font-size: 14px; }
.detail__block > p { margin: 0 0 8px; }
.detail__files { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.detail__file { display: flex; flex-direction: column; gap: 2px; }
.detail__shots {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
  margin-top: 10px;
}
.detail__shot {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
  position: relative;
}
.detail__shot:hover { border-color: var(--primary); text-decoration: none; }
.detail__shot img {
  display: block; width: 100%; height: 200px;
  object-fit: cover; object-position: top left;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
/* 悬停时右下角出现「查看原图」角标，提示缩略图可点击 */
.detail__shot::after {
  content: "🔍 查看原图";
  position: absolute; right: 10px; bottom: 30px;
  padding: 3px 8px; border-radius: 6px;
  background: rgba(35, 55, 110, .85); color: #fff;
  font-size: 11px; white-space: nowrap;
  opacity: 0; transition: opacity .15s ease;
  pointer-events: none;
}
.detail__shot:hover::after { opacity: 1; }
.detail__shot-name {
  font-size: 12px; color: #48507a;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail__link { margin: 10px 0 0; }

/* 图片查看器（点击缩略图同页弹出大图，企业微信内嵌浏览器也能用） */
.lightbox {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden] { display: none; }  /* display:flex 会盖掉 hidden 属性，必须显式写 */
.lightbox__backdrop {
  position: absolute; inset: 0; background: rgba(10, 14, 28, .78);
}
.lightbox__body {
  position: relative; z-index: 1;
  max-width: 96vw; max-height: 92vh;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.lightbox__body img {
  max-width: 96vw; max-height: 86vh;
  object-fit: contain; border-radius: 6px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, .5);
}
.lightbox__caption {
  color: rgba(255, 255, 255, .75); font-size: 12.5px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
.lightbox__close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .5); color: #fff;
  font-size: 20px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.lightbox__close:hover { background: rgba(0, 0, 0, .75); }

/* 代码审查：文件路径清单 + 内嵌的审核报告（审核服务器上的 HTML 静态页） */
.review-paths {
  width: 100%; min-height: 150px; resize: vertical;
  font-family: Consolas, "Courier New", monospace; font-size: 12.5px;
  line-height: 1.6; white-space: pre; overflow-wrap: normal; overflow-x: auto;
}
.review-frame {
  display: block; width: 100%; height: 520px; margin-top: 8px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
}

/* AI 建议（core/markdown.py 渲染出来的 HTML） */
.ai-advice { font-size: 13.5px; color: #2a3149; }
.ai-advice h4 { margin: 14px 0 6px; font-size: 13.5px; color: var(--primary-dark); }
.ai-advice h4:first-child { margin-top: 0; }
.ai-advice p { margin: 0 0 8px; }
.ai-advice ul, .ai-advice ol { margin: 0 0 8px; padding-left: 22px; }
.ai-advice li { margin: 2px 0; }
.ai-advice li + li { margin-top: 4px; }
.ai-advice strong { color: #1d2438; }
.ai-advice code {
  padding: 1px 5px; border-radius: 4px; background: #eef0f6;
  font-family: Consolas, "Courier New", monospace; font-size: 12.5px;
}

/* 节点状态：等待输入 / 处理中 / 已完成；测试点状态：未测试 / 已通过 / 测试未通过；
   测试点验收状态（测试验收环节）：测试未验收 / 测试验收未通过 / 测试验收通过 */
.status-chip {
  display: inline-block; padding: 2px 8px; margin-right: 4px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: #eef0f6; color: var(--muted);
}
.status-chip--waiting,
.status-chip--untested,
.status-chip--unaccepted { background: var(--warn-bg); color: var(--warn); }
.status-chip--running { background: var(--info-bg); color: var(--info); }
.status-chip--done,
.status-chip--passed,
.status-chip--accepted { background: var(--ok-bg); color: var(--ok); }
.status-chip--failed,
.status-chip--rejected { background: var(--err-bg); color: var(--err); }
/* 可测试（准备就绪）= 蓝；待更新（等案子改）= 紫 */
.status-chip--testable { background: #e3ecfb; color: #2456b3; }
.status-chip--pending_update { background: #ece3f7; color: #6d3fb5; }

/* 检查清单页：一页列全部测试点 + 逐条记结果 */
.checklist__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 18px 0;
}
.checklist__stats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.checklist__filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 12.5px; color: #47506e; background: #fff; cursor: pointer;
}
.filter-chip:hover { border-color: var(--primary); text-decoration: none; }
.filter-chip.is-active { background: #eaefff; border-color: #b9c6f5; color: var(--primary-dark); font-weight: 600; }
.checklist__progress {
  height: 6px; margin: 12px 18px 4px; border-radius: 999px; background: #eef0f6; overflow: hidden;
}
.checklist__progress-bar { display: block; height: 100%; background: var(--ok); }
/* 检查清单：一条一条列出来（测试点 + 状态 + 状态修改人），左侧箭头展开看描述 / 改状态。
   测试点**再长也不截断**：整条换行显示，行高跟着变高——这份清单是给人照着测的，
   把后半句省成省略号等于没法用。箭头 / 状态 / 修改人对齐第一行。 */
.checklist { margin: 0; padding: 4px 18px 8px; list-style: none; max-width: 1000px; }
.checkpoint { border-top: 1px solid #eef1f8; }
.checkpoint:first-child { border-top: none; }
.checkpoint__row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 6px; border-radius: 6px; cursor: pointer; list-style: none;
}
.checkpoint__row::-webkit-details-marker { display: none; }
.checkpoint__row:hover { background: #f7f9ff; }
.checkpoint__row:focus-visible { outline: 2px solid rgba(53, 86, 214, .35); outline-offset: 1px; }
.checkpoint__arrow {
  flex: 0 0 auto; margin-top: 7px; width: 0; height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .12s ease;
}
.checkpoint__details[open] > .checkpoint__row .checkpoint__arrow { transform: rotate(90deg); }
.checkpoint__index {
  flex: 0 0 auto; min-width: 24px; margin-top: 1px; padding: 1px 6px; text-align: center;
  border-radius: 999px; background: #eef0f6; color: var(--muted);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
/* 整条换行显示：不省略、不截断；overflow-wrap: anywhere 让没有空格的超长串也能断行 */
.checkpoint__text {
  flex: 1 1 auto; min-width: 0; margin: 0; font-size: 14px; line-height: 1.55;
  white-space: normal; overflow-wrap: anywhere;
}
/* API 编号：灰底小字，紧贴文本后面，调接口的人能直接看到 checkpoint_id */
.checkpoint__id {
  flex: 0 0 auto; margin-top: 1px; padding: 1px 5px;
  border-radius: 4px; background: #f4f5f8; color: var(--muted);
  font-size: 11px; font-variant-numeric: tabular-nums; user-select: all;
}
/* 行内编辑按钮：小铅笔图标，hover 才显色 */
.checkpoint__edit-btn {
  flex: 0 0 auto; margin-top: 1px; padding: 2px 5px;
  border: 0; background: none; cursor: pointer;
  font-size: 13px; opacity: .45; transition: opacity .15s ease;
}
.checkpoint__edit-btn:hover { opacity: 1; }
/* 行内编辑表单：文本 + 保存 / 取消 */
.checkpoint__edit-form {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0 2px 36px;  /* 左边对齐文本（跳过箭头 + 序号） */
}
.checkpoint__edit-form[hidden] { display: none; }
.checkpoint__edit-input { flex: 1 1 auto; }
.checkpoint--failed .checkpoint__text { font-weight: 600; }
/* 分类列：行内下拉 + 新增输入框 */
.checkpoint__category {
  flex: 0 0 auto; margin-top: 1px; display: inline-flex; align-items: center; gap: 4px;
}
.checkpoint__category-select, .checkpoint__category-input {
  font-size: 12px; padding: 2px 6px;
  border: 1px solid var(--border); border-radius: 5px;
  background: #fff; color: var(--muted); max-width: 140px;
}
.checkpoint__category-select:focus, .checkpoint__category-input:focus {
  outline: none; border-color: var(--primary);
}
.checkpoint__category-input { color: var(--ink); width: 130px; }
.checkpoint__category-new { color: var(--primary); font-weight: 600; }
.checkpoint__category-label { font-size: 12px; color: var(--muted); }
/* 表头分类过滤下拉 */
.checklist__category-filter {
  font-size: 12.5px; padding: 3px 8px;
  border: 1px solid var(--border); border-radius: 999px;
  background: #fff; color: var(--ink); cursor: pointer;
}
.checklist__category-filter:focus { outline: none; border-color: var(--primary); }
/* 批量勾选框 + 工具条 */
.checkpoint__batch-check {
  flex: 0 0 auto; margin-top: 3px; width: 15px; height: 15px; cursor: pointer;
}
.checklist__batch {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin: 10px 0; padding: 8px 14px;
  border: 1px solid var(--primary); border-radius: 10px;
  background: #f0f3fb;
}
.checklist__batch[hidden] { display: none; }
.checklist__batch-count { font-size: 13px; font-weight: 600; color: var(--primary); }
.checklist__batch-select {
  font-size: 12.5px; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--ink); cursor: pointer;
}
.checklist__batch-select:focus { outline: none; border-color: var(--primary); }
/* 处理人 label + 选人弹窗 */
.checkpoint__assignee { flex: 0 0 auto; margin-top: 1px; display: inline-flex; }
.checkpoint__assignee-label {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px;
  background: #fff; cursor: pointer;
  font-size: 12px; color: var(--muted); max-width: 200px;
}
.checkpoint__assignee-label:hover { border-color: var(--primary); }
.checkpoint__assignee-label span:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.checkpoint__assignee-edit { font-size: 11px; opacity: .5; }
.checkpoint__assignee-label:hover .checkpoint__assignee-edit { opacity: 1; }
.checkpoint__assignee-text { font-size: 12px; color: var(--muted); }
.assignee-picker {
  position: fixed; z-index: 950;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(20, 30, 60, .18);
  min-width: 280px; max-width: 340px;
}
.assignee-picker[hidden] { display: none; }
.assignee-picker__inner { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.assignee-picker__filter { font-size: 13px; }
.assignee-picker__list {
  max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.assignee-picker__item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
  font-size: 13px; border: 0; background: none; text-align: left; width: 100%;
}
.assignee-picker__item:hover { background: #f0f3fb; }
.assignee-picker__item.is-selected {
  background: #e3e9fb; color: var(--primary); font-weight: 600;
}
.assignee-picker__item-name { flex: 1 1 auto; }
.assignee-picker__item-sub { font-size: 11px; color: var(--muted); }
.assignee-picker__foot { display: flex; justify-content: flex-end; gap: 6px; }
/* 处理人筛选弹窗（表头那个）：复用 assignee-picker 的列表样式 */
.checklist__assignee-filter-btn { cursor: pointer; }
.assignee-filter {
  position: fixed; z-index: 950;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(20, 30, 60, .18);
  min-width: 260px; max-width: 320px;
}
.assignee-filter[hidden] { display: none; }
.assignee-filter .assignee-picker__item.is-active {
  background: #e3e9fb; color: var(--primary); font-weight: 600;
}
/* 系统页的开发人员区块 */
.system-developers {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 20px 0; font-size: 13px;
}
.system-developers__label { flex: 0 0 auto; }
.system-developers__names {
  color: var(--ink); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.checkpoint--rejected .checkpoint__text { font-weight: 600; }
.checkpoint__row > .status-chip { flex: 0 0 auto; margin-top: 1px; }
.checkpoint__by {
  flex: 0 0 auto; max-width: 140px; margin-top: 1px; padding-left: 4px;
  font-size: 12px; color: var(--muted); overflow-wrap: anywhere;
}
.checkpoint__body { padding: 2px 6px 12px 34px; }
.checkpoint__meta { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 0; }
/* 展开区里先给表单（改状态 + 写这次的描述），下面才是**全部历史记录**。
   描述 = 所有历史：`white-space: pre-line` 让追加的每一段独占一行，
   整段完整显示——不截断、不折叠、不设 max-height / overflow，条目多就把这一块撑高
   （单个 checkpoint 拉很高是有意的）。 */
.checkpoint__history { margin: 12px 0 0; }
.checkpoint__history-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.checkpoint__history-body {
  margin: 0; padding: 8px 12px; border-left: 3px solid var(--border);
  background: #f7f8fc; color: #3a4260; border-radius: 0 6px 6px 0;
  font-size: 13px; line-height: 1.6;
  white-space: pre-line; overflow-wrap: anywhere; word-break: break-word;
}
.checkpoint--passed .checkpoint__history-body { border-left-color: var(--ok); background: var(--ok-bg); color: #145c3b; }
.checkpoint--failed .checkpoint__history-body { border-left-color: var(--err); background: var(--err-bg); color: #7d2b25; }
.checkpoint--accepted .checkpoint__history-body { border-left-color: var(--ok); background: var(--ok-bg); color: #145c3b; }
.checkpoint--rejected .checkpoint__history-body { border-left-color: var(--err); background: var(--err-bg); color: #7d2b25; }
/* 还没有任何描述时的占位（虚线框，跟有内容时的历史块区分开） */
.checkpoint__history--empty {
  margin: 0; padding: 6px 10px; border-left: 3px dashed var(--border);
  background: #fbfbfe; border-radius: 0 6px 6px 0;
}
.checkpoint__form {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0;
}
.checkpoint__choices { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.choice { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #3a4260; }
.choice input { margin: 0; }
.checkpoint__note-input { flex: 1 1 260px; min-width: 200px; resize: vertical; font-family: inherit; font-size: 13px; }
.checklist__note { margin: 0; padding: 0 18px 16px; }

/* 编辑页：左边节点面板，右边模板序列 */
.editor { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 18px; align-items: start; margin-top: 18px; }.editor .card { margin-top: 0; }
.palette {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0; padding: 12px; list-style: none;
  max-height: 560px; overflow: auto;
}
.palette__item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  background: #fdfdff; cursor: grab;
}
.palette__item:active { cursor: grabbing; }
.palette__add {
  flex: 0 0 auto; padding: 3px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; font-size: 12.5px; font-weight: 600; color: var(--primary-dark);
}
.palette__add:hover { background: #f2f4fb; text-decoration: none; }
.palette__body { display: flex; flex-direction: column; gap: 3px; }
.palette__body p { margin: 0; }
.palette__head { display: flex; align-items: center; gap: 6px; }
.palette__name { font-weight: 600; font-size: 14px; }

.steps {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0; padding: 12px; list-style: none; min-height: 76px;
}
.steps.is-dragover { background: #f5f8ff; box-shadow: inset 0 0 0 1px var(--primary); }
.step {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  cursor: grab;
}
.step:active { cursor: grabbing; }
.step.is-drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.step__handle { color: var(--muted); letter-spacing: -2px; }
.step__index {
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #eaefff; color: var(--primary-dark);
  font-size: 12px; font-weight: 700;
}
.step__body { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; flex-wrap: wrap; }
.step__name { font-weight: 600; }
.step__actions { display: flex; gap: 4px; }
.step__action {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border: 1px solid var(--border); border-radius: 6px;
  color: #47506e; font-size: 13px; line-height: 1;
}
.step__action:hover { background: #f2f4fb; text-decoration: none; }
.step__action--danger { color: var(--err); }
.editor__actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-top: 1px solid var(--border);
}
@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
}
.badge--role { background: #eaefff; color: var(--primary-dark); }
.badge--muted { background: #eef0f6; color: var(--muted); }
.badge--ok { background: var(--ok-bg); color: var(--ok); }

/* ------------------------------------------------------------------- flash */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
  padding: 10px 14px; border-radius: 8px; font-size: 13.5px;
  border: 1px solid transparent;
}
.flash--success { background: var(--ok-bg); color: var(--ok); border-color: #bfe6d1; }
.flash--error { background: var(--err-bg); color: var(--err); border-color: #f5c9c6; }
.flash--warning { background: var(--warn-bg); color: var(--warn); border-color: #f0dcb4; }
.flash--info { background: var(--info-bg); color: var(--info); border-color: #c7ddf8; }

/* -------------------------------------------------------------- breadcrumb */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb__sep { margin: 0 6px; }
.breadcrumb__current { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------- error page */
.error-page { text-align: center; padding: 60px 0; }
.error-page__code { font-size: 56px; margin: 0; color: var(--primary); }
.error-page__message { color: var(--muted); margin: 10px 0 24px; }

@media (max-width: 640px) {
  .topbar__meta { display: none; }
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
