* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6fb;
  --bg2: #fbfcff;
  --panel: #ffffff;
  --panel2: #f0f3fa;
  --border: #e3e8f2;
  --text: #1d2538;
  --muted: #6b7690;
  --brand: #4f6ef7;
  --brand2: #8b5cf6;
  --ok: #12946c;
  --warn: #c78100;
  --danger: #e5484d;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(31, 43, 81, .06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ------------------------------------------------------------ topbar */
.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: linear-gradient(100deg, #ffffff 0%, #fafbff 60%, #fdf9ff 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(31, 43, 81, .04);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff;
  box-shadow: 0 4px 14px rgba(79,110,247,.28);
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.project-select {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; min-width: 190px; font-size: 13px; outline: none;
}
.project-select:focus { border-color: var(--brand); }

/* ------------------------------------------------------------ buttons */
.btn {
  border: none; border-radius: 8px; padding: 9px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: .18s ease; font-family: inherit; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; box-shadow: 0 3px 10px rgba(79,110,247,.22); }
.btn-secondary { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--brand); border-color: var(--brand); }
.btn-danger { background: #fff1f1; color: var(--danger); border: 1px solid #f6c9cb; }
/* 方案与任务张数不一致时的同步按钮：琥珀色，和主色「一键出图」区分开 */
.btn-sync { background: #fff7e6; color: #9a6410; border: 1px solid #f0d59b; font-weight: 600; }
.btn-sync:hover { border-color: #dfb45e; color: #7d4f07; box-shadow: 0 3px 10px rgba(196,132,26,.16); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.icon-btn:hover { color: var(--text); }

/* ------------------------------------------------------------ layout */
.layout { display: flex; min-height: calc(100vh - 66px); }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--border); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 66px; height: calc(100vh - 66px);
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 13px; border: none; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13.5px; text-align: left; font-family: inherit;
  transition: .16s;
}
.nav-item:hover { background: var(--panel2); color: var(--text); }
.nav-item.active { background: linear-gradient(100deg, #eaeefe, #f3edff); color: var(--brand); font-weight: 600; }
.nav-icon { width: 22px; height: 22px; border-radius: 6px; background: var(--panel2); display: grid; place-items: center; font-size: 12px; color: var(--brand); }
.nav-item.active .nav-icon { background: #fff; }
.nav-badge { margin-left: auto; background: var(--panel2); color: var(--muted); font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.sidebar-foot { margin-top: auto; padding: 16px 13px 4px; border-top: 1px solid var(--border); }
.flow-label { font-size: 11px; color: var(--muted); margin-bottom: 10px; letter-spacing: 1px; }
.flow-step { font-size: 12px; color: var(--muted); margin-bottom: 7px; display: flex; gap: 8px; align-items: center; }
.flow-step b { width: 17px; height: 17px; border-radius: 5px; background: var(--panel2); color: var(--brand); display: grid; place-items: center; font-size: 10px; }

.main { flex: 1; padding: 26px 30px 60px; min-width: 0; max-width: 1400px; }
.page { display: none; }
.page.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ 出图进度面板 */
.gen-progress {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 20px;
}
.gp-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.gp-title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 15px; min-width: 0; }
.gp-title b { color: var(--text); }
.gp-summary { font-size: 13px; color: var(--muted); }
.gp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.gp-spinner {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid var(--border); border-top-color: var(--brand);
  animation: gp-spin .8s linear infinite;
}
.gp-spinner.hidden { display: none; }
@keyframes gp-spin { to { transform: rotate(360deg); } }
.gp-bar { height: 7px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.gp-bar-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand2)); transition: width .35s ease; }

/* ------------------------------------------------------------ AI 长任务进度浮层 */
.ai-busy {
  position: fixed; left: 50%; bottom: 78px; transform: translate(-50%, 14px);
  z-index: 45; width: min(520px, calc(100vw - 32px));
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
.ai-busy.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.ab-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 34px rgba(24, 34, 56, .16); padding: 14px 16px 13px;
}
.ab-top { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.ab-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ab-text b { font-size: 13.5px; color: var(--text); }
.ab-text span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-timer {
  font-size: 12px; font-weight: 700; color: var(--brand);
  background: var(--panel2); border-radius: 99px; padding: 3px 10px; flex: none;
  font-variant-numeric: tabular-nums;
}
.ab-bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-bottom: 9px; }
.ab-bar-fill {
  height: 100%; width: 38%; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  animation: ab-slide 1.25s ease-in-out infinite;
}
@keyframes ab-slide {
  0%   { transform: translateX(-102%); }
  100% { transform: translateX(268%); }
}
.ab-hint { font-size: 11.5px; color: var(--muted); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.gp-list { display: grid; gap: 8px; }
.gp-row {
  display: grid; grid-template-columns: 64px 1fr auto auto; align-items: center; gap: 12px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg2);
  font-size: 13px; animation: fade .2s ease;
}
.gp-row .gp-code { font-weight: 700; color: var(--muted); font-size: 12px; white-space: nowrap; }
.gp-row .gp-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-row .gp-time { color: var(--muted); font-size: 12px; }
.gp-status { font-size: 12px; font-weight: 600; padding: 3px 12px; border-radius: 99px; white-space: nowrap; }
.gp-status.wait { background: var(--panel2); color: var(--muted); }
.gp-status.running { background: rgba(79,110,247,.12); color: var(--brand); }
.gp-status.ok { background: rgba(18,148,108,.12); color: var(--ok); }
.gp-status.fail { background: rgba(229,72,77,.1); color: var(--danger); }
.gp-row.fail-row { border-color: rgba(229,72,77,.35); background: rgba(229,72,77,.04); }
.gp-status.skip { background: rgba(199,129,0,.13); color: var(--warn); }
.gp-row.skip-row { border-style: dashed; }
.gp-err { grid-column: 1 / -1; color: var(--danger); font-size: 12px; line-height: 1.5; word-break: break-all; padding-top: 4px; border-top: 1px dashed rgba(229,72,77,.25); }

/* 标题与操作区：空间不够时按钮整体换到下一行，绝不横向溢出 */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 20px; margin-bottom: 22px; }
.page-head > div:first-child { flex: 1 1 260px; min-width: 0; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: .3px; }
.page-desc { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.head-actions {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
  row-gap: 8px; margin-left: auto; min-width: 0; max-width: 100%;
}
.head-actions > .btn, .head-actions > .gen-scope { flex: 0 0 auto; }

/* ------------------------------------------------------------ cards */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 9px; }
.card-title small { font-weight: 400; color: var(--muted); font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 3px; background: var(--brand); display: inline-block; box-shadow: 0 0 0 4px rgba(79,110,247,.12); }
.dot.purple { background: var(--brand2); box-shadow: 0 0 0 4px rgba(139,92,246,.12); }
.dot.teal { background: #14b8a6; box-shadow: 0 0 0 4px rgba(20,184,166,.12); }
.dot.orange { background: var(--warn); box-shadow: 0 0 0 4px rgba(199,129,0,.12); }
.dot.red { background: var(--danger); box-shadow: 0 0 0 4px rgba(229,72,77,.12); }

/* ------------------------------------------------------------ form */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.span2 { grid-column: span 2; }
/* 表单里的分组分隔（如网站 SEO 里的「登录页」） */
.seo-sub { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  margin: 6px 0 -2px; padding-top: 12px; border-top: 1px dashed var(--border); }
.seo-sub span { font-size: 12px; font-weight: 700; color: var(--text); }
.seo-sub small { font-size: 10.5px; color: var(--muted); }
.field > span { font-size: 12px; color: var(--muted); }
.field em { font-style: normal; color: var(--brand); font-size: 11px; margin-left: 4px; }
.field em.warn { color: var(--danger); }
.field input, .field textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--text);
  font-size: 13px; font-family: inherit; outline: none; resize: vertical;
  transition: .16s;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(79,110,247,.1); }
.field input::placeholder, .field textarea::placeholder { color: #a2abc0; }

/* ------------------------------------------------------------ upload */
.upload-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.upload-box { background: var(--bg2); border: 1px dashed #cdd5e6; border-radius: 10px; padding: 14px; min-height: 176px; display: flex; flex-direction: column; }
.upload-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.upload-head span { color: var(--muted); font-size: 11px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 7px; flex: 1; align-content: flex-start; }
.thumb { position: relative; width: 58px; height: 58px; border-radius: 7px; overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 1px; right: 1px; width: 17px; height: 17px; border: none; border-radius: 4px; background: rgba(29,37,56,.72); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; }
.upload-btn { display: block; text-align: center; padding: 8px; border: 1px solid var(--border); border-radius: 7px; color: var(--brand); font-size: 12px; cursor: pointer; margin-top: 10px; background: #fff; }
.upload-btn:hover { border-color: var(--brand); background: #f3f6ff; }
.upload-btn input { display: none; }

.sticky-actions { display: flex; gap: 10px; align-items: center; padding: 14px 0 6px; flex-wrap: wrap; }
.save-hint { color: var(--ok); font-size: 12px; margin-left: 8px; }

/* ------------------------------------------------------------ empty */
.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-icon { font-size: 38px; color: var(--brand); opacity: .55; margin-bottom: 12px; }
.empty-state h2 { color: var(--text); font-size: 17px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 18px; }

/* ------------------------------------------------------------ tasks */
.group-head { display: flex; align-items: center; gap: 10px; margin: 24px 0 12px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .5px; }
.group-head::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.task-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; box-shadow: var(--shadow); }
.task-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.task-head > div { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.task-code { background: #edf1ff; color: var(--brand); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px; letter-spacing: .4px; flex: 0 0 auto; white-space: nowrap; }
.task-title { font-weight: 700; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.task-meta { display: flex; gap: 8px; align-items: center; }
.status-pill { font-size: 11px; padding: 3px 9px; border-radius: 10px; border: 1px solid var(--border); color: var(--muted); background: var(--bg2);
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; flex: 0 0 auto;
  line-height: 1.5; min-width: 56px; }
.status-pill.done { color: var(--ok); border-color: #b9e3d3; background: #eefaf5; }
.status-pill.rework { color: var(--warn); border-color: #f0d9a8; background: #fff8e9; }
.status-pill.pass { color: var(--ok); border-color: #b9e3d3; background: #eefaf5; }
.task-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.task-field { display: flex; flex-direction: column; gap: 6px; }
.task-field > span { font-size: 11px; color: var(--muted); }
.task-field textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 7px;
  padding: 9px 11px; color: var(--text); font-size: 12.5px; font-family: inherit;
  outline: none; resize: vertical; min-height: 64px; line-height: 1.55;
}
.task-field textarea:focus { border-color: var(--brand); background: #fff; }
.task-field.ru textarea { border-color: #d9cdfb; background: #faf8ff; }

/* 每张任务独立的图上文字样式（字体/字号/颜色） */
.text-style-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin: 2px 0 12px; padding: 9px 12px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
}
.text-style-row .ts-label {
  font-size: 11px; font-weight: 700; color: var(--brand);
  padding-right: 10px; border-right: 1px solid var(--border);
}
.text-style-row label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.text-style-row select, .text-style-row input[type="text"] {
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 12px; font-family: inherit;
  padding: 4px 7px; outline: none;
}
.text-style-row select:focus, .text-style-row input[type="text"]:focus { border-color: var(--brand); }
.text-style-row select { min-width: 92px; }
.ts-color { display: inline-flex; align-items: center; gap: 5px; }
.ts-color input[type="color"] {
  width: 26px; height: 24px; padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; background: var(--panel);
}
.ts-color input[type="text"] { width: 92px; }
.text-style-row > small { font-size: 10.5px; color: var(--muted); margin-left: auto; }
/* 图上文字：位置九宫格 + 实时示意预览 */
.ts-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 18px; margin: -2px 0 12px; }
.ts-pos-wrap, .ts-preview-wrap { display: flex; flex-direction: column; gap: 6px; }
.ts-sub { font-size: 11px; color: var(--muted); font-weight: 600; }
.ts-sub b { color: var(--brand); font-weight: 700; }
.ts-sub small { display: block; font-size: 10px; line-height: 1.5; font-weight: 400; max-width: 350px; }
.ts-pos-grid {
  display: grid; grid-template-columns: repeat(3, 24px); gap: 4px; width: max-content;
  padding: 5px; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
}
.ts-pos-btn {
  position: relative; width: 24px; height: 24px; padding: 0; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: 5px;
}
.ts-pos-btn:hover { border-color: var(--brand); }
.ts-pos-btn i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #b9bfd0; transform: translate(-50%, -50%); }
.ts-pos-btn.active { background: #efeaff; border-color: var(--brand); }
.ts-pos-btn.active i { background: var(--brand); }
.ts-pos-btn[data-pos="top-left"] i { left: 22%; top: 22%; }
.ts-pos-btn[data-pos="top-center"] i { left: 50%; top: 22%; }
.ts-pos-btn[data-pos="top-right"] i { left: 78%; top: 22%; }
.ts-pos-btn[data-pos="middle-left"] i { left: 22%; top: 50%; }
.ts-pos-btn[data-pos="center"] i { left: 50%; top: 50%; }
.ts-pos-btn[data-pos="middle-right"] i { left: 78%; top: 50%; }
.ts-pos-btn[data-pos="bottom-left"] i { left: 22%; top: 78%; }
.ts-pos-btn[data-pos="bottom-center"] i { left: 50%; top: 78%; }
.ts-pos-btn[data-pos="bottom-right"] i { left: 78%; top: 78%; }
.ts-pos-auto {
  align-self: flex-start; cursor: pointer; padding: 4px 9px; font-size: 10.5px;
  background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: 6px;
}
.ts-pos-auto.active { color: var(--brand); border-color: var(--brand); background: #f4f0ff; font-weight: 700; }
.ts-preview {
  position: relative; width: 216px; aspect-ratio: 4/3; overflow: hidden;
  border: 1px solid var(--border); border-radius: 8px;
  background: linear-gradient(135deg, #202744, #3b4468);
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.ts-preview.has-img { background-color: #eef1f7; }
.ts-preview-anchor { position: absolute; max-width: 92%; text-align: center; }
.ts-preview-anchor.pos-top-left { left: 6%; top: 14%; transform: translate(0, 0); }
.ts-preview-anchor.pos-top-center { left: 50%; top: 14%; transform: translate(-50%, 0); }
.ts-preview-anchor.pos-top-right { left: 94%; top: 14%; transform: translate(-100%, 0); }
.ts-preview-anchor.pos-middle-left { left: 6%; top: 50%; transform: translate(0, -50%); }
.ts-preview-anchor.pos-center { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ts-preview-anchor.pos-middle-right { left: 94%; top: 50%; transform: translate(-100%, -50%); }
.ts-preview-anchor.pos-bottom-left { left: 6%; top: 86%; transform: translate(0, -100%); }
.ts-preview-anchor.pos-bottom-center { left: 50%; top: 86%; transform: translate(-50%, -100%); }
.ts-preview-anchor.pos-bottom-right { left: 94%; top: 86%; transform: translate(-100%, -100%); }
.ts-preview-text {
  display: inline-block; max-width: 100%; line-height: 1.15; overflow-wrap: anywhere;
  color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 8px rgba(0, 0, 0, .7);
}
.ts-preview-text.dir-vertical { transform: rotate(-90deg); white-space: nowrap; }
.ts-preview-text.dir-stacked { writing-mode: vertical-rl; text-orientation: upright; letter-spacing: 2px; white-space: nowrap; }
.ts-preview-text.dir-diagonal-up { transform: rotate(-45deg); white-space: nowrap; }
.ts-preview-text.dir-diagonal-down { transform: rotate(45deg); white-space: nowrap; }
/* 艺术字体：预览用 CSS 近似模拟，最终效果由 AI 按提示词还原 */
.ts-preview-text.fx-calligraphy { font-style: italic; letter-spacing: .5px; }
.ts-preview-text.fx-display { letter-spacing: 1px; text-transform: uppercase; }
.ts-preview-text.fx-neon { text-shadow: 0 0 3px #fff, 0 0 10px currentColor, 0 0 22px currentColor; }
.ts-preview-text.fx-metal { text-shadow: 0 1px 0 rgba(255,255,255,.85), 1px 2px 0 rgba(90,90,100,.9), 2px 3px 4px rgba(0,0,0,.65); }
.ts-preview-text.fx-retro { text-shadow: 2px 2px 0 rgba(0,0,0,.5); letter-spacing: 1px; }
.ts-preview-text.fx-graffiti { font-style: italic; letter-spacing: -1px; text-shadow: 1px 1px 0 rgba(0,0,0,.7); }
/* 电商常用风格 */
.ts-preview-text.fx-promo { letter-spacing: -.5px; text-shadow: 2px 2px 0 rgba(0,0,0,.85), -1px -1px 0 rgba(0,0,0,.55); }
.ts-preview-text.fx-cute { font-weight: 700; letter-spacing: .5px; }
.ts-preview-text.fx-luxury { font-weight: 400; letter-spacing: 4px; text-transform: uppercase; }
.ts-preview-text.fx-guochao { font-weight: 700; text-shadow: 1px 2px 0 rgba(0,0,0,.45); }
.ts-preview-text.fx-tech { letter-spacing: 2px; text-transform: uppercase; text-shadow: 0 0 6px currentColor; }
.ts-preview-text.fx-bubble { font-weight: 700; text-shadow: 0 3px 0 rgba(0,0,0,.18), 0 7px 12px rgba(0,0,0,.35); }
@media (max-width: 760px) {
  .text-style-row > small { margin-left: 0; width: 100%; }
  .ts-preview { width: 100%; max-width: 260px; }
}
.reflist { font-size: 11px; color: var(--muted); margin-top: 4px; }
.audit { margin-top: 6px; }
.audit > span { font-size: 11px; color: var(--muted); display: block; margin-bottom: 6px; }
.audit ul { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; }
.audit li { font-size: 11.5px; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 9px; color: var(--muted); }

/* ------------------------------------------------------------ gallery */
.gallery-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 14px; }
.gallery-item { background: var(--panel); border: 1px solid var(--border); border-radius: 11px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.gallery-top { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gallery-title { font-size: 12.5px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.gallery-img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #eef1f7; display: block; }
.gallery-placeholder { width: 100%; aspect-ratio: 4/3; background: #f2f4fa; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 20px; }
.gallery-ru { padding: 8px 14px; font-size: 11.5px; color: var(--brand2); min-height: 32px; }
.gallery-actions { padding: 0 14px 14px; display: flex; gap: 7px; flex-wrap: wrap; }
.review-note { padding: 0 14px 12px; }
.review-note input { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; color: var(--text); font-size: 12px; outline: none; font-family: inherit; }
.btn-pass { background: #eefaf5; color: var(--ok); border: 1px solid #b9e3d3; }
.btn-rework { background: #fff8e9; color: var(--warn); border: 1px solid #f0d9a8; }

/* ------------------------------------------------------------ export */
.stats { display: flex; gap: 26px; flex-wrap: wrap; }
.stat { min-width: 90px; }
.stat b { display: block; font-size: 26px; font-weight: 700; background: linear-gradient(135deg, var(--brand), var(--brand2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 11px; color: var(--muted); }
.export-grid { display: flex; flex-direction: column; gap: 10px; }
.export-item { display: flex; align-items: center; gap: 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: 9px; padding: 14px; }
.export-item > div:nth-child(2) { flex: 1; }
.export-item b { font-size: 13px; }
.export-item p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.export-icon { width: 36px; height: 36px; border-radius: 9px; background: #edf1ff; color: var(--brand); display: grid; place-items: center; font-size: 16px; }
.howto { padding-left: 20px; color: var(--muted); font-size: 12.5px; }
.howto li { margin-bottom: 8px; }
.howto b { color: var(--text); }
.note { color: var(--muted); font-size: 11.5px; margin-top: 12px; }
.danger-card { border-color: #f6d3d5; }

/* ------------------------------------------------------------ history */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { border: 1px solid var(--border); border-radius: 9px; padding: 11px 13px; background: var(--bg2); }
.history-item.current { border-color: #b9e3d3; background: #f4fbf8; }
.history-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.history-time { font-size: 12.5px; font-weight: 600; }
.history-name { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.history-fields { margin-top: 8px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px 14px; font-size: 11.5px; color: var(--muted); }
.history-fields span b { color: var(--text); font-weight: 500; }
.history-tag { font-size: 10.5px; padding: 2px 8px; border-radius: 10px; background: #eefaf5; color: var(--ok); border: 1px solid #b9e3d3; }

/* ------------------------------------------------------------ modal / toast */
.modal { position: fixed; inset: 0; background: rgba(29, 37, 56, .42); display: none; place-items: center; z-index: 50; padding: 20px; }
.modal.show { display: grid; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: min(720px,100%); max-height: 85vh; overflow: auto; box-shadow: 0 20px 60px rgba(31,43,81,.18); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 20px 22px 24px; color: var(--muted); font-size: 13px; }
.modal-body p { margin-bottom: 12px; }
.field-select {
  width: 100%; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--text);
  font-size: 13px; font-family: inherit; outline: none;
}
.field-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,110,247,.1); }
.field-hint { color: var(--muted); font-size: 11px; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-bar { margin-bottom: 10px; }
.preset-note { font-size: 12px; color: var(--muted); min-height: 20px; margin-bottom: 8px; }
.preset-note b { color: var(--brand); }
.preset-detail { margin-top: 10px; }
.preset-detail summary { cursor: pointer; color: var(--brand); font-size: 12px; padding: 6px 0; outline: none; }
.preset-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px,1fr)); gap: 8px; margin-top: 8px; }
.preset-item {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; text-align: left; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; gap: 4px; transition: .15s;
}
.preset-item:hover { border-color: var(--brand); background: #f3f6ff; }
.preset-item b { font-size: 12.5px; color: var(--text); }
.preset-item span { font-size: 11px; color: var(--muted); line-height: 1.5; }
.preset-item code { font-size: 10px; color: var(--brand2); word-break: break-all; }
.platform-spec { margin-top: 10px; }
.platform-spec-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px; }
.platform-spec-grid > div { font-size: 12px; }
.platform-spec-grid span { color: var(--muted); }
.platform-spec-grid b { color: var(--text); font-weight: 600; }
.platform-spec-note { margin-top: 10px; padding: 9px 12px; background: #fff8e9; border: 1px solid #f0d9a8; border-radius: 7px; font-size: 11.5px; color: #8a6200; }
code { background: var(--bg2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 11.5px; color: var(--brand); }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 10px 20px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; box-shadow: 0 8px 30px rgba(31,43,81,.16); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------ 商品列表页 */
.product-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.product-search {
  flex: 1; min-width: 220px; padding: 10px 14px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--panel);
  color: var(--text); outline: none;
}
.product-search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,110,247,.1); }
.product-toolbar .field-select { width: auto; min-width: 130px; }
.product-count { font-size: 13px; color: var(--muted); margin-left: auto; }

.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 18px;
}
.product-noresult { grid-column: 1/-1; text-align: center; padding: 50px; color: var(--muted); }

.product-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(31,43,81,.12); border-color: #c4cffb; }
.product-card.is-current { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(79,110,247,.14), var(--shadow); }

.pcover { position: relative; width: 100%; height: 172px; background: var(--panel2); overflow: hidden; }
.pcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcover-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 46px; color: #c3cce0;
}
.pstatus {
  position: absolute; top: 10px; left: 10px; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 10px; background: rgba(255,255,255,.94);
  color: var(--muted); border: 1px solid var(--border);
}
.pstatus.new { color: var(--muted); }
.pstatus.ready { color: var(--brand); border-color: #c4cffb; background: #eef1ff; }
.pstatus.generating { color: var(--brand2); border-color: #d9c9fb; background: #f5efff; }
.pstatus.review { color: #0e8f8f; border-color: #a9e0e0; background: #eafafa; }
.pstatus.rework { color: var(--warn); border-color: #f0d9a8; background: #fff8e9; }
.pstatus.done { color: var(--ok); border-color: #b9e3d3; background: #eefaf5; }
.pcurrent {
  position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 10px; color: #fff; background: var(--brand);
}

.pbody { padding: 14px 16px 12px; }
.ptitle { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmeta { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptags { display: flex; gap: 6px; margin: 10px 0 12px; flex-wrap: wrap; }
.ptag { font-size: 11px; padding: 2px 8px; border-radius: 8px; background: var(--panel2); color: var(--muted); }
.ptag.demo { background: rgba(79, 110, 247, .12); color: var(--brand); font-weight: 600; }
.pprogress { margin-bottom: 6px; }
.pp-bar { height: 6px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.pp-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand2)); border-radius: 4px; transition: width .3s; }
.pp-text { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; }
.pp-text em { color: var(--warn); font-style: normal; }
.pfoot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.ptime { font-size: 11px; color: #9aa5bd; }
.pactions { display: flex; gap: 2px; }
.pactions .icon-btn { font-size: 16px; padding: 2px 6px; border-radius: 6px; }
.pactions .icon-btn:hover { background: var(--panel2); }
.pactions .icon-btn.danger:hover { color: var(--danger); background: #fdecec; }

@media (max-width: 900px) {
  .sidebar { width: 62px; padding: 12px 6px; }
  .nav-item span:not(.nav-icon) { display: none; }
  .nav-badge, .sidebar-foot { display: none; }
  .form-grid, .task-row, .history-fields { grid-template-columns: 1fr; }
  .field.span2 { grid-column: span 1; }
  .upload-grid { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 50px; }
  .page-head { flex-direction: column; }
  .page-head > div:first-child { flex: 0 0 auto; width: 100%; min-width: 0; }
  .head-actions { width: 100%; justify-content: flex-start; margin-left: 0; }
  .product-grid { grid-template-columns: 1fr; }
  .product-count { margin-left: 0; }
}

/* 窄屏：顶栏收紧，避免项目下拉 + 按钮把页面撑出横向滚动 */
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 10px; height: 58px; }
  .layout { min-height: calc(100vh - 58px); }
  .sidebar { top: 58px; height: calc(100vh - 58px); }
  .brand { gap: 8px; min-width: 0; }
  .brand-mark { width: 32px; height: 32px; font-size: 13px; border-radius: 9px; }
  .brand > div:last-child { display: none; }        /* 只留 logo，标题文字隐藏 */
  .top-actions { flex: 1 1 auto; min-width: 0; gap: 6px; justify-content: flex-end; }
  .project-select { min-width: 0; flex: 1 1 80px; max-width: 150px; padding: 7px 8px; font-size: 12px; }
  .top-actions > .btn-ghost { display: none; }      /* 新建商品入口在「商品列表」页仍有 */
  .token-chip { padding: 5px 8px; font-size: 11px; gap: 3px; }
  .token-chip b { font-size: 12.5px; }
  .daily-chip { display: none !important; }
  .user-chip { padding: 4px; gap: 0; }
  .user-name, .user-caret { display: none; }        /* 只留头像 */
  .user-avatar { width: 28px; height: 28px; }
}

/* ------------------------------------------------------------ 多用户 / 管理端 */
.brand-mark.admin { background:linear-gradient(135deg,#34456f,#4f6df5); }
.token-chip {
  display:inline-flex; align-items:center; gap:5px; padding:6px 11px; border-radius:9px;
  background:#eef2ff; color:#3d54c8; font-size:12.5px; font-weight:700; white-space:nowrap;
}
.token-chip b { font-size:14px; }
/* 用户菜单 */
.user-menu { position:relative; }
.user-chip {
  display:inline-flex; align-items:center; gap:8px;
  padding:5px 10px 5px 5px; border-radius:999px;
  background:var(--panel2); color:var(--text); white-space:nowrap;
  border:1px solid transparent; cursor:pointer; font-family:inherit;
  font-size:12.5px; font-weight:600; transition:.16s ease;
}
.user-chip:hover { background:var(--bg2); border-color:var(--border); }
.user-chip[aria-expanded="true"] { background:#fff; border-color:var(--brand); box-shadow:0 0 0 3px rgba(79,110,247,.12); }
.user-avatar {
  width:26px; height:26px; border-radius:50%; flex:none;
  display:grid; place-items:center; color:#fff; font-size:12px; font-weight:700;
  background:linear-gradient(135deg,var(--brand),var(--brand2));
}
.user-name { max-width:110px; overflow:hidden; text-overflow:ellipsis; }
.user-caret { font-size:9px; color:var(--muted); transition:.16s ease; }
.user-chip[aria-expanded="true"] .user-caret { transform:rotate(180deg); }
.user-drop {
  position:absolute; right:0; top:calc(100% + 8px); width:230px; padding:6px;
  background:var(--panel); border:1px solid var(--border); border-radius:12px;
  box-shadow:0 16px 40px rgba(31,43,81,.14); z-index:60;
  animation:udIn .14s ease;
}
.user-drop[hidden] { display:none; }
@keyframes udIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }
.ud-head { display:flex; align-items:center; gap:9px; padding:7px 9px 10px; margin-bottom:5px; border-bottom:1px solid var(--border); }
.ud-avatar {
  width:30px; height:30px; border-radius:50%; flex:none;
  display:grid; place-items:center; color:#fff; font-size:13px; font-weight:700;
  background:linear-gradient(135deg,var(--brand),var(--brand2));
}
.ud-head b { display:block; font-size:13px; line-height:1.35; color:var(--text); }
.ud-role { display:block; font-size:11px; color:var(--muted); }
.ud-item {
  width:100%; display:flex; align-items:center; gap:9px; padding:9px 10px;
  border:0; border-radius:8px; background:none; cursor:pointer; text-align:left;
  font-family:inherit; font-size:13px; color:var(--text);
}
.ud-item:hover { background:var(--panel2); }
.ud-ico { width:16px; flex:none; text-align:center; font-size:13px; color:var(--muted); }
.ud-item:hover .ud-ico { color:var(--brand); }
.ud-badge { margin-left:auto; padding:1px 7px; border-radius:999px; background:#eef2ff; color:var(--brand); font-size:10px; font-weight:600; }
.ud-sep { height:1px; margin:5px 4px; background:var(--border); }
.ud-danger { color:var(--danger); }
.ud-danger .ud-ico { color:var(--danger); }
.ud-danger:hover { background:#fff1f1; }
.blocked-banner {
  display:flex; gap:12px; align-items:center; padding:12px 22px; margin:0;
  background:#fff6e5; border-bottom:1px solid #f0d9a8; color:#8a6420; font-size:13px;
}
.blocked-banner b { color:#a35b00; }

/* 数据表 */
.table-wrap { overflow-x:auto; }
.data-table { width:100%; border-collapse:collapse; font-size:13px; }
.data-table th {
  text-align:left; padding:11px 12px; background:var(--panel2); color:var(--muted);
  font-weight:600; font-size:12px; white-space:nowrap; border-bottom:1px solid var(--border);
}
.data-table td { padding:11px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
.data-table tr:last-child td { border-bottom:0; }
.data-table tbody tr:hover { background:#fafbff; }
.empty-td { text-align:center; color:var(--muted); padding:30px !important; }
.muted { color:#9aa5bd; }
.tag-mini {
  display:inline-block; font-size:10px; padding:1px 6px; border-radius:6px;
  background:#eef1ff; color:var(--brand); font-weight:700;
}
.op-cells { white-space:nowrap; }
.op-cells .btn { margin:2px 3px 2px 0; }
.detail-cell { max-width:420px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); }
.token-num { font-size:15px; color:var(--brand); }
.token-cost { color:var(--warn); }
.toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.toolbar .product-search { flex:1; min-width:200px; }
.action-tag {
  display:inline-block; font-size:11.5px; padding:3px 9px; border-radius:8px;
  background:var(--panel2); color:var(--muted);
}
.action-tag.cost { background:#fff4e4; color:#a8701c; }

/* TOKEN / 统计 */
.cost-strip { display:flex; flex-wrap:wrap; gap:12px; }
.cost-item {
  min-width:130px; padding:12px 16px; border:1px solid var(--border); border-radius:12px;
  background:var(--panel2);
}
.cost-item span { display:block; font-size:12px; color:var(--muted); }
.cost-item b { display:block; font-size:20px; color:var(--brand); margin-top:4px; }
.action-bars { width:100%; display:flex; flex-direction:column; gap:9px; }
.action-row { display:flex; align-items:center; gap:12px; font-size:12.5px; }
.action-row > span { width:100px; color:var(--muted); }
.action-row > b { width:42px; text-align:right; color:var(--text); }
.ab-bar { flex:1; height:9px; background:var(--panel2); border-radius:6px; overflow:hidden; }
.ab-bar > div { height:100%; background:linear-gradient(90deg,var(--brand),var(--brand2)); border-radius:6px; }
.platform-all { display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:12px; }
.platform-mini { padding:12px 14px; border:1px solid var(--border); border-radius:12px; background:var(--panel2); }
.platform-mini b { display:block; font-size:13px; color:var(--text); margin-bottom:5px; }
.platform-mini span { display:block; font-size:11.5px; color:var(--muted); }
.platform-mini span.pm-count { color:var(--brand); margin-top:3px; }
.platform-mini em { display:block; font-size:11px; color:var(--warn); font-style:normal; margin-top:5px; }
.switch-row { display:flex; align-items:center; gap:12px; padding:12px 0; cursor:pointer; }
.switch-row input { width:18px; height:18px; accent-color:var(--brand); }
.switch-row b { display:block; font-size:13.5px; color:var(--text); }
.switch-row small { display:block; font-size:11.5px; color:var(--muted); margin-top:3px; }

/* 网站 SEO：搜索结果预览 */
.seo-serp { max-width: 720px; margin-top: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.serp-label { font-size: 10.5px; color: var(--muted); margin-bottom: 8px; }
.serp-url { font-size: 12px; color: #3c7a3c; margin-bottom: 3px; overflow-wrap: anywhere; }
.serp-title { font-size: 17px; line-height: 1.35; color: #1a0dab; margin-bottom: 3px; overflow-wrap: anywhere; }
.serp-desc { font-size: 12.5px; line-height: 1.55; color: #4d5156; overflow-wrap: anywhere; }
.btn-sm { padding:5px 9px; font-size:11.5px; border-radius:7px; }

/* ------------------------------------------------------------ 账号拦截遮罩 */
.blocked-mask {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(24, 32, 51, .45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.blocked-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 18px 48px rgba(31, 43, 81, .18);
  padding: 32px 34px; max-width: 420px; text-align: center;
}
.blocked-icon {
  width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%;
  background: rgba(229, 72, 77, .1); color: var(--danger);
  font-size: 26px; font-weight: 700; line-height: 48px;
}
.blocked-card h3 { font-size: 18px; margin-bottom: 8px; }
.blocked-card p { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.blocked-ops { display: flex; gap: 10px; justify-content: center; }

/* ------------------------------------------------------------ 管理端：商品 / 账本 / 邀请码 */
.modal-wide { max-width: 900px; width: 92vw; }
.small { font-size: 12px; }
.muted.small { color: var(--muted); }

.proj-cell { display: flex; align-items: center; gap: 10px; }
.proj-thumb {
  width: 46px; height: 46px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border); background: var(--panel2); cursor: zoom-in; flex: none;
}
.proj-thumb.empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--muted); cursor: default;
}

.admin-task-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin-top: 14px; max-height: 62vh; overflow: auto;
}
.admin-task {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--panel2);
}
.admin-task.has-error { border-color: rgba(229, 72, 77, .45); }
.admin-task img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: zoom-in; background: #fff; }
.at-empty {
  height: 150px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12.5px; background: #fff;
}
.at-meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.at-meta b { font-size: 12.5px; }
.at-error {
  font-size: 11.5px; color: var(--danger); line-height: 1.5; word-break: break-all;
  background: rgba(229, 72, 77, .07); border-radius: 6px; padding: 4px 6px;
}

.mini-select {
  border: 1px solid var(--border); border-radius: 7px; padding: 3px 6px;
  font-size: 12.5px; background: var(--panel); color: var(--text); cursor: pointer;
}
.online-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); margin-right: 5px; vertical-align: middle;
}
.delta-plus { color: var(--ok); font-weight: 700; }
.token-cost { color: var(--danger); font-weight: 700; }
.invite-code {
  font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px;
  background: var(--panel2); border: 1px dashed var(--border);
  border-radius: 6px; padding: 2px 8px; cursor: copy;
}

/* 用户端：每日额度 */
.daily-chip { background: rgba(79, 110, 247, .1); color: var(--brand); }
.daily-chip.warn { background: rgba(229, 72, 77, .1); color: var(--danger); }
.daily-box { padding: 4px 0; }
.daily-line { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.daily-line span { color: var(--muted); font-size: 13px; }
.daily-line b { font-size: 20px; }
.daily-bar { height: 8px; border-radius: 6px; background: var(--panel2); overflow: hidden; margin-bottom: 10px; }
.daily-bar div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand2)); border-radius: 6px; }

/* 出图任务页：本批消耗提示 */
.cost-hint {
  display: inline-block; margin-left: 10px; padding: 1px 9px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  background: rgba(79, 110, 247, .1); color: var(--brand);
  vertical-align: middle; white-space: nowrap;
}
.cost-hint:empty { display: none; }
.cost-hint.warn { background: rgba(229, 72, 77, .1); color: var(--danger); }

/* ---------------- 出图失败：原因 + 补救按钮 ---------------- */
.status-pill.fail { color: var(--danger); border-color: #f6c3c5; background: #fdf1f1; }
.gp-hint {
  margin: 0 0 12px; padding: 9px 12px; border-radius: 9px;
  background: #fdf3f3; border: 1px solid #f6d3d4; color: #8d2f32;
  font-size: 12.5px; line-height: 1.65;
}
.gp-hint b { color: var(--danger); }
.gp-hint.net { background: #fff8e6; border-color: #f0c36d; color: #7a5200; }
.gp-hint.net b { color: #a35b00; }
.task-error {
  margin-top: 12px; padding: 11px 13px; border-radius: 10px;
  background: #fdf2f2; border: 1px solid #f6d3d4;
}
.task-error .te-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.task-error .te-head b { color: var(--danger); font-size: 12.5px; }
.task-error .te-time { color: var(--muted); font-size: 11px; }
.task-error p { margin-top: 4px; color: #6d3a3c; font-size: 12px; line-height: 1.65; }
.task-error .te-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.task-error .te-reqid { color: var(--muted); font-size: 11px; font-family: ui-monospace, Consolas, monospace; }
.task-error .te-raw { margin-top: 8px; }
.task-error .te-raw summary { cursor: pointer; color: var(--muted); font-size: 11.5px; }
.task-error .te-raw pre {
  margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: #fff;
  border: 1px solid #f0dcdc; color: #6d3a3c; font-size: 11.5px;
  white-space: pre-wrap; word-break: break-all; max-height: 160px; overflow: auto;
}
.upload-warn {
  margin-top: 12px; padding: 8px 11px; border-radius: 9px;
  background: #fff9ec; border: 1px solid #f3e3bd; color: #7d5a10;
  font-size: 11.5px; line-height: 1.7;
}
.upload-warn b { color: #a8690a; }
.gp-note { grid-column: 1 / -1; color: #8a6a17; font-size: 11.5px; padding-top: 4px; }
.gen-note { color: #8a6a17; margin-top: 8px; }
.gen-scope {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 12px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--border);
}
.gen-scope span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.gen-scope select { border: none; background: transparent; font-size: 12.5px; color: var(--text); padding: 2px 4px; }
.rework-card {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: #fff8ec; border: 1px solid #f2dfb8; color: #7a5810;
  font-size: 12px; line-height: 1.65;
}
.rework-card b { color: #a8690a; }
.rework-card .btn { margin-left: 8px; }

/* ---------------------------------------------------- 姿势 / 表情选择 */
.pose-modal { width: min(1320px, 97vw); }
.pose-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 12px; }
.pose-tabs { display: flex; gap: 8px; margin-top: 14px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.pose-tab { background: var(--bg2); border: 1px solid var(--border); color: var(--muted); border-radius: 8px; padding: 8px 16px; font-size: 12.5px; font-family: inherit; cursor: pointer; transition: all .15s; }
.pose-tab:hover { color: var(--text); border-color: var(--brand); }
.pose-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pose-col { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; min-width: 0; }
.pose-col-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pose-col-head b { color: var(--text); font-size: 13px; }
.pose-col-head select { background: var(--panel); border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; color: var(--text); font-size: 12px; font-family: inherit; max-width: 150px; }
.pose-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 46vh; overflow: auto; padding-right: 4px; align-content: start; }
.pose-item { border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--panel); transition: border-color .15s; }
.pose-item:hover { border-color: var(--brand); }
.pose-item.sel { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(79,110,247,.2); }
.pose-item img { width: 100%; aspect-ratio: 3/4; object-fit: contain; display: block; background: #fff; }
.pose-item img.thumb-bad { visibility: hidden; }   /* 图挂了也别显示破图图标 */
.pose-item span { display: block; font-size: 10.5px; color: var(--muted); padding: 5px 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pose-active { margin-top: 14px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text); }
.pose-active .pa-chip { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.pose-active .pa-chip b { color: var(--brand); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }
.pose-bar { margin: -2px 0 14px; }
.btn-pose {
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #7b6cf6, #4f6ef7);
  color: #fff; border: 0; border-radius: 10px;
  padding: 9px 15px; cursor: pointer; text-align: left;
  box-shadow: 0 3px 12px rgba(99,91,246,.28);
  transition: transform .15s, box-shadow .15s, filter .15s;
  font-family: inherit;
}
.btn-pose:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(99,91,246,.4); filter: brightness(1.07); }
.btn-pose:active { transform: none; }
.btn-pose:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pb-icon { font-size: 18px; line-height: 1; }
.pb-text { display: block; line-height: 1.3; }
.pb-text b { display: block; font-size: 12.5px; font-weight: 700; }
.pb-text small { display: block; font-size: 10.5px; opacity: .85; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-arrow { opacity: .8; font-size: 13px; }
.pose-bar.chosen .btn-pose { background: linear-gradient(135deg, #2fa37a, #278a9c); box-shadow: 0 3px 12px rgba(38,155,120,.25); }
.pose-bar.chosen .btn-pose:hover { box-shadow: 0 5px 16px rgba(38,155,120,.36); }
@media (max-width: 760px) {
  .pose-panel { grid-template-columns: 1fr; }
  .pose-grid { max-height: 30vh; }
  /* 素材卡占满一行，避免固定 340px 的摘要把卡片撑出屏幕 */
  .btn-pose { width: 100%; max-width: 100%; }
  .pb-text { min-width: 0; flex: 1 1 auto; }
  .pb-text small { max-width: 100%; }
  /* 本批消耗提示太长时换成整行，不再把标题区撑宽 */
  .cost-hint { display: block; margin: 6px 0 0; max-width: 100%; white-space: normal; }
}
.gen-model { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* 家居素材方案提示 */
.pose-mode-hint { margin: 10px 0 0; font-size: 12px; line-height: 1.6; color: var(--brand); background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 8px; padding: 9px 12px; }

/* 灯光素材只注入文字，用纯文字卡片代替人台缩略图 */
.pose-item.textonly { min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 8px; background: var(--panel); }
.pose-item.textonly .pi-light { font-size: 20px; line-height: 1; color: var(--brand); }
.pose-item.textonly span { white-space: normal; line-height: 1.45; padding: 0; font-size: 11px; color: var(--text); }

/* 任务卡右上角：这张图的预计 TOKEN */
.task-head-right { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.task-cost { font-size: 11px; color: var(--muted); background: var(--bg2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }

/* 任务语言与项目语言不一致时的提醒条 */
.lang-stale { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 14px; border: 1px solid #f0c36d; background: #fff8e6; color: #7a5200; border-radius: 10px; font-size: 13px; }
.lang-stale .ls-icon { font-size: 15px; }
.lang-stale .btn { margin-left: auto; }
.label-warn { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #fff1d6; color: #a06400; font-size: 10px; font-style: normal; border: 1px solid #f0c36d; }
[data-theme="dark"] .lang-stale { background: #3a2f14; border-color: #7a5c1a; color: #ffd98a; }
[data-theme="dark"] .label-warn { background: #3a2f14; border-color: #7a5c1a; color: #ffd98a; }

/* ------------------------------------------------------------ 使用指南 */
.guide-box { width:min(860px,100%); }
.guide-sub { margin:3px 0 0; font-size:11.5px; color:var(--muted); }
.guide-body { padding:16px 22px 20px; }
.guide-step {
  display:flex; gap:16px; margin-bottom:10px; padding:14px;
  border:1px solid var(--border); border-radius:12px; background:var(--bg2);
  transition:.16s ease;
}
.guide-step:hover { border-color:#cdd8ff; box-shadow:var(--shadow); }
.gs-art { flex:0 0 132px; width:132px; }
.gs-art svg { display:block; width:100%; height:auto; border-radius:10px; }
.gs-main { flex:1; min-width:0; }
.gs-top { display:flex; align-items:center; gap:8px; margin-bottom:4px; }
.gs-num {
  width:20px; height:20px; flex:none; border-radius:6px; display:grid; place-items:center;
  background:linear-gradient(135deg,var(--brand),var(--brand2)); color:#fff;
  font-size:11.5px; font-weight:700;
}
.gs-top h3 { font-size:14px; color:var(--text); }
.gs-time {
  margin-left:auto; padding:1px 8px; border-radius:999px; white-space:nowrap;
  background:var(--panel); border:1px solid var(--border);
  font-size:10.5px; color:var(--muted);
}
.guide-step p { margin:0 0 5px; font-size:12.5px; color:var(--muted); }
.gs-list { margin:0 0 6px; padding-left:15px; font-size:12px; color:var(--muted); }
.gs-list li { margin-bottom:2px; }
.gs-list b { color:var(--text); font-weight:600; }
.gs-tip {
  display:inline-block; padding:5px 9px; border-radius:7px;
  background:#eef2ff; color:#3d54c8 !important; font-size:11.5px !important;
}
.gs-go {
  margin-top:2px; padding:3px 10px; border-radius:7px; cursor:pointer;
  background:var(--panel); border:1px solid var(--border);
  font-family:inherit; font-size:11.5px; font-weight:600; color:var(--brand);
}
.gs-go:hover { background:#eef2ff; border-color:var(--brand); }
.guide-faq {
  margin-top:16px; padding:14px 16px; border-radius:12px;
  border:1px dashed var(--border); background:var(--panel);
}
.guide-faq h3 { margin-bottom:8px; font-size:13px; color:var(--text); }
.guide-faq dt { margin-top:8px; font-size:12.5px; font-weight:600; color:var(--text); }
.guide-faq dt:first-of-type { margin-top:0; }
.guide-faq dd { margin:2px 0 0; font-size:12px; color:var(--muted); }
.guide-foot-note { margin:12px 0 0; font-size:11.5px; color:var(--muted); }

@media (max-width: 640px) {
  .guide-body { padding:12px 14px 16px; }
  .guide-step { flex-direction:column; gap:10px; padding:12px; }
  .gs-art { flex:none; width:132px; }
  .gs-time { display:none; }
  .gs-top h3 { font-size:13px; }
  .user-name { max-width:64px; }
  .user-drop { width:210px; }
}

.gs-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:2px; }
.gs-actions .gs-tip { flex:0 1 auto; min-width:0; margin:0; }
.gs-actions .gs-go { margin-left:auto; }

/* ---------------------------------------------------- 出图方案面板 */
.plan-n { font-weight: 700; color: var(--brand); margin-left: 2px; }
.count-field { display: flex; align-items: stretch; gap: 8px; }
.count-field input { flex: 1 1 auto; min-width: 0; background: var(--panel2); cursor: default; color: var(--muted); }
.count-field .btn { flex: 0 0 auto; white-space: nowrap; display: inline-flex; align-items: center; }

.plan-box { width: min(980px, 96vw); display: flex; flex-direction: column; max-height: 88vh; }
.plan-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.plan-body { padding: 16px 22px 20px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.plan-preset-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.plan-preset-head b { font-size: 13px; color: var(--text); }
.plan-preset-head span { font-size: 11.5px; color: var(--muted); }
.plan-presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 8px; margin-bottom: 18px; }
.plan-preset {
  text-align: left; font-family: inherit; cursor: pointer; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
  transition: .15s; color: var(--text);
}
.plan-preset:hover { border-color: var(--brand); transform: translateY(-1px); }
.plan-preset.active { border-color: var(--brand); background: linear-gradient(100deg, #eef2ff, #f6f2ff); box-shadow: 0 0 0 3px rgba(79,110,247,.1); }
.pp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pp-name { font-size: 12.5px; font-weight: 700; }
.pp-count { font-size: 11px; color: var(--brand); background: rgba(79,110,247,.12); border-radius: 20px; padding: 1px 7px; white-space: nowrap; }
.pp-desc { font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.pp-plat { font-size: 10.5px; color: var(--brand2); margin-top: 3px; }

.plan-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; }
.plan-tab {
  font-family: inherit; font-size: 12.5px; padding: 6px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg2); color: var(--muted);
}
.plan-tab:hover { color: var(--text); }
.plan-tab.active { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; border-color: transparent; }

.plan-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); gap: 10px; align-items: start; }
.plan-card {
  border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px;
  background: var(--panel); display: flex; flex-direction: column; gap: 6px; transition: .15s;
}
.plan-card.on { border-color: rgba(79,110,247,.5); background: linear-gradient(180deg, #fbfcff, #f5f7ff); }
.plan-card.off { opacity: .5; }
.pc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pc-name { font-size: 13px; font-weight: 700; color: var(--text); }
.pc-tag { font-size: 10.5px; border-radius: 20px; padding: 1px 7px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.pc-tag.text { background: rgba(199,129,0,.12); color: var(--warn); }
.pc-desc { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.pc-need { font-size: 10.5px; color: var(--brand2); }
.pc-need.miss { color: var(--warn); }
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.pc-var { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.stepper button {
  width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); font-size: 14px; line-height: 1; cursor: pointer; font-family: inherit; padding: 0;
}
.stepper button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper b { min-width: 16px; text-align: center; font-size: 13px; color: var(--text); }
.stepper .fixed-txt { font-size: 11px; color: var(--muted); }

.plan-warn {
  margin: 0 22px 12px; padding: 9px 12px; border-radius: 9px; font-size: 12px; line-height: 1.65;
  background: #fff9ec; border: 1px solid #f3e3bd; color: #7d5a10; flex: 0 0 auto;
}
.plan-warn b { color: #a8690a; }
.plan-foot { align-items: center; }
.plan-sum { margin-right: auto; font-size: 12.5px; color: var(--text); font-weight: 600; }
.plan-sum span { color: var(--muted); font-weight: 400; }

/* 已移除（保留成图）的任务 */
.task-card.removed { opacity: .62; border-style: dashed; background: var(--bg2); }
.task-card.removed .task-head .task-title { color: var(--muted); }
.task-card.removed .status-pill { background: var(--panel2); color: var(--muted); }
.removed-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 10px; font-size: 12.5px; color: var(--muted); }
.removed-head b { color: var(--text); }
.removed-head span { font-size: 11.5px; }
.rm-thumb { max-width: 180px; border-radius: 8px; border: 1px solid var(--border); display: block; margin: 6px 0; }

@media (max-width: 640px) {
  .plan-groups { grid-template-columns: 1fr; }
  .plan-presets { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .plan-body { padding: 12px 14px 16px; }
  .plan-foot { flex-wrap: wrap; }
  .plan-sum { width: 100%; margin-bottom: 6px; }
}

/* 全局忙碌态：按钮触发的请求未结束时，禁止重复点击并给出可见反馈 */
.btn.is-busy, button.is-busy, [role="button"].is-busy {
  opacity: .62;
  cursor: wait !important;
  position: relative;
}
.btn.is-busy::before, button.is-busy::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
