:root {
  --bg: #f4f5f3;
  --panel: #ffffff;
  --line: #e3e5e1;
  --soft: #f8f9f7;
  --text: #1d2420;
  --muted: #6b726d;
  --accent: #2f6f62;
  --accent-soft: #e4efec;
  --warn: #9a5b12;
  --warn-soft: #fbf0df;
  --danger: #b4372f;
  --danger-soft: #f8e6e4;
  --radius: 12px;
  --gap: 20px;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; line-height: 1.35; }
h2 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.small { font-size: 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  height: 52px; padding: 0 24px; background: #1f2925; color: #fff;
}
.top .brand { font-weight: 600; letter-spacing: .5px; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: #c9d3ce; padding: 6px 12px; border-radius: 6px; }
.top nav a.on, .top nav a:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
.top form { margin: 0; }
main { max-width: 1240px; margin: 0 auto; padding: 28px 28px 64px; }

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c8ccc6; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #285f54; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
button.link { background: none; border: 0; color: #c9d3ce; font: inherit; cursor: pointer; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.pad { padding: 20px 24px; }
.flash { padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: 18px; }
.errors { padding: 12px 16px 12px 34px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); margin: 0 0 18px; }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.help { font-size: 12px; color: var(--muted); }
.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
[hidden] { display: none !important; }

/* 旧徽标，精细生成页面在用 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: #eceeea; color: var(--muted); }
.badge.live, .badge.done { background: var(--accent-soft); color: var(--accent); }
.badge.draft, .badge.running { background: var(--warn-soft); color: var(--warn); }
.badge.disabled, .badge.failed, .badge.interrupted { background: var(--danger-soft); color: var(--danger); }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: 11px; background: var(--warn-soft); color: var(--warn); }
.ai-tag { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; font-size: 11px; line-height: 17px; border: 1px solid #9aa39d; color: #6b726d; }

.avatar { flex: none; border-radius: 8px; object-fit: cover; background: #dfe3df; display: inline-flex;
  align-items: center; justify-content: center; color: #fff; font-weight: 600; overflow: hidden; }

/* 表单控件 */
input, select, textarea {
  font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px 10px;
}
input[type=text], input[type=search], input[type=number], input[type=date], input[type=password], select { height: 36px; }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
textarea { line-height: 1.6; }

/* 页头、筛选、表格 */
.head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.head .grow { flex: 1; min-width: 0; }
.head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head .sub { margin-top: 4px; color: var(--muted); font-size: 13px; }
.head-ops { display: flex; gap: 8px; flex-wrap: wrap; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.bar .grow { flex: 1; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); border: 1px solid transparent; }
.tabs a.on { background: var(--panel); color: var(--text); border-color: var(--line); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a .n { margin-left: 2px; color: var(--muted); font-size: 12px; }
.search { display: flex; gap: 8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf9; }
.who { display: flex; align-items: center; gap: 12px; color: inherit; }
.who:hover { text-decoration: none; }
.who:hover .n { color: var(--accent); }
.bulk { position: sticky; top: 64px; z-index: 5; display: none; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 16px; margin-bottom: 12px; border-radius: 12px; background: #1f2925; color: #fff;
  box-shadow: 0 8px 24px rgba(20, 30, 25, .18); }
.bulk.show { display: flex; }
.bulk .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.bulk .btn:hover { border-color: rgba(255,255,255,.6); }
.bulk .btn.danger { color: #ffb4ad; }
.bulk .sep { width: 1px; height: 18px; background: rgba(255,255,255,.2); margin: 0 4px; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #cfd4cf; transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

/* 通用卡片：页头、统计、行、标签 */
.pp-head { padding: 24px; margin-bottom: var(--gap); }
.pp-head .avatar { border-radius: 12px; }
.pp-head h1 { font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pp-head .sub { margin-top: 6px; color: var(--muted); font-size: 13px; display: flex; gap: 6px 14px; flex-wrap: wrap; }
.pp-head-top { display: flex; align-items: center; gap: 20px; }
.pp-head-main { flex: 1; min-width: 0; }
.pp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line);
  border-top: 1px solid var(--line); margin: 22px -24px -24px; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.pp-stats div { background: var(--panel); padding: 14px 24px; }
.pp-stats b { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pp-stats b.t { font-size: 14px; line-height: 30px; font-weight: 500; }
.pp-stats span { font-size: 12px; color: var(--muted); }
.pp-card { padding: 0 0 6px; margin-bottom: var(--gap); }
.pp-card > h2 { display: flex; align-items: baseline; gap: 8px; padding: 18px 24px 10px; margin: 0; font-size: 15px; }
.pp-card > h2 small { font-weight: 400; color: var(--muted); font-size: 12px; }
.pp-card > h2 .grow { flex: 1; }
.pp-card > p.intro { margin: -4px 24px 12px; font-size: 13px; color: var(--muted); }
.pp-row { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-top: 1px solid var(--line);
  color: inherit; text-decoration: none; }
a.pp-row:hover { background: #fafbf9; text-decoration: none; }
.pp-row .main { flex: 1; min-width: 0; }
.pp-row .main .t { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.pp-row .main .d { margin-top: 3px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-row .meta { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; line-height: 1.6; }
.pp-empty { padding: 18px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pp-chip { white-space: nowrap; display: inline-block; padding: 0 7px; border-radius: 5px; font-size: 12px; line-height: 20px;
  font-weight: 400; background: var(--accent-soft); color: var(--accent); }
.pp-chip.gray, .pp-chip.s-archived { background: #eceeea; color: var(--muted); }
.pp-chip.warn, .pp-chip.s-draft, .pp-chip.s-running { background: var(--warn-soft); color: var(--warn); }
.pp-chip.bad, .pp-chip.s-disabled, .pp-chip.s-failed, .pp-chip.s-interrupted { background: var(--danger-soft); color: var(--danger); }
.pp-chip.line { background: transparent; border: 1px solid #b9c0bb; color: var(--muted); line-height: 18px; padding: 0 5px; }
.pp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c9cec9; flex: none; }
.pp-dot.on { background: #2fa36b; box-shadow: 0 0 0 3px rgba(47, 163, 107, .15); }
.pp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--gap); align-items: start; }
.pp-grid > * { min-width: 0; }
.pp-friends { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 6px 24px 18px; }
.pp-friend { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  color: inherit; text-decoration: none; min-width: 0; background: var(--panel); }
a.pp-friend:hover { border-color: var(--accent); text-decoration: none; }
.pp-friend > div { min-width: 0; }
.pp-friend .n { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.pp-friend .a { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-form { display: grid; gap: 14px; padding: 6px 24px 22px; }
.pp-form label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.pp-form input[type=text], .pp-form select { width: 100%; font-size: 14px; color: var(--text); }
.pp-form .check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.pp-actions { display: grid; gap: 12px; padding: 6px 24px 22px; }
.pp-actions form { display: flex; gap: 8px; margin: 0; }
.pp-actions form > .btn { flex: 1; }
.pp-actions form > input[type=text] + .btn { flex: none; }
.pp-actions input[type=text] { flex: 1; }
.pp-actions .btn { justify-content: center; }
.pp-actions .hint { font-size: 12px; color: var(--muted); margin-top: -6px; line-height: 1.6; }
.pp-actions .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pp-log { max-height: 360px; overflow: auto; }
.pp-foot { margin: 18px -24px -24px; background: var(--soft); border-radius: 0 0 var(--radius) var(--radius); }
.pp-secret { margin-bottom: var(--gap); padding: 16px 20px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); line-height: 1.8; }
.pp-secret code { font-size: 22px; letter-spacing: 3px; color: var(--text); background: #fff; padding: 2px 12px; border-radius: 6px; }
.pp-table td { padding: 14px 16px; }
.pp-table th { padding: 12px 16px; }
.pp-table .who .avatar { border-radius: 8px; }
.pp-table .who .n { font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pp-table .who .s { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.pp-table .who .s.m-only, .xs-inline { display: none !important; }
.pp-table .num { font-variant-numeric: tabular-nums; }
.pp-table .check { width: 44px; padding-right: 0; }
.pp-thread { max-width: 760px; margin: 0 auto; padding: 20px 24px 28px; background: #ededed; border-radius: var(--radius); }
.m-only { display: none; }

/* AI 详情：表单分组 */
.ai-form { display: grid; gap: var(--gap); margin: 0; }
.ai-form .pp-card { margin: 0; padding-bottom: 8px; scroll-margin-top: 110px; }
html { scroll-behavior: smooth; }
.jump { position: sticky; top: 52px; z-index: 4; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 0; margin: -10px 0 0; background: var(--bg); }
.jump::-webkit-scrollbar { display: none; }
.jump a { flex: none; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-size: 13px; }
.jump a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.field { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 12px 24px; }
.field + .field { border-top: 1px dashed var(--line); }
.field > label { padding-top: 7px; color: var(--muted); font-size: 13px; }
.field .control { display: grid; gap: 6px; min-width: 0; }
.field .row { display: flex; gap: 8px; align-items: flex-start; }
.field .row > :first-child { flex: 1; min-width: 0; }
.field input[type=text], .field input[type=number], .field input[type=date], .field textarea, .field select { width: 100%; }
.field textarea { min-height: 72px; resize: vertical; }
.field textarea.tall { min-height: 180px; }
.regen { flex: none; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.regen:hover { border-color: var(--accent); }
.regen.busy { color: var(--muted); cursor: progress; }
.changed { border-color: var(--warn) !important; background: #fffaf2 !important; }
.avatar-edit { display: flex; gap: 16px; align-items: center; }
.avatar-edit .avatar { border-radius: 12px; }
.avatar-edit .ops { display: flex; flex-wrap: wrap; gap: 8px; }
.bottle { display: flex; gap: 8px; margin-bottom: 8px; }
.bottle textarea { flex: 1; min-height: 70px; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-top: 1px solid var(--line); background: rgba(255,255,255,.96); border-radius: 0 0 var(--radius) var(--radius); }
.savebar .dirty { color: var(--warn); display: none; }
.savebar.on .dirty { display: inline; }
.savebar.float { bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px;
  box-shadow: 0 10px 30px rgba(20, 30, 25, .10); }
.savebar.float.on { border-color: #e7c99c; }
.preview { padding: 4px 24px 22px; }
.preview .card { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 12px; background: var(--soft); }
.preview .card .avatar { border-radius: 10px; }
.preview .name { font-size: 17px; font-weight: 600; display: flex; align-items: center; }
.preview dl { display: grid; grid-template-columns: 48px 1fr; gap: 8px; margin: 14px 4px 0; font-size: 13px; }
.preview dt { color: var(--muted); }
.preview dd { margin: 0; word-break: break-all; }
.state-note { padding: 12px 14px; border-radius: 10px; background: var(--soft); font-size: 13px; line-height: 1.7; }
.state-note b { display: block; margin-bottom: 2px; }
.rev { padding: 12px 24px; border-top: 1px solid var(--line); font-size: 13px; }
.rev details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.rev pre { white-space: pre-wrap; font-size: 12px; background: #f6f7f5; padding: 8px 10px; border-radius: 8px; margin: 6px 0 0; }

/* 批量生成 */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.gen > * { min-width: 0; }
.gen-form { margin: 0; }
.gen-form .group { padding: 22px 24px; }
.gen-form .group + .group { border-top: 1px solid var(--line); }
.gen-form .group > h2 { margin: 0; }
.gen-form .group > .help { margin: 2px 0 0; font-size: 13px; }
.gen-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin-top: 16px; }
.gen-field { display: grid; gap: 6px; align-content: start; font-size: 13px; color: var(--muted); }
.gen-field.wide { grid-column: 1 / -1; }
.gen-field input[type=text], .gen-field input[type=number], .gen-field textarea { width: 100%; color: var(--text); }
.gen-field .range { display: flex; align-items: center; gap: 10px; color: var(--text); height: 36px; }
.gen-field .range input { flex: 1; min-width: 0; }
.gen-field .pair { display: flex; align-items: center; gap: 8px; color: var(--text); }
.gen-field .pair input { width: 0; flex: 1; }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 14px; }
.styles label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; font-size: 13px; }
.styles label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.toggle-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--soft); }
.gen-submit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 24px; border-top: 1px solid var(--line);
  background: var(--soft); border-radius: 0 0 var(--radius) var(--radius); }
.steps { margin: 0; padding: 4px 24px 18px 44px; font-size: 13px; line-height: 1.7; }
.steps li { margin: 6px 0; }
.steps li span { color: var(--muted); }
.kv { display: grid; grid-template-columns: 64px 1fr; gap: 6px 10px; padding: 4px 24px 20px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

/* 生成记录 */
.progress { height: 8px; border-radius: 99px; background: #e6e9e5; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.progress > div.fail { background: var(--danger); }
.progress.thin { height: 6px; }
.batch { margin-bottom: 14px; overflow: hidden; }
.batch > summary { list-style: none; display: grid; grid-template-columns: 22px 150px minmax(0, 1fr) 200px; gap: 16px;
  align-items: center; padding: 18px 24px; cursor: pointer; }
.batch > summary::-webkit-details-marker { display: none; }
.batch > summary:hover { background: #fafbf9; }
.batch .caret { color: var(--muted); transition: transform .15s; font-size: 12px; }
.batch[open] > summary .caret { transform: rotate(90deg); }
.batch .no { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.batch .when { font-size: 12px; color: var(--muted); }
.params { display: flex; flex-wrap: wrap; gap: 6px; }
.params .pp-chip { background: var(--soft); color: var(--text); border: 1px solid var(--line); line-height: 20px; }
.batch .result { font-size: 12px; color: var(--muted); }
.batch .result .progress { margin-top: 6px; }
.batch .tally { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.batch-body { border-top: 1px solid var(--line); background: #fcfcfb; }
.batch-body .pp-friends { padding: 16px 24px; }
.batch-body .note { padding: 14px 24px 0; font-size: 13px; color: var(--muted); }
.ops-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 24px; border-top: 1px solid var(--line); }
.ops-row form { margin: 0; }
.ops-row .grow { flex: 1; }
.log { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.log li { padding: 10px 24px; border-top: 1px solid var(--line); }
.log li.bad { color: var(--danger); }
.log li .at { color: var(--muted); font-size: 12px; margin-right: 8px; font-variant-numeric: tabular-nums; }

.login { max-width: 360px; margin: 12vh auto; }
.login form { display: grid; gap: 12px; }

@media (max-width: 960px) {
  .pp-grid, .gen { grid-template-columns: 1fr; }
  /* 窄屏时状态与操作放到表单前面，其余侧栏卡片排在表单后 */
  .ai-detail > aside { display: contents; }
  .ai-detail > aside > .pp-card { margin-bottom: 0; }
  .ai-detail .state-card { order: -1; }
  .batch > summary { grid-template-columns: 22px minmax(0, 1fr) 160px; }
  .batch > summary .params { grid-column: 2 / -1; grid-row: 2; }
}
@media (max-width: 900px) {
  main { padding: 18px 16px 48px; }
  .field { grid-template-columns: 1fr; gap: 6px; }
  .field > label { padding-top: 0; }
  .top { gap: 12px; padding: 0 16px; }
  .hide-sm { display: none; }
}
/* 手机上顶部导航占一行、可横向滑动，不再折成好几行 */
@media (max-width: 640px) {
  :root { --gap: 12px; }
  .top { height: auto; flex-wrap: wrap; padding: 10px 16px 0; gap: 0 12px; }
  .top .brand { flex: 1; }
  body > .top > nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; padding: 8px 0; scrollbar-width: none; }
  body > .top > nav::-webkit-scrollbar { display: none; }
  body > .top > nav a { flex: none; white-space: nowrap; }
  main { padding: 12px 12px 40px; }
  h1, .pp-head h1 { font-size: 19px; }
  .head { flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
  .head-ops { width: 100%; }
  .head-ops .btn { flex: 1; }
  .pp-head { padding: 18px; }
  .pp-head .avatar { width: 56px !important; height: 56px !important; }
  .pp-head .sub { flex-direction: column; gap: 2px; }
  .pp-head-top { gap: 14px; align-items: flex-start; }
  .pp-back { display: none; }
  .pp-stats { margin: 18px -18px -18px; grid-template-columns: repeat(3, 1fr); }
  .pp-foot { margin: 16px -18px -18px; padding-left: 18px; padding-right: 18px; }
  .pp-stats div { padding: 12px 14px; }
  .pp-stats b { font-size: 17px; }
  .pp-card > h2, .pp-row, .pp-empty, .rev, .log li, .field, .preview { padding-left: 16px; padding-right: 16px; }
  .pp-card > p.intro { margin-left: 16px; margin-right: 16px; }
  .pp-friends, .pp-form, .pp-actions, .kv, .ops-row, .batch-body .note { padding-left: 16px; padding-right: 16px; }
  .batch-body .pp-friends { padding: 12px 16px; }
  .pp-friends { grid-template-columns: 1fr 1fr; }
  .pp-table th { display: none; }
  .pp-table thead tr:has(.check) { display: none; }
  .pp-table td { padding: 12px; }
  .pp-table .check { width: 32px; padding-right: 0; }
  .pp-table .hide-xs { display: none; }
  .m-only, .pp-table .who .s.m-only { display: block !important; }
  .xs-inline { display: inline-block !important; }
  .bar .tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .bar .tabs::-webkit-scrollbar { display: none; }
  .bar .tabs a { flex: none; }
  .bar .search { width: 100%; flex-wrap: wrap; }
  .bar .search input[type=search] { flex: 1; width: auto !important; min-width: 0; }
  .bulk { top: 100px; }
  .gen-form .group { padding: 18px 16px; }
  .gen-grid { grid-template-columns: 1fr; }
  .gen-submit { padding: 16px; }
  .gen-submit .btn { flex: 1; }
  .batch > summary { grid-template-columns: 16px minmax(0, 1fr); gap: 8px 12px; padding: 16px; }
  .batch > summary .params, .batch > summary .result { grid-column: 2; grid-row: auto; }
  .savebar.float { bottom: 8px; }
  .jump { top: 94px; }
  .ai-form .pp-card { scroll-margin-top: 150px; }
}

/* 精细生成 */
.pp-chip.s-paused { background: #eceeea; color: var(--muted); }
.pp-chip.s-idle { background: var(--accent-soft); color: var(--accent); }
.life-head .crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
#life-workbench { --life-header-height: 52px; min-width: 0; overflow-wrap: anywhere; }
#life-workbench > *, .life-stack > fieldset > * { min-width: 0; }
#life-notice, .life-month, .life-publish { scroll-margin-top: calc(var(--life-header-height) + 76px); }
.life-stepper { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 22px 0 0; padding: 0; }
.life-stepper li { position: relative; display: flex; gap: 10px; align-items: flex-start; padding-right: 12px; min-width: 0; }
.life-stepper li:not(:last-child)::after { content: ""; position: absolute; left: 34px; right: 10px; top: 13px; height: 2px;
  background: var(--line); }
.life-stepper li.done:not(:last-child)::after { background: var(--accent); opacity: .45; }
.life-stepper .dot { position: relative; z-index: 1; flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; background: #eceeea; color: var(--muted); box-shadow: 0 0 0 4px var(--panel); }
.life-stepper li.done .dot { background: var(--accent); color: #fff; }
.life-stepper li.current .dot { background: var(--panel); color: var(--accent); border: 2px solid var(--accent); }
.life-stepper li > div { position: relative; z-index: 1; display: grid; gap: 2px; padding-top: 4px; min-width: 0; background: var(--panel);
  padding-right: 8px; }
.life-stepper b { font-size: 13px; }
.life-stepper li.current b { color: var(--accent); }
.life-stepper span:not(.dot) { font-size: 12px; color: var(--muted); line-height: 1.5; }
.life-meter { margin-top: 16px; }
.life-running { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--warn); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--warn-soft); border-top-color: var(--warn); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.life-log { max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.life-tabs { position: sticky; top: var(--life-header-height); z-index: 6; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 0 18px;
  padding: 8px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.life-tabs::-webkit-scrollbar { display: none; }
.life-tabs a { flex: none; padding: 7px 14px; border-radius: 8px; color: var(--muted); }
.life-tabs a:hover { color: var(--text); background: #eaece8; text-decoration: none; }
.life-tabs a.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); border: 1px solid var(--line); }
.life-tabs a .n { margin-left: 6px; font-size: 11px; font-weight: 400; color: var(--muted); }
.life-stack { display: grid; gap: var(--gap); margin: 0; }
.life-stack > fieldset { display: grid; gap: var(--gap); }
.life-stack .pp-card { margin: 0; }
.life-editor fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pp-card > fieldset > h2 { display: flex; align-items: baseline; gap: 8px; padding: 18px 24px 10px; margin: 0; font-size: 15px; }
.pp-card > fieldset > h2 small { font-weight: 400; color: var(--muted); font-size: 12px; }
.pp-card > fieldset > p.intro { margin: -4px 24px 12px; font-size: 13px; color: var(--muted); }
.pp-card > fieldset > .savebar.float, .life-stack .savebar.float { margin: 6px 12px 4px; }
#life-workbench .savebar { flex-wrap: wrap; }
#life-workbench .savebar select { min-width: 0; max-width: 100%; }
.life-body { padding: 4px 24px 18px; }
.life-body > .btn { margin-top: 4px; }
.life-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.life-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.life-input { display: grid; gap: 6px; margin: 10px 0; min-width: 0; }
.life-input > span { color: var(--muted); font-size: 12px; }
.life-input input, .life-input textarea { width: 100%; resize: vertical; }
.life-input [readonly] { background: var(--soft); color: var(--muted); }
.life-checks { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 8px; }
.life-checks label, .life-check { display: inline-flex; align-items: center; gap: 8px; }
.life-entry { padding: 6px 16px 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 12px; }
.life-entry-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 0 2px; min-width: 0; }
.life-entry-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.life-entry-head .pp-chip, .life-remove { flex: none; }
.life-remove { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.life-remove:hover { color: var(--danger); background: var(--danger-soft); }
.life-refs { font-size: 12px; color: var(--muted); display: inline-flex; gap: 8px; flex-wrap: wrap; }
.life-note { padding: 16px 20px; border-radius: 12px; background: #eef3f0; border: 1px solid #d9e6e0; margin-bottom: var(--gap); }
.life-note .life-prose { margin: 6px 0 0; }
.life-note .locked { color: var(--accent); }
.life-note .help { margin-top: 8px; }
.life-prose { white-space: pre-wrap; line-height: 1.75; }
.life-years { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.life-years a { padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-variant-numeric: tabular-nums; font-size: 13px; }
.life-years a:hover { border-color: var(--accent); text-decoration: none; }
.life-years a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.life-years a.stale { border-color: #e7c99c; }
.life-years a span { margin-left: 4px; font-size: 11px; color: var(--warn); }
.life-years a.on span { color: #fff; }
.life-months { border-top: 1px solid var(--line); }
.life-month { border-bottom: 1px solid var(--line); }
.life-month:last-child { border-bottom: 0; }
.life-month > summary { display: flex; align-items: center; gap: 12px; padding: 13px 24px; cursor: pointer; list-style: none; min-width: 0; }
.life-month > summary::-webkit-details-marker { display: none; }
.life-month > summary::before { content: "▸"; color: var(--muted); font-size: 12px; transition: transform .15s; }
.life-month[open] > summary::before { transform: rotate(90deg); }
.life-month > summary:hover { background: #fafbf9; }
.life-month > summary .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.life-month > summary .code, .life-month > summary .pp-chip { flex: none; }
.life-month[open] > summary { background: #fafbf9; }
.life-pending > summary { display: flex; align-items: center; gap: 10px; padding: 18px 24px 8px; cursor: pointer; }
.life-memories { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.life-memory { padding: 16px 20px; }
.life-memory-top { display: flex; align-items: center; gap: 8px; }
.life-memory h3 { margin: 8px 0 4px; font-size: 16px; }
.life-memory .life-prose { margin: 0 0 10px; }
.life-lead { margin: 0 0 14px; }
.life-dl { display: grid; grid-template-columns: 76px 1fr; gap: 6px 10px; margin: 0; font-size: 13px; }
.life-dl dt { color: var(--muted); }
.life-dl dd { margin: 0; white-space: pre-wrap; }
.life-persona > summary { display: flex; align-items: baseline; gap: 8px; padding: 18px 24px; cursor: pointer; }
.life-issue { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.life-issue:last-child { border-bottom: 0; }
.life-publish { margin-top: var(--gap); border-color: #cfe2db; }
.life-publish .life-body { display: grid; gap: 12px; justify-items: start; }
.life-trial { max-width: 820px; margin: 0 auto; overflow: hidden; }
.life-trial-head { padding: 18px 24px 12px; }
.life-trial-head h2 { margin: 0 0 2px; }
.life-thread { background: #ededed; min-height: 300px; max-height: 56vh; overflow: auto; padding: 18px 22px; }
#life-chat { display: flex; flex-direction: column; gap: 10px; }
#life-chat:not(:empty) + .life-thread-empty { display: none; }
.life-thread-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 90px 20px 0; }
.life-bubble { max-width: 78%; padding: 9px 13px; margin: 0; border-radius: 8px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.life-bubble.mine { align-self: flex-end; background: #a9e97a; }
.life-bubble.theirs { align-self: flex-start; background: #fff; }
#life-trial-form { display: flex; gap: 10px; align-items: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); }
#life-trial-form textarea { flex: 1; min-width: 0; resize: none; }
#life-sources { padding: 0 24px 16px; font-size: 13px; }
#life-sources summary { cursor: pointer; color: var(--muted); padding-top: 4px; }
.life-diff { overflow: auto; }
.life-diff table { table-layout: fixed; }
.life-diff td { vertical-align: top; }
.life-diff pre { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 13px; margin: 0; padding: 8px 10px; border-radius: 8px; }
.life-diff pre.old { background: #fbf3f2; }
.life-diff pre.new { background: #f0f7f4; }
.life-diff-label { display: none; }
.life-confirm { border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: min(460px, calc(100% - 32px)); box-shadow: 0 20px 80px #0002; }
.life-confirm::backdrop { background: #15221b66; }
.life-confirm h2 { margin-top: 0; }
.life-confirm p { line-height: 1.8; }
.life-confirm .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
@media (max-width: 960px) {
  .life-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
  .life-stepper li:nth-child(2)::after { display: none; }
  .life-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  #life-workbench { --life-header-height: 86px; }
  .life-stepper { gap: 16px 8px; margin-top: 18px; }
  .life-stepper li { gap: 8px; padding-right: 0; }
  .life-stepper li::after { display: none; }
  .life-stepper li > div { padding-right: 0; }
  .life-grid, .life-grid.three { grid-template-columns: 1fr; }
  .life-body, .life-month > summary, .life-trial-head, .life-persona > summary, #life-sources, .pp-card > fieldset > h2 { padding-left: 16px; padding-right: 16px; }
  .pp-card > fieldset > p.intro { margin-left: 16px; margin-right: 16px; }
  #life-workbench .savebar { gap: 8px; padding: 10px; }
  #life-workbench .savebar select { flex: 1 1 100%; width: 100%; }
  #life-workbench .savebar .btn { flex: 1; white-space: normal; height: auto; min-height: 36px; padding: 7px 12px; }
  #life-workbench .savebar > .small { flex-basis: 100%; }
  #life-workbench .pp-card h2 { flex-wrap: wrap; }
  .life-entry-head .life-refs { flex-basis: 100%; }
  .life-remove { min-height: 32px; }
  .life-log { max-width: 100%; }
  .life-memories { grid-template-columns: 1fr; }
  .life-memory-top { flex-wrap: wrap; }
  .life-month > summary { gap: 8px; }
  #life-trial-form { padding: 12px; gap: 8px; }
  .life-bubble { max-width: 88%; }
  .life-diff table, .life-diff tbody, .life-diff tr, .life-diff td { display: block; width: 100%; }
  .life-diff thead { display: none; }
  .life-diff tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .life-diff tr:last-child { border-bottom: 0; }
  .life-diff td { padding: 0 0 10px; border: 0; }
  .life-diff td:last-child { padding-bottom: 0; }
  .life-diff td.code { font-weight: 600; color: var(--text); }
  .life-diff-label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
}
@media (prefers-reduced-motion: reduce) {
  .life-month > summary::before { transition: none; }
  .life-running .spin { animation: none; }
}
