/* ============================================================
   新媒体工厂 · 冷感极简工作台
   Linear / Notion 风 · 冷白蓝灰、轻玻璃、克制阴影
   ============================================================ */
:root {
  /* ===== 中性灰阶 ===== */
  --page: #f6f7f9;            /* 主内容底 */
  --page-soft: #f8fafc;       /* 侧栏 / 次级底 */
  --surface: #ffffff;         /* 卡片 / 面板 */
  --surface-soft: rgba(255,255,255,.82);
  --surface-2: #f1f5f9;       /* 内嵌 / hover 浅底 */
  --surface-3: #e8eef5;       /* 进度条 / 弱填充 */
  --line: #e2e8f0;            /* 主边框 */
  --line-2: #edf1f5;          /* 更浅分隔 */
  --line-strong: #cbd5e1;     /* hover / active 强边框 */

  /* ===== 文字 · 3档 ===== */
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --ink: var(--text);         /* 兼容旧页面 */
  --muted: var(--text-secondary);
  --faint: var(--text-muted);

  /* ===== 主操作 · 冷蓝灰 ===== */
  --accent: #4a5d7e;
  --accent-strong: #3a4d6c;
  --accent-soft: #eef2f7;
  --accent-border: #c7d2e3;
  --focus-ring: rgba(59,130,246,.25);

  /* ===== 语义色（克制） ===== */
  --success: #16a34a;
  --green: var(--success); --green-bg: #ecfdf5;
  --blue:  #3b82f6; --blue-bg:  #eff6ff;
  --amber: #d97706; --amber-bg: #fffbeb;
  --red:   #dc2626; --red-bg:   #fef2f2;
  --gray:  #64748b; --gray-bg:  #f1f5f9;

  /* ===== 圆角 ===== */
  --radius: 12px;
  --r-card:  16px;
  --r-btn:   10px;
  --r-input: 10px;
  --r-pill:  999px;

  /* ===== 阴影 · 极轻 ===== */
  --shadow: 0 1px 2px rgba(15,23,42,.04);
  --shadow-hover: 0 1px 2px rgba(15,23,42,.04), 0 6px 16px rgba(15,23,42,.05);
  --shadow-lg: 0 8px 24px rgba(15,23,42,.06);
  --shadow-pop: 0 1px 2px rgba(15,23,42,.05), 0 12px 32px rgba(15,23,42,.08);

  /* ===== 字体 / 侧栏布局（参考管理台字阶） ===== */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", "Menlo", "Consolas", "Roboto Mono", monospace;
  --sidebar-width: 256px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-24: 24px;

  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--page); color: var(--text); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .12s;
}
a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

code, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
code {
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: .92em;
}

/* ============================================================
   微动效 · 100-200ms fade + 微位移
   ============================================================ */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fade-in      { animation: fade-in-up 180ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.fade-in-only { animation: fade-in 120ms ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   页面骨架
   ============================================================ */
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 24px 64px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar h1 {
  margin: 0;
  font-size: var(--fs-24);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}
.topbar .sub {
  color: var(--muted);
  margin-left: 10px;
  font-size: var(--fs-13);
  font-weight: 400;
}

/* ============================================================
   面板 / 卡片 · 边框优先、阴影克制
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: none;
}
.panel h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.panel .desc, .desc {
  color: var(--muted);
  margin: 0 0 14px;
  font-size: 13px;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface);
  transition: border-color .15s, background .15s, transform .15s;
}
.card:hover { border-color: var(--line-strong); }
.card .desc {
  margin-top: 5px;
  margin-bottom: 0;
  font-weight: 600;
  color: var(--text);
}
.card .sub {
  margin-top: 5px;
  white-space: pre-line;
  color: var(--muted);
  font-size: 13px;
}
.sec-head, .section-head {
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 18px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.placeholder {
  text-align: center;
  color: var(--muted);
  padding: 36px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-card);
  background: var(--surface-2);
}
.placeholder b {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}
.empty {
  color: var(--faint);
  padding: 32px 0;
  text-align: center;
  font-size: 13px;
}

/* ============================================================
   文本工具
   ============================================================ */
.muted    { color: var(--muted); }
.subline  { color: var(--muted); font-size: 13px; margin-top: 6px; }
.time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.hidden     { display: none; }
.row        { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between    { justify-content: space-between; }
.row-actions{ display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   表单 · 圆角 8 / 聚焦光晕克制
   ============================================================ */
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea {
  padding: 9px 12px;
  min-height: 62px;
  resize: vertical;
  line-height: 1.6;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong));
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.field { margin-bottom: 12px; }
.field label {
  display: block;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 12.5px;
  letter-spacing: 0.01em;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================
   按钮 · 圆角 8 / hover 轻浮起
   ============================================================ */
.btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: var(--fs-13);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .12s, border-color .12s, transform .08s, color .12s;
}
.btn:hover    { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active   { transform: translateY(0.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn.small {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 6px;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); }

/* ============================================================
   标签 / 徽章 · pill
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.chip.green, .tag.green, .tag.ok  { color: var(--green); background: var(--green-bg); }
.chip.blue,  .tag.blue            { color: var(--accent-strong); background: var(--accent-soft); }
.chip.amber, .tag.amber           { color: var(--amber); background: var(--amber-bg); }
.chip.gray,  .tag.gray            { color: var(--muted); background: var(--gray-bg); }
.chip.red,   .tag.red,  .tag.err  { color: var(--red);   background: var(--red-bg); }

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}
.status-dot.success, .status-dot.green { background: var(--success); }
.status-dot.amber { background: var(--amber); }
.status-dot.red { background: var(--red); }
.status-dot.blue { background: var(--blue); }

/* ============================================================
   侧栏外壳 · 顶部品牌 / 中部菜单自滚 / 底部统计+用户固定
   ============================================================ */
body.shell-host {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--page);
}
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  max-height: 100%;
  background: #f8fafc;
  border-right: 1px solid var(--line);
  padding: 14px 12px 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}
.brand {
  grid-row: 1;
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--text);
  padding: 2px 10px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.02em;
  line-height: 1.25;
  min-width: 0;
}
.brand .logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}
.nav-scroll {
  grid-row: 2;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-bottom: 4px;
}
.nav-group-title {
  margin: 12px 12px 6px;
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.4;
}
.nav-group-title:first-child { margin-top: 2px; }
.nav-item {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 0;
  color: #475569;
  padding: 0 12px;
  border-radius: 12px;
  font-weight: 500;
  font-size: var(--fs-14);
  line-height: 1.4;
  text-align: left;
  margin-bottom: 3px;
  transition: background .14s, color .14s, box-shadow .14s;
}
.nav-item.nav-sub { padding-left: 12px; }
.nav-item:hover   { background: rgba(255,255,255,.88); color: var(--text); }
.nav-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.nav-item.active  {
  background: #e8edf5;
  color: var(--text);
  font-weight: 600;
  box-shadow: none;
}
.nav-ico {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: var(--fs-12);
  font-weight: 600;
  color: #64748b;
  transition: background .12s, color .12s, border-color .12s;
  flex: 0 0 auto;
}
.nav-item:hover .nav-ico {
  border-color: var(--line-strong);
  color: var(--text);
}
.nav-item.active .nav-ico {
  background: #fff;
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  color: var(--accent-strong);
}
.sidebar-footer {
  grid-row: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
  min-height: 0;
  max-height: none;
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
  background: #f8fafc;
  /* 底部固定：不参与整栏滚动，菜单不够高时只滚中间 nav-scroll */
  position: sticky;
  bottom: 0;
  z-index: 2;
}
.sidebar-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  flex: none;
}
.sidebar-stat {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--page-soft);
  border: 1px solid var(--line-2);
}
.sidebar-stat-wide { grid-column: 1 / -1; }
.sidebar-stat-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  margin-bottom: 2px;
}
.sidebar-stat-value {
  display: block;
  color: var(--text);
  font-size: var(--fs-14);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-stat-note {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-box {
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  flex: none;
}
.user-trigger {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.user-trigger:hover {
  border-color: var(--line-strong);
  background: #fcfdff;
}
.user-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent-strong));
  color: #fff;
  font-size: var(--fs-13);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}
.user-copy { min-width: 0; flex: 1 1 auto; }
.user-name {
  font-weight: 600;
  color: var(--text);
  font-size: var(--fs-13);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta {
  color: var(--muted);
  font-size: var(--fs-11);
  margin-top: 2px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-caret {
  color: var(--faint);
  font-size: 12px;
  flex: 0 0 auto;
  transition: transform .14s;
}
.user-box.open .user-caret { transform: rotate(180deg); }
.user-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.user-box.open .user-menu { display: block; }
.user-menu-item {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 500;
  text-align: left;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-menu-item:hover { background: var(--page-soft); }
.user-menu-item.danger { color: var(--red); }
.user-menu-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
/* 多页保活：同一 shell 内叠放多个 iframe，切换只显隐不销毁 */
.view-host {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--page);
  overflow: hidden;
}
.view-host > iframe.view-frame {
  border: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  background: var(--page);
  position: absolute;
  inset: 0;
}
.view-host > iframe.view-frame[hidden] {
  display: none;
}
/* 兼容旧单 iframe 选择器 */
iframe#view {
  border: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  background: var(--page);
}

/* ============================================================
   工作台公共组件 · 创作中台自动化同款
   双栏 / 三栏：各栏独立滚动，互不带动
   ============================================================ */
.content-page, .page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px clamp(14px, 2vw, 28px) 40px;
}
/* 仅含双栏/三栏工作台的页面锁定整页滚动 */
html:has(body:has(.workspace)),
html:has(body:has(.auto-workspace)),
html:has(body:has(.layout)) {
  height: 100%;
  overflow: hidden;
}
body:has(.workspace),
body:has(.auto-workspace),
body:has(.layout) {
  height: 100%;
  overflow: hidden;
}
.content-page:has(.workspace),
.content-page:has(.auto-workspace),
.content-page:has(.layout) {
  height: 100vh;
  max-height: 100vh;
  padding-bottom: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.workspace, .auto-workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: hidden;
}
.auto-workspace {
  grid-template-columns: 260px 340px minmax(0, 1fr);
}
.list-panel, .detail-panel, .auto-panel, .work-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
}
.list-panel { position: static; }
.list-head, .detail-head, .auto-panel-head, .panel-head {
  flex: 0 0 auto;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.88));
}
.list-head h1, .detail-head h2, .auto-panel-head h2, .panel-head h2 {
  margin: 0;
  font-size: var(--fs-16);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
  line-height: 1.35;
}
.list-head .desc, .detail-head .desc, .auto-panel-head .desc, .panel-head .desc {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: var(--fs-13);
  line-height: 1.45;
}
.list-actions, .detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.pool-tabs { flex: 0 0 auto; }
.item-list, .auto-list, .detail-body, .auto-detail-body, .hist-list, .hist-detail {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}
.item-list, .auto-list {
  padding: 12px;
  background: linear-gradient(180deg, var(--page-soft), transparent 28px);
}
.detail-panel > .empty-state,
.auto-panel > .empty-state,
.list-panel > .empty-state {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.source-spotlight {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 88%, #fff), #fff 58%),
    var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.8);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.source-spotlight-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(168px, 220px);
  gap: 14px 18px;
  align-items: start;
}
.source-spotlight-main { min-width: 0; }
.source-spotlight-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-strong);
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.source-spotlight-title {
  color: var(--text);
  font-size: var(--fs-16);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.4;
  word-break: break-word;
}
.source-spotlight-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.source-spotlight-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: #fff;
  color: var(--accent-strong);
  font-size: var(--fs-12);
  font-weight: 600;
}
.source-spotlight .source-link { margin-top: 0; }
.source-spotlight-side {
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
  border-radius: 12px;
  background: rgba(255,255,255,.78);
  padding: 10px 12px;
  display: grid;
  gap: 10px;
}
.source-side-item { min-width: 0; }
.source-side-label {
  display: block;
  color: var(--muted);
  font-size: var(--fs-11);
  font-weight: 500;
  margin-bottom: 4px;
}
.source-side-value {
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}
.source-heat {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 10%, var(--line-2));
}
.source-heat-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  padding: 10px 10px 11px;
}
.source-heat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.source-heat-label {
  color: var(--muted);
  font-size: var(--fs-11);
  font-weight: 500;
}
.source-heat-value {
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.source-heat-track {
  height: 8px;
  border-radius: 999px;
  background: #e8eef5;
  overflow: hidden;
}
.source-heat-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  min-width: 6%;
  background: linear-gradient(90deg, #93c5fd, #60a5fa 45%, #3b82f6);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.source-heat-item[data-level="0"] .source-heat-fill { background: linear-gradient(90deg, #cbd5e1, #94a3b8); min-width: 4%; }
.source-heat-item[data-level="1"] .source-heat-fill { background: linear-gradient(90deg, #bfdbfe, #60a5fa); }
.source-heat-item[data-level="2"] .source-heat-fill { background: linear-gradient(90deg, #93c5fd, #3b82f6); }
.source-heat-item[data-level="3"] .source-heat-fill { background: linear-gradient(90deg, #67e8f9, #3b82f6 55%, #6366f1); }
.source-heat-item[data-level="4"] .source-heat-fill { background: linear-gradient(90deg, #fde68a, #fb923c 45%, #ef4444); }
@media (max-width: 980px) {
  .source-spotlight-top { grid-template-columns: 1fr; }
  .source-heat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .source-heat { grid-template-columns: 1fr; }
}
.list-item, .auto-ip-item, .auto-title-item, .asset-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 8px;
  text-align: left;
  box-shadow: var(--shadow);
  transition: border-color .14s, background .14s, box-shadow .14s;
  position: relative;
}
.list-item:hover, .auto-ip-item:hover, .auto-title-item:hover, .asset-card:hover {
  border-color: var(--line-strong);
  background: #fcfdff;
  box-shadow: var(--shadow-hover);
}
.list-item:focus-visible, .auto-ip-item:focus-visible, .auto-title-item:focus-visible, .asset-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.list-item.active, .auto-ip-item.active, .auto-title-item.active, .asset-card.active {
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent-soft) 72%, #fff);
  box-shadow: var(--shadow-hover);
}
.list-item.active::before, .auto-ip-item.active::before, .auto-title-item.active::before, .asset-card.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}
.item-title, .auto-title-main {
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
  font-size: var(--fs-14);
}
.item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--fs-12);
}
.metric {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 500;
}
.detail-body, .auto-detail-body { padding: 16px 18px 20px; }
.form-panel, .result-panel, .prompt-panel, .filter-panel, .work-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.result-panel h3, .form-panel h3 {
  margin: 0 0 10px;
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--text);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid .wide { grid-column: 1 / -1; }
.choice-list { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .14s, background .14s, color .14s;
  font-size: var(--fs-13);
}
.choice-item:hover { border-color: var(--line-strong); color: var(--text); }
.choice-item:has(input:checked) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.choice-item input { width: auto; min-height: auto; }
.field-view {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page-soft);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.field-view label {
  display: block;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
  font-size: var(--fs-12);
}
.field-value, .reply, .auto-content {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-weight: 400;
  font-size: var(--fs-14);
  line-height: 1.7;
}
.markdown-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page-soft);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.markdown-panel.wide { grid-column: 1 / -1; }
.markdown-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.markdown-panel-head label {
  color: var(--muted);
  font-weight: 500;
  font-size: var(--fs-12);
}
.markdown-body {
  color: var(--text);
  font-size: var(--fs-14);
  line-height: 1.78;
  word-break: break-word;
}
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 {
  margin: 16px 0 8px;
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
}
.markdown-body h1 { font-size: 22px; }
.markdown-body h2 { font-size: 18px; }
.markdown-body h3 { font-size: 16px; }
.markdown-body h4, .markdown-body h5, .markdown-body h6 { font-size: 14px; }
.markdown-body p { margin: 0 0 10px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 10px 1.4em; padding: 0; }
.markdown-body li { margin: 3px 0; }
.markdown-body blockquote {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--accent-border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 8px;
}
.markdown-body pre {
  margin: 0 0 10px;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.markdown-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.markdown-body hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.markdown-body .markdown-table-wrap {
  overflow-x: auto;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 13px;
}
.markdown-body th,
.markdown-body td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
}
.markdown-body th:last-child,
.markdown-body td:last-child { border-right: 0; }
.markdown-body tr:last-child td { border-bottom: 0; }
.markdown-body th {
  background: rgba(15, 23, 42, 0.04);
  font-weight: 600;
  color: var(--text);
}
.markdown-empty { color: var(--faint); }
.empty-state {
  padding: 58px 20px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-13);
}
.empty-state b {
  display: block;
  color: var(--text);
  font-size: var(--fs-16);
  font-weight: 600;
  margin-bottom: 6px;
}
.mode-tabs, .pool-tabs, .soft-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.72);
  box-shadow: var(--shadow);
}
.mode-tab, .pool-tab, .soft-tab {
  min-height: 34px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 500;
  font-size: var(--fs-13);
  cursor: pointer;
  transition: background .14s, color .14s, box-shadow .14s;
}
.mode-tab:hover, .pool-tab:hover, .soft-tab:hover { color: var(--text); background: var(--surface-2); }
.mode-tab:focus-visible, .pool-tab:focus-visible, .soft-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.mode-tab.active, .pool-tab.active, .soft-tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}
.source-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: var(--fs-13);
}
.version-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
}
.detail-actions .version-tabs,
.auto-panel-head .version-tabs {
  margin: 0;
}
.version-tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 5px 10px;
  font-size: var(--fs-12);
  font-weight: 500;
  cursor: pointer;
  transition: border-color .14s, background .14s, color .14s, box-shadow .14s;
}
.version-tab:hover { border-color: var(--line-strong); color: var(--text); }
.version-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.version-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-strong);
  font-weight: 600;
}

@media (max-width: 980px) {
  html:has(body:has(.workspace)),
  html:has(body:has(.auto-workspace)),
  html:has(body:has(.layout)),
  body:has(.workspace),
  body:has(.auto-workspace),
  body:has(.layout) {
    height: auto;
    overflow: auto;
  }
  .content-page:has(.workspace),
  .content-page:has(.auto-workspace),
  .content-page:has(.layout) {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .workspace, .auto-workspace {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
    flex: none;
  }
  .list-panel, .detail-panel, .auto-panel, .work-panel {
    height: auto;
    max-height: none;
  }
  .item-list, .auto-list, .detail-body, .auto-detail-body {
    max-height: min(60vh, 520px);
  }
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   子标签（配置台）
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.tab {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 13.5px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.tab:hover              { color: var(--text); }
.tab.active             { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab:disabled           { opacity: .4; cursor: not-allowed; }
.tab:disabled:hover     { color: var(--muted); }
.tabview                { display: none; }
.tabview.active         { display: block; }

/* ============================================================
   供应商 / 节点
   ============================================================ */
.provider {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--surface);
}
.provider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.models-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.models-list input { min-height: 34px; width: 200px; }
.node-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.node-row:last-child { border-bottom: 0; }
.node-row select { max-width: 480px; }
.node-row .fallback-select { border-color: var(--line); background: var(--surface-2); }
.key-field { position: relative; }
.key-field input { padding-right: 64px; }
.key-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

/* ============================================================
   测试调用
   ============================================================ */
.test-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.test-row select { max-width: 480px; }
.reply {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface-2);
  white-space: pre-wrap;
  min-height: 40px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-mono);
}
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs img {
  width: 80px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.thumbs img:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ============================================================
   素材表
   ============================================================ */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.asset-name {
  font-weight: 600;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asset-meta {
  color: var(--faint);
  font-size: 12px;
  margin-top: 3px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.thumb {
  position: relative;
  width: 104px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  background: #1a1a1a;
  cursor: pointer;
  transition: transform .15s;
}
.thumb:hover { transform: scale(1.02); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

/* ============================================================
   阶段 stepper
   ============================================================ */
.stepper {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}
.step {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 12px 14px;
  background: var(--surface);
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.step:hover   { border-color: var(--line-strong); }
.step.active  { border-color: var(--accent); background: var(--accent-soft); }
.step.done    { background: var(--surface); }
.step.todo    { opacity: .55; }
.step-ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex: 0 0 auto;
  transition: background .15s, color .15s;
}
.step.active .step-ico { background: var(--accent); color: #fff; }
.step.done   .step-ico { background: var(--green-bg); color: var(--green); }
.step-body   { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-body strong { font-size: 13.5px; font-weight: 600; color: var(--text); }
.step-body span   {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.step-arrow {
  display: flex;
  align-items: center;
  color: var(--faint);
  font-size: 14px;
}
.parallel {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-card);
  padding: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.parallel-tag {
  position: absolute;
  top: -10px;
  left: 12px;
  background: var(--page);
  padding: 0 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.stage-content { margin-top: 16px; }

/* ============================================================
   宫格
   ============================================================ */
.grid-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.grid-card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
  background: #1a1a1a;
  transition: border-color .15s, transform .15s;
}
.grid-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.grid-card img   { width: 100%; display: block; cursor: zoom-in; }
.grid-cap {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
}
.seg-head {
  grid-column: 1 / -1;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

/* ============================================================
   弹窗 / 灯箱 · 浮层阴影
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  animation: fade-in-up 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface);
  border-radius: var(--r-card);
  width: min(900px, 96vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.modal-body   { padding: 20px 22px; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 80;
  animation: fade-in 120ms ease both;
}
.lightbox[hidden] { display: none; }
.lightbox img, .lightbox video {
  max-width: 94vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.lightbox .lb-close {
  position: absolute;
  top: 18px;
  right: 24px;
  color: #fff;
  font-size: 28px;
  background: transparent;
  border: 0;
}

/* ============================================================
   历史记录
   ============================================================ */
.hist-item {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color .15s, background .15s;
}
.hist-item:hover  { border-color: var(--line-strong); background: var(--surface-2); }
.hist-item.active { border-color: var(--accent); background: var(--accent-soft); }
.hist-folder {
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
  font-size: 13.5px;
}
.hist-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}