/* ============================================================
   图像生成服务 · 配方工作台
   视觉主题：热敏工作台 —— 暖纸白、墨黑、等宽数据、烧灼琥珀强调、撕纸虚线
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  --paper:        #FAF8F3;
  --paper-raised: #FFFEFB;
  --paper-sunken: #F1ECE1;
  --ink:          #211C15;
  --ink-soft:     #6B6252;
  --ink-faint:    #9C9384;
  --line:         #E4DDCE;
  --line-strong:  #CDC4B1;
  --accent:       #C2600F;
  --accent-strong:#9C4C0B;
  --accent-tint:  #FAEBD9;
  --ok:           #4F7A4E;
  --ok-tint:      #E7EFE4;
  --err:          #B23A32;
  --err-tint:     #F7E4E1;
  --warn:         #A9791A;
  --timing-text:  #7A6A3A;
  --timing-fetch: #6E8A8C;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas,
               "Liberation Mono", "Courier New", monospace;

  --r-sm: 4px;
  --r-md: 7px;
  --r-lg: 11px;

  --shadow-sm: 0 1px 2px rgba(40, 30, 15, 0.05), 0 1px 1px rgba(40, 30, 15, 0.04);
  --shadow-md: 0 4px 14px rgba(40, 30, 15, 0.08), 0 1px 3px rgba(40, 30, 15, 0.06);
  --shadow-lg: 0 18px 48px rgba(30, 22, 10, 0.18), 0 4px 12px rgba(30, 22, 10, 0.10);

  --topbar-h: 54px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #16130E;
    --paper-raised: #201C15;
    --paper-sunken: #100D09;
    --ink:          #ECE5D7;
    --ink-soft:     #ADA490;
    --ink-faint:    #766D5C;
    --line:         #322C21;
    --line-strong:  #473F30;
    --accent:       #E28A3E;
    --accent-strong:#F0A462;
    --accent-tint:  #2B2013;
    --ok:           #7EA871;
    --ok-tint:      #1E2519;
    --err:          #D97D70;
    --err-tint:     #2E1B17;
    --warn:         #D9AC58;
    --timing-text:  #B7A05C;
    --timing-fetch: #8FB0B2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
    --shadow-md: 0 6px 18px rgba(0,0,0,0.42);
    --shadow-lg: 0 22px 52px rgba(0,0,0,0.6);
  }
}
/* 显式主题覆盖（若宿主注入 data-theme） */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 纸张颗粒噪声：极淡，营造质感不损可读 */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) { .grain { mix-blend-mode: screen; opacity: 0.35; } }

a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

::selection { background: var(--accent-tint); color: var(--accent-strong); }

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 20px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); background-clip: padding-box; border: 3px solid transparent; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--paper-raised) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 650; font-size: 14.5px; letter-spacing: 0.2px; }
.brand-tag { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.5px; color: var(--ink-faint); }

.tabs { display: flex; gap: 2px; margin-left: 8px; }
.tab {
  position: relative;
  padding: 7px 14px; border-radius: var(--r-sm);
  color: var(--ink-soft); font-weight: 550; font-size: 13.5px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.tab:hover { color: var(--ink); background: var(--paper-sunken); }
.tab.is-active { color: var(--accent-strong); }
.tab.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.gw-status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 100px;
  font-size: 12px; font-weight: 550;
  border: 1px solid var(--line); background: var(--paper-raised);
}
.gw-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); flex-shrink: 0; }
.gw-status--ok   { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); background: var(--ok-tint); }
.gw-status--ok .gw-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.gw-status--bad  { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--line)); background: var(--err-tint); cursor: pointer; }
.gw-status--bad .gw-dot { background: var(--err); }
.gw-status--loading .gw-dot { animation: pulse 1.1s var(--ease) infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 网关未就绪告警条 */
.gw-banner {
  position: relative; z-index: 30;
  padding: 11px 20px;
  background: var(--accent-tint);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  color: var(--accent-strong);
  font-size: 13px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.gw-banner code {
  font-family: var(--font-mono); font-size: 12px;
  background: color-mix(in srgb, var(--accent) 14%, var(--paper-raised));
  padding: 2px 7px; border-radius: var(--r-sm);
  color: var(--ink);
}

/* ---------- 视图容器 ---------- */
.view { position: relative; z-index: 1; }
.boot { padding: 80px 20px; text-align: center; color: var(--ink-faint); font-size: 14px; }

/* ---------- 通用：撕纸虚线分隔 ---------- */
.perf {
  height: 2px; border: 0; margin: 0;
  background-image: repeating-linear-gradient(90deg, var(--line-strong) 0 5px, transparent 5px 11px);
  background-size: 11px 2px; background-repeat: repeat-x; background-position: center;
}
.perf--v {
  width: 2px; height: auto; align-self: stretch;
  background-image: repeating-linear-gradient(180deg, var(--line-strong) 0 5px, transparent 5px 11px);
  background-size: 2px 11px; background-repeat: repeat-y;
}

/* ---------- 通用：区块 / 面板 ---------- */
.panel { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.section-title {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--ink-faint);
  display: flex; align-items: center; gap: 8px;
}
.section-title::before { content: ""; width: 3px; height: 11px; border-radius: 2px; background: var(--accent); }

/* ---------- 通用：按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 550; line-height: 1;
  border: 1px solid var(--line-strong); background: var(--paper-raised); color: var(--ink);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform 0.08s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), color 0.15s var(--ease);
}
.btn:hover { background: var(--paper-sunken); border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn .ic { width: 15px; height: 15px; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
@media (prefers-color-scheme: dark) { .btn--primary { color: #1a1206; } }
.btn--danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.btn--danger:hover { background: var(--err-tint); border-color: var(--err); }
.btn--sm { padding: 5px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn--block { width: 100%; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--paper-sunken); border-color: var(--line); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--paper-sunken); color: var(--ink); }
.icon-btn .ic { width: 16px; height: 16px; }
.ic { display: inline-flex; align-items: center; justify-content: center; width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.15em; }
.ic svg { display: block; width: 100%; height: 100%; }
.state-ic .ic, .stage-ic .ic { width: 100%; height: 100%; }
.gcard--error .ic { width: 22px; height: 22px; }
.mcell--error .ic { width: 18px; height: 18px; }
.run-target .ic { width: 15px; height: 15px; }

/* ---------- 通用：表单控件 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field-label { font-size: 12.5px; font-weight: 550; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.field-label .req { color: var(--accent); }
.field-hint { font-size: 11.5px; color: var(--ink-faint); line-height: 1.4; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; margin-bottom: 0; }

input[type="text"], input[type="number"], input[type="search"], textarea, select {
  width: 100%; font-family: var(--font-sans); font-size: 13px; color: var(--ink);
  background: var(--paper-raised); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); padding: 8px 10px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input:read-only, input[readonly] { background: var(--paper-sunken); color: var(--ink-soft); cursor: default; }
input:read-only:focus { box-shadow: none; border-color: var(--line-strong); }
textarea { resize: vertical; line-height: 1.5; min-height: 60px; }
textarea.mono, input.mono { font-family: var(--font-mono); font-size: 12.5px; }
textarea.tall { min-height: 130px; }
select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' fill='none' stroke='%239C9384' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}

/* 开关 */
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { width: 36px; height: 20px; border-radius: 100px; background: var(--line-strong); position: relative; transition: background 0.18s var(--ease); flex-shrink: 0; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.18s var(--ease); }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.toggle-text { font-size: 13px; color: var(--ink); }

/* 分段控件 */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--paper-sunken); border-radius: var(--r-md); border: 1px solid var(--line); }
.segmented button {
  border: 0; background: transparent; cursor: pointer; color: var(--ink-soft);
  padding: 5px 12px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 550;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.segmented button.is-active { background: var(--paper-raised); color: var(--accent-strong); box-shadow: var(--shadow-sm); }

/* 标签输入 */
.tags-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--paper-raised); }
.tags-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.tags-input input { border: 0; padding: 3px; flex: 1; min-width: 80px; background: transparent; }
.tags-input input:focus { box-shadow: none; }
.tag-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 9px; border-radius: 100px; background: var(--paper-sunken); font-size: 12px; color: var(--ink-soft); }
.tag-chip button { border: 0; background: transparent; color: var(--ink-faint); cursor: pointer; width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; }
.tag-chip button:hover { background: var(--line-strong); color: var(--ink); }

/* ---------- 徽标 / 状态点 ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 550; font-family: var(--font-mono); letter-spacing: 0.3px; }
.badge--muted { background: var(--paper-sunken); color: var(--ink-soft); }
.badge--accent { background: var(--accent-tint); color: var(--accent-strong); }
.badge--ok { background: var(--ok-tint); color: var(--ok); }
.badge--err { background: var(--err-tint); color: var(--err); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot--ok { background: var(--ok); } .dot--err { background: var(--err); } .dot--run { background: var(--accent); animation: pulse 1.1s infinite; } .dot--idle { background: var(--ink-faint); }

/* ============================================================
   测试台 —— 三栏工作台
   ============================================================ */
.bench {
  display: grid;
  grid-template-columns: 268px 1fr 400px;
  gap: 0;
  height: calc(100vh - var(--topbar-h));
  min-height: 0;
}
body.gw-warn .bench { height: calc(100vh - var(--topbar-h) - 46px); }
.bench-col { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.bench-col--list  { border-right: 1px solid var(--line); background: var(--paper); }
.bench-col--edit  { background: var(--paper-raised); overflow-y: auto; }
.bench-col--run   { border-left: 1px solid var(--line); background: var(--paper); overflow-y: auto; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 13px 16px; flex-shrink: 0; }
.col-head .spacer { flex: 1; }

/* 配方列表 */
.recipe-search { padding: 0 12px 10px; }
.recipe-list { flex: 1; overflow-y: auto; padding: 4px 8px 40px; }
.recipe-item {
  display: flex; flex-direction: column; gap: 3px; position: relative;
  padding: 9px 11px 9px 13px; border-radius: var(--r-md); cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.13s var(--ease), border-color 0.13s var(--ease);
}
.recipe-item:hover { background: var(--paper-sunken); }
.recipe-item.is-active { background: var(--accent-tint); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.recipe-item.is-active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.recipe-item.is-disabled { opacity: 0.5; }
.recipe-item-top { display: flex; align-items: center; gap: 8px; }
.recipe-item-name { font-weight: 600; font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipe-item-key { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); }
.recipe-item-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-faint); }
.recipe-item-tags { display: flex; gap: 4px; overflow: hidden; }
.recipe-item-tags span { white-space: nowrap; }

.list-group-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-faint); padding: 12px 12px 5px; }

/* 编辑器 */
.editor { max-width: 760px; margin: 0 auto; width: 100%; padding: 4px 26px 80px; }
.editor-head { display: flex; align-items: flex-start; gap: 14px; padding: 18px 0 14px; position: sticky; top: 0; background: var(--paper-raised); z-index: 5; }
.editor-head-main { flex: 1; min-width: 0; }
.editor-title { font-size: 19px; font-weight: 650; letter-spacing: -0.2px; }
.editor-sub { font-size: 12px; color: var(--ink-faint); font-family: var(--font-mono); margin-top: 2px; }
.editor-actions { display: flex; gap: 8px; align-items: center; }
.dirty-flag { font-size: 11.5px; color: var(--accent-strong); display: inline-flex; align-items: center; gap: 5px; }

.form-section { padding: 20px 0; }
.form-section-head { margin-bottom: 15px; }
.form-section + .form-section { border-top: 0; }

.collapse-head { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-soft); font-size: 12.5px; font-weight: 550; padding: 6px 0; user-select: none; }
.collapse-head .chev { transition: transform 0.18s var(--ease); color: var(--ink-faint); }
.collapse-head.is-open .chev { transform: rotate(90deg); }
.collapse-body { padding-top: 8px; }

/* 试跑面板 */
.run-panel { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.run-target { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--paper-sunken); border-radius: var(--r-md); font-size: 12.5px; }
.run-target strong { font-weight: 600; }
.run-actions { display: flex; flex-direction: column; gap: 8px; }

.run-result { display: flex; flex-direction: column; gap: 0; }
.result-image-wrap { position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--paper-sunken); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; min-height: 120px; }
.result-image-wrap img { max-width: 100%; display: block; }
.result-caption { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); text-align: center; padding: 7px 0; }

/* 阶段进度 */
.stages { display: flex; gap: 8px; margin: 4px 0 2px; }
.stage {
  flex: 1; display: flex; flex-direction: column; gap: 5px; align-items: center;
  padding: 10px 6px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--paper-raised); font-size: 11.5px; color: var(--ink-faint);
  transition: all 0.2s var(--ease);
}
.stage-ic { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); display: flex; align-items: center; justify-content: center; }
.stage.is-active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-tint); }
.stage.is-active .stage-ic { border-color: var(--accent); border-top-color: transparent; animation: spin 0.7s linear infinite; }
.stage.is-done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.stage.is-done .stage-ic { border-color: var(--ok); background: var(--ok); }
.stage.is-skip { opacity: 0.5; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 分段耗时条 */
.timings { display: flex; flex-direction: column; gap: 7px; }
.timing-bar { display: flex; height: 26px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--paper-sunken); }
.timing-seg { display: flex; align-items: center; justify-content: center; min-width: 2px; font-family: var(--font-mono); font-size: 10.5px; color: #fff; white-space: nowrap; overflow: hidden; transition: width 0.4s var(--ease); }
.timing-seg--text  { background: var(--timing-text); }
.timing-seg--image { background: var(--accent); }
.timing-seg--fetch { background: var(--timing-fetch); }
@media (prefers-color-scheme: dark) { .timing-seg { color: #1a1206; } }
.timing-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: var(--ink-soft); font-family: var(--font-mono); }
.timing-legend span { display: inline-flex; align-items: center; gap: 5px; }
.timing-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.timing-total { font-family: var(--font-mono); font-size: 12px; color: var(--ink); font-weight: 600; }

/* 只读文本块（scene / prompt） */
.mono-block { font-family: var(--font-mono); font-size: 12px; line-height: 1.55; color: var(--ink); background: var(--paper-sunken); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto; }
.disclose { margin-top: 8px; }
.disclose summary { cursor: pointer; font-size: 12px; color: var(--ink-soft); font-weight: 550; padding: 4px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
.disclose summary::-webkit-details-marker { display: none; }
.disclose summary .chev { transition: transform 0.18s var(--ease); }
.disclose[open] summary .chev { transform: rotate(90deg); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; }
.kv dt { color: var(--ink-faint); font-family: var(--font-mono); font-size: 11px; }
.kv dd { margin: 0; color: var(--ink); font-family: var(--font-mono); font-size: 12px; word-break: break-word; }

/* ============================================================
   批量测试
   ============================================================ */
.page { max-width: 1180px; margin: 0 auto; padding: 24px 22px 80px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 680; letter-spacing: -0.3px; }
.page-sub { color: var(--ink-faint); font-size: 13px; margin-top: 3px; }
.page-head .spacer { flex: 1; }

.batch-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 26px; }
.builder-card { padding: 16px 18px; }
.builder-card h3 { margin: 0 0 12px; font-size: 13px; }
.recipe-picker { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; }
.pick-row { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: var(--r-sm); cursor: pointer; }
.pick-row:hover { background: var(--paper-sunken); }
.pick-check { width: 17px; height: 17px; border-radius: var(--r-sm); border: 1.5px solid var(--line-strong); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; transition: all 0.13s var(--ease); }
.pick-row.is-picked .pick-check { background: var(--accent); border-color: var(--accent); }
.pick-name { font-size: 13px; font-weight: 500; }
.pick-key { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); margin-left: auto; }
.builder-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; padding: 16px 18px; }
.builder-foot .field { margin-bottom: 0; }
.builder-foot .spacer { flex: 1; }

/* 批次列表 */
.batch-list { display: flex; flex-direction: column; gap: 10px; }
.batch-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; cursor: pointer; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.batch-row:hover { border-color: var(--ink-faint); box-shadow: var(--shadow-md); }
.batch-row-main { flex: 1; min-width: 0; }
.batch-row-title { font-weight: 600; font-size: 14px; }
.batch-row-meta { font-size: 11.5px; color: var(--ink-faint); font-family: var(--font-mono); margin-top: 2px; }
.progress-track { width: 130px; height: 6px; border-radius: 100px; background: var(--paper-sunken); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 100px; transition: width 0.4s var(--ease); }

/* ============================================================
   矩阵（批次对比：行=内容 列=配方）
   ============================================================ */
.matrix-wrap { overflow-x: auto; padding-bottom: 8px; }
.matrix { border-collapse: separate; border-spacing: 0; }
.matrix th, .matrix td { border: 1px solid var(--line); }
.matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--paper-raised); padding: 8px 10px; font-size: 11.5px; font-weight: 600; text-align: center; min-width: 92px; }
.matrix thead th.corner { left: 0; z-index: 3; text-align: left; min-width: 150px; }
.matrix tbody th { position: sticky; left: 0; z-index: 1; background: var(--paper-raised); padding: 8px 12px; font-size: 12px; font-weight: 500; text-align: left; max-width: 220px; vertical-align: top; }
.matrix-content-brief { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mcell { width: 92px; height: 92px; padding: 0; position: relative; background: var(--paper-sunken); }
.mcell-inner { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; }
.mcell img { width: 100%; height: 100%; object-fit: cover; }
.mcell--pending .mcell-inner { color: var(--ink-faint); }
.mcell--running .mcell-inner { color: var(--accent); }
.mcell--error { background: var(--err-tint); }
.mcell--error .mcell-inner { color: var(--err); flex-direction: column; gap: 4px; font-size: 10.5px; }
.mcell-retry { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--err-tint) 80%, transparent); opacity: 0; transition: opacity 0.15s; }
.mcell--error:hover .mcell-retry { opacity: 1; }
.mcell-hover { position: absolute; inset: 0; background: rgba(20,15,5,0.55); opacity: 0; display: flex; align-items: center; justify-content: center; transition: opacity 0.15s; color: #fff; }
.mcell--ok:hover .mcell-hover { opacity: 1; }
.spin-ic { width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ============================================================
   画廊
   ============================================================ */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 12px 14px; }
.filter-bar .field { margin-bottom: 0; flex-direction: row; align-items: center; gap: 7px; }
.filter-bar .field-label { white-space: nowrap; }
.filter-bar select { min-width: 130px; }
.filter-bar .spacer { flex: 1; }
.filter-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }

.gallery-grid { columns: 5 190px; column-gap: 14px; }
.gcard { break-inside: avoid; margin-bottom: 14px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--paper-raised); cursor: pointer; position: relative; box-shadow: var(--shadow-sm); transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s var(--ease); }
.gcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.gcard-img { width: 100%; display: block; background: var(--paper-sunken); }
.gcard--error { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 130px; color: var(--err); background: var(--err-tint); font-size: 12px; padding: 16px; text-align: center; }
.gcard-foot { display: flex; align-items: center; gap: 7px; padding: 8px 10px; }
.gcard-recipe { font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard-time { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; }
.gcard-badge { position: absolute; top: 8px; left: 8px; }

.load-more { display: flex; justify-content: center; padding: 26px 0 10px; }

/* ---------- 抽屉 ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(25,18,8,0.42); opacity: 0; transition: opacity 0.22s var(--ease); backdrop-filter: blur(2px); }
.scrim.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(640px, 94vw); background: var(--paper-raised);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform 0.28s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.drawer-title { font-weight: 650; font-size: 15px; flex: 1; }
.drawer-body { overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.drawer-img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--paper-sunken); }
.archive-group { display: flex; flex-direction: column; gap: 8px; }
.archive-group > .section-title { margin-bottom: 2px; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 9px; padding: 10px 15px; border-radius: var(--r-md); background: var(--ink); color: var(--paper); font-size: 13px; box-shadow: var(--shadow-lg); animation: toast-in 0.25s var(--ease); max-width: 90vw; }
.toast--ok { background: var(--ok); color: #fff; }
.toast--err { background: var(--err); color: #fff; }
.toast .ic { width: 16px; height: 16px; flex-shrink: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }
.toast.leaving { animation: toast-out 0.2s var(--ease) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.97); } }

/* ---------- 确认弹窗 ---------- */
.modal-card {
  position: fixed; top: 50%; left: 50%; z-index: 70;
  transform: translate(-50%, -46%) scale(0.97); opacity: 0;
  width: min(400px, 92vw); padding: 22px 22px 18px;
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.modal-card.is-open { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-title { font-size: 15px; font-weight: 650; margin-bottom: 7px; }
.modal-desc { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; }

/* ---------- 空 / 加载 / 错误态 ---------- */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 60px 24px; text-align: center; color: var(--ink-faint); }
.state-ic { width: 42px; height: 42px; color: var(--line-strong); }
.state-title { font-size: 14px; font-weight: 550; color: var(--ink-soft); }
.state-desc { font-size: 12.5px; max-width: 320px; line-height: 1.5; }
.state--error .state-ic { color: color-mix(in srgb, var(--err) 55%, var(--line)); }
.state--error .state-title { color: var(--err); }

/* 骨架 */
.skel { position: relative; overflow: hidden; background: var(--paper-sunken); border-radius: var(--r-sm); }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--paper-raised) 60%, transparent), transparent); transform: translateX(-100%); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-line { height: 11px; margin: 7px 0; }
.skel-img { width: 100%; aspect-ratio: 3/4; }

/* 进场动画 */
.enter { animation: enter-up 0.4s var(--ease) both; }
@keyframes enter-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: enter-up 0.4s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .bench { grid-template-columns: 240px 1fr; }
  .bench-col--run { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: 380px; z-index: 35; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform 0.25s var(--ease); }
  .bench-col--run.is-open { transform: none; }
  .run-toggle-fab { position: fixed; right: 18px; bottom: 18px; z-index: 34; }
  .gallery-grid { columns: 4 180px; }
  .batch-builder { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .bench { grid-template-columns: 1fr; }
  .bench-col--list { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 260px; z-index: 36; transform: translateX(-100%); transition: transform 0.25s var(--ease); }
  .bench-col--list.is-open { transform: none; }
  .tabs .tab { padding: 7px 10px; }
  .gallery-grid { columns: 2 150px; }
  .page { padding: 18px 14px 70px; }
  .brand-text { display: none; }
}
.run-toggle-fab, .list-toggle-fab { display: none; }
@media (max-width: 1080px) { .run-toggle-fab { display: inline-flex; } }
@media (max-width: 720px) { .list-toggle-fab { display: inline-flex; position: fixed; left: 18px; bottom: 18px; z-index: 34; } }

/* 测试文本自动生成按钮 */
.suggest-row { display: flex; justify-content: flex-end; margin-top: 6px; }
.suggest-btn { gap: 5px; }
