:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --text: #151922;
  --muted: #657083;
  --line: #dfe4ea;
  --panel: #ffffff;
  --accent: #2764e7;
  --accent-dark: #184db8;
  --danger: #b42318;
  --ok: #067647;
  --secondary: #eef2f7;
  --secondary-hover: #e0e6ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.actions a {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 40px;
  padding: 0 16px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.actions a:hover {
  background: var(--accent-dark);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 32px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 24px;
  line-height: 1.25;
}

.topbar p,
.status,
.card-meta,
#dialogMeta {
  color: var(--muted);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.automation-hub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.plan-entry-card { min-height: 128px; padding: 20px; text-align: left; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--line); color: var(--text); background: #fff; }
.plan-entry-card:hover, .plan-entry-card[aria-expanded="true"] { background: #f8faff; border-color: var(--accent); }
.plan-entry-card strong, .plan-entry-card small { display:block; }.plan-entry-card strong { font-size: 18px; margin-bottom: 7px; }.plan-entry-card small { color: var(--muted); line-height: 1.45; }.plan-entry-card b { color: var(--accent); font-size: 13px; white-space: nowrap; }.plan-entry-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); font-size: 24px; }.radar-entry .plan-entry-icon { background: #7c3aed; }
.automation-panel { margin: 0 0 22px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }.automation-panel-head { display:flex; align-items:center; justify-content:space-between; gap:16px; }.automation-panel-head h2 { font-size:20px; }.automation-panel-head p { margin-top:6px; color:var(--muted); font-size:14px; }
.automation-status { min-height: 0; margin: 0 0 14px; color: var(--muted); font-size: 14px; }.automation-status:empty { display: none; }.automation-status.error { color: var(--danger); font-weight: 700; }
.automation-form { margin:18px 0; padding:18px; border-radius:8px; background:#f8faff; border:1px solid #d8e3fb; }.automation-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }.automation-form label { margin:0; font-size:14px; }.automation-form input, .automation-form select, .automation-form textarea { width:100%; min-height:40px; margin-top:6px; padding:9px 10px; border:1px solid var(--line); border-radius:6px; background:#fff; }.automation-form textarea { min-height:78px; resize:vertical; }.automation-field-hint { display:block; margin-top:5px; color:var(--muted); font-size:12px; line-height:1.4; }.automation-wide { grid-column:1/-1; }.score-help { grid-column:1/-1; margin:0; color:var(--muted); font-size:13px; }.automation-actions { display:flex; align-items:center; gap:10px; margin-top:16px; }.automation-actions .toggle { display:flex; align-items:center; gap:7px; margin:0 auto 0 0; font-weight:600; }.automation-actions .toggle input { width:auto; min-height:auto; margin:0; }.secondary { background:var(--secondary); color:var(--text); }.secondary:hover { background:var(--secondary-hover); }
.automation-form-grid[hidden] { display: none; }
.follow-remix-fields > label { margin-top: 14px; }
.automation-background-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.automation-background-row .file-picker { margin: 0; }
.automation-background-row select { min-height: 40px; min-width: 220px; flex: 1; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.automation-background-native-select { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.automation-background-row .fusion-select { flex: 0 1 140px; min-width: 140px; }
.automation-background-preview { display: block; max-width: 180px; max-height: 120px; margin: 12px 0; border: 1px solid var(--line); border-radius: 6px; object-fit: cover; }
.automation-background-picker { margin-top:10px; border:1px solid var(--line); border-radius:7px; background:#fff; }
.automation-background-picker summary { min-height:40px; display:flex; align-items:center; padding:0 12px; cursor:pointer; color:#284d98; font-weight:600; }
.automation-background-gallery { display:grid; grid-template-columns:repeat(auto-fill,minmax(112px,1fr)); gap:10px; padding:12px; border-top:1px solid var(--line); max-height:340px; overflow:auto; }
.automation-background-choice { min-height:126px; padding:6px; display:grid; grid-template-rows:82px auto; gap:6px; align-content:start; text-align:left; background:#fff; color:var(--text); border:1px solid var(--line); border-radius:6px; overflow:hidden; }
.automation-background-choice:hover,.automation-background-choice.is-selected { border-color:var(--accent); box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 16%,transparent); }
.automation-background-choice img { width:100%; height:82px; object-fit:cover; border-radius:4px; background:#eef2f7; }
.automation-background-choice span { font-size:12px; line-height:1.3; overflow-wrap:anywhere; }
.automation-background-choice .automation-background-empty { align-self:center; padding:8px; color:var(--muted); }
.automation-plans { display:grid; gap:10px; }.automation-plan { display:grid; grid-template-columns:1fr auto; gap:14px; align-items:center; padding:15px; border:1px solid var(--line); border-radius:8px; }.automation-plan[tabindex] { cursor:pointer; transition:border-color .16s ease, background .16s ease, box-shadow .16s ease; }.automation-plan[tabindex]:hover { border-color:#9bb8ef; background:#f8faff; }.automation-plan[aria-expanded="true"] { border-color:var(--accent); box-shadow:0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); }.automation-plan[tabindex]:focus-visible { outline:3px solid color-mix(in srgb, var(--accent) 28%, transparent); outline-offset:2px; }.automation-plan h3 { margin:0 0 6px; font-size:16px; }.automation-plan-status { color:#5370a8; font-weight:300; }.automation-plan p { color:var(--muted); font-size:13px; line-height:1.5; }.automation-plan-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }.automation-plan-actions button { min-height:34px; padding:0 11px; font-size:13px; }.automation-plan .follow-workbench { cursor:default; }
.automation-plan-actions .plan-action-button { background:var(--secondary); color:var(--text); }.automation-plan-actions .plan-action-button:hover { background:var(--secondary-hover); }.automation-plan-actions .plan-action-button.is-active,.automation-plan-actions .plan-action-button.is-active:hover { background:var(--accent); color:#fff; }
.pending-source-work-button { position:relative; overflow:visible; }
.pending-source-work-badge { position:absolute; top:-8px; right:-8px; z-index:1; display:grid; min-width:18px; height:18px; padding:0 4px; place-items:center; border:2px solid #fff; border-radius:999px; background:#e5484d; color:#fff; font-size:11px; font-weight:700; line-height:1; box-shadow:0 1px 3px rgba(46,55,77,.24); }
.pending-source-work-badge[hidden] { display:none; }
.automation-plan .automation-run-error { color: var(--danger); font-weight: 600; }
.follow-workbench { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 14px; }
.follow-workbench-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:10px; }.follow-workbench-head > strong { color:#5370a8; font-weight:400; }.follow-workbench-head span { color:var(--muted); font-size:13px; flex:1; }.follow-workbench-head button { min-height:34px; font-size:13px; }.follow-review-actions { justify-content:flex-end; }
.follow-candidate-list { display:grid; gap:8px; max-height:520px; overflow:auto; }.follow-candidate { display:grid; grid-template-columns:auto minmax(152px,340px) minmax(0,1fr) auto; gap:10px; align-items:center; border:1px solid var(--line); border-radius:7px; padding:8px; background:#fff; font-weight:400; margin:0; }.follow-candidate-images { display:flex; flex-wrap:wrap; gap:5px; align-content:center; }.follow-candidate-image { width:72px; height:72px; display:grid; place-items:center; border-radius:5px; background:#f0f2f5; overflow:hidden; }.follow-candidate-image:empty::after { content:"图片加载失败"; color:var(--muted); font-size:11px; text-align:center; }.follow-candidate-images img { width:72px; height:72px; object-fit:cover; background:#f0f2f5; }.follow-candidate-images.empty-images { min-height:72px; align-items:center; color:var(--muted); font-size:12px; }.follow-candidate span { min-width:0; display:grid; gap:3px; }.follow-candidate b { font-size:14px; }.follow-candidate small,.follow-candidate em { color:var(--muted); font-size:12px; font-style:normal; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }.follow-candidate i { color:var(--muted); font-size:12px; font-style:normal; white-space:nowrap; }.follow-candidate button { min-height:32px; font-size:12px; }.follow-selectable-image { position:relative; cursor:pointer; border:2px solid #c8d0dc; }.follow-selectable-image:has(input:checked) { border-color:var(--accent); box-shadow:0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }.follow-selectable-image input { position:absolute; top:4px; left:4px; z-index:1; width:16px; height:16px; accent-color:var(--accent); }.follow-selectable-image span { position:absolute; right:3px; bottom:3px; padding:1px 4px; border-radius:4px; background:rgba(0,0,0,.6); color:#fff; font-size:10px; }.follow-retryable-image .follow-image-failure,.follow-retryable-image .follow-retry-image { display:none; }.follow-retryable-image.image-load-failed { align-content:center; gap:4px; padding:5px; text-align:center; }.follow-retryable-image.image-load-failed .follow-image-failure { display:block; color:var(--muted); font-size:11px; line-height:1.25; }.follow-retryable-image.image-load-failed .follow-retry-image { display:inline-flex; min-height:25px; padding:0 7px; border:0; border-radius:4px; background:var(--secondary); color:#5370a8; font-size:11px; line-height:1; white-space:nowrap; }.follow-retryable-image.image-load-failed .follow-retry-image:hover { background:var(--secondary-hover); }.danger { background:#c74444; }.danger:hover { background:#ab3535; }
.follow-candidate-side { align-self:stretch; display:flex; min-width:144px; flex-direction:column; justify-content:space-between; align-items:flex-end; text-align:right; }.follow-candidate-side time { color:#5370a8; font-size:12px; font-style:normal; white-space:nowrap; }.follow-candidate-side span { color:var(--muted); font-size:12px; }
.follow-candidate-status { align-self:stretch; display:flex; min-width:144px; flex-direction:column; justify-content:space-between; align-items:flex-end; gap:10px; text-align:right; }.follow-candidate-status span { color:var(--muted); font-size:12px; font-style:normal; white-space:nowrap; }.follow-replica-actions { display:flex; align-items:center; justify-content:flex-end; gap:12px; white-space:nowrap; }.follow-replica-actions > button { flex:0 0 108px; width:108px; }.follow-candidate-status .danger { min-height:30px; padding:0 9px; font-size:12px; }
.follow-review-candidate .follow-candidate-status { grid-column:3; grid-row:1 / span 2; }
.follow-progress-wrap { display:grid; gap:4px; margin:2px 0; }.follow-progress { height:7px; overflow:hidden; border-radius:999px; background:#e8edf6; }.follow-progress span { display:block; height:100%; min-width:2px; border-radius:inherit; background:linear-gradient(90deg,#2f67e9,#7d4cff); transition:width .25s ease; }.follow-progress-wrap small { color:#5370a8; white-space:normal; overflow:visible; text-overflow:clip; }
@media (max-width: 700px) { .follow-candidate { grid-template-columns:auto minmax(0,1fr); align-items:start; }.follow-candidate-images { grid-column:2; }.follow-candidate-images img { width:58px; height:58px; }.follow-candidate span { grid-column:2; }.follow-candidate i { grid-column:2; }.follow-candidate button { grid-column:2; }.follow-workbench-head span { flex-basis:100%; }.follow-workbench-head button { width:100%; } }

.follow-review-section { display:grid; gap:8px; margin-top:14px; }.follow-review-section-head { display:flex; align-items:baseline; gap:8px; }.follow-review-section-head strong { font-size:15px; }.follow-review-section-head strong span,.follow-review-section-head small { color:var(--muted); font-size:12px; font-weight:400; }.follow-review-empty { margin:0; padding:12px; border:1px dashed var(--line); border-radius:7px; color:var(--muted); font-size:13px; text-align:center; }.follow-review-section .follow-candidate-list { max-height:360px; }.follow-candidate-arrived { animation:followCandidateArrival 1.4s ease-out; }@keyframes followCandidateArrival { from { background:#e9f0ff; border-color:#7d9df4; } to { background:#fff; border-color:var(--line); } }
.follow-review-candidate { grid-template-columns:auto minmax(0,1fr) auto; align-items:start; }.follow-comparison { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px; }.follow-comparison-panel { min-width:0; display:grid; gap:8px; padding:10px; border:1px solid var(--line); border-radius:7px; background:#f8fafc; }.follow-comparison-replica { border-color:#b8caf7; background:#f3f7ff; }.follow-comparison-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; }.follow-comparison-heading strong { font-size:14px; }.follow-comparison-heading span { color:var(--muted); font-size:12px; }.follow-comparison .follow-candidate-images { display:flex; align-items:flex-start; max-width:none; }.follow-comparison .follow-candidate-image,.follow-comparison .follow-candidate-images img { width:72px; height:72px; }.follow-comparison-copy { display:grid; gap:5px; min-width:0; }.follow-comparison-copy b { font-size:14px; line-height:1.45; overflow-wrap:anywhere; }.follow-comparison-copy p { margin:0; color:var(--muted); font-size:13px; line-height:1.6; white-space:pre-wrap; overflow-wrap:anywhere; }.follow-copy-edit-trigger { padding:6px; margin:-6px; border-radius:5px; cursor:text; transition:background .15s ease, box-shadow .15s ease; }.follow-copy-edit-trigger:hover,.follow-copy-edit-trigger:focus-visible { outline:0; background:rgb(43 100 223 / .07); box-shadow:0 0 0 2px rgb(43 100 223 / .25); }.follow-copy-edit-trigger small { color:var(--accent); font-size:11px; font-weight:700; }.follow-copy-editor { padding:8px; margin:-6px; border:1px solid #9eb9f5; border-radius:6px; background:#fff; }.follow-copy-editor label { display:grid; gap:4px; margin:0; font-size:12px; color:var(--muted); }.follow-copy-editor input,.follow-copy-editor textarea { width:100%; box-sizing:border-box; border:1px solid var(--line); border-radius:5px; padding:7px 8px; color:var(--text); font:inherit; line-height:1.45; background:#fff; }.follow-copy-editor textarea { min-height:112px; resize:vertical; }.follow-copy-editor-actions { display:flex; justify-content:flex-end; gap:7px; }.follow-copy-editor-actions button { min-height:32px; padding:0 10px; font-size:12px; }.follow-candidate-review-meta { display:grid; gap:3px; margin-top:2px; }.follow-candidate-review-meta small,.follow-candidate-review-meta em { color:var(--muted); font-size:12px; font-style:normal; white-space:normal; overflow:visible; text-overflow:clip; }.follow-comparison-preview { padding:0; border:0; cursor:zoom-in; }.follow-comparison-preview:hover { transform:scale(1.03); box-shadow:0 0 0 2px var(--accent); }.image-preview-dialog { width:min(94vw, 1280px); max-width:min(94vw, 1280px); max-height:94vh; padding:18px; background:#111827; border-color:#374151; overflow:visible; }.image-preview-dialog::backdrop { background:rgb(0 0 0 / .72); }.image-preview-dialog #closeImagePreviewBtn { position:absolute; top:-14px; right:-14px; z-index:1; width:36px; min-height:36px; padding:0; border-radius:50%; background:#fff; color:#111827; font-size:24px; line-height:1; }.image-pair-preview { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; }.image-pair-preview section { min-width:0; display:grid; gap:8px; }.image-pair-preview h2 { margin:0; color:#fff; font-size:15px; }.image-preview-stage { display:grid; min-height:300px; place-items:center; background:#020617; border-radius:6px; overflow:hidden; }.image-preview-stage img { display:block; width:100%; max-height:76vh; object-fit:contain; }.image-preview-stage p { margin:0; color:#cbd5e1; font-size:14px; }.image-preview-regenerate { display:grid; gap:7px; padding:10px; border:1px solid #334155; border-radius:6px; background:#0f172a; }.image-preview-regenerate label { display:grid; gap:5px; color:#e2e8f0; font-size:13px; }.image-preview-regenerate textarea { min-height:76px; padding:8px; border:1px solid #475569; border-radius:5px; resize:vertical; background:#fff; color:#111827; font:inherit; line-height:1.45; }.image-preview-regenerate button { justify-self:start; min-height:34px; padding:0 12px; border:0; border-radius:5px; background:var(--accent); color:#fff; font-size:13px; }.image-preview-regenerate button:disabled { opacity:.7; cursor:wait; }.image-preview-regenerate p { margin:0; color:#bfdbfe; font-size:12px; }.image-preview-regenerate p.error { color:#fca5a5; }
@media (max-width: 700px) { .follow-review-section-head { align-items:flex-start; flex-direction:column; gap:2px; }.follow-review-section .follow-candidate-list { max-height:440px; } }
@media (max-width: 700px) { .follow-review-candidate { grid-template-columns:auto minmax(0,1fr); }.follow-review-candidate .follow-comparison,.follow-review-candidate .follow-candidate-review-meta,.follow-review-candidate .follow-candidate-status { grid-column:2; }.follow-review-candidate .follow-candidate-status { grid-row:auto; }.follow-comparison { grid-template-columns:1fr; }.follow-comparison .follow-candidate-images,.follow-comparison .follow-comparison-copy { grid-column:auto; }.follow-comparison .follow-candidate-image,.follow-comparison .follow-candidate-images img { width:58px; height:58px; } }

/* 大图弹层：图片区固定成对对比，提示词区占满图片下方。 */
.image-preview-dialog { overflow:auto; }
.image-preview-stage { min-height:260px; }
.image-preview-stage img { max-height:calc(72vh - 180px); }
.image-preview-regenerate { grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:10px; margin-top:14px; padding:12px; }
.image-preview-regenerate textarea { min-height:82px; }
.image-preview-regenerate button { align-self:end; min-height:38px; padding:0 14px; }
.image-preview-regenerate p { grid-column:1 / -1; }
@media (max-width:700px) { .image-pair-preview { grid-template-columns:1fr; }.image-preview-stage { min-height:220px; }.image-preview-stage img { max-height:48vh; }.image-preview-regenerate { grid-template-columns:1fr; }.image-preview-regenerate button { justify-self:start; } }

@media (max-width: 700px) {
  .topbar { align-items: stretch; flex-direction: column; padding: 20px; }
  .topbar > button { width: 100%; }
  main { padding: 16px; }
  .automation-hub { grid-template-columns: 1fr; }
  .automation-panel { padding: 16px; }
  .automation-panel-head { align-items: flex-start; flex-direction: column; }
  .automation-form-grid { grid-template-columns: 1fr; }
  .automation-plan { grid-template-columns: minmax(0, 1fr); }
  .automation-plan-actions { justify-content: flex-start; }
  .automation-plan-actions button { min-width: 0; }
  .automation-actions { align-items: stretch; flex-wrap: wrap; }
  .automation-actions .toggle { width: 100%; margin: 0; }
}

.site-footer {
  padding: 8px 24px 28px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.panel,
.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-panel {
  padding: 18px;
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

.import-row,
.toolbar,
.tag-row,
.actions {
  display: flex;
  gap: 12px;
}

.import-row input,
.toolbar input,
.toolbar select,
.tag-row input,
.note-text-panel input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
}

.status {
  min-height: 24px;
  margin-top: 12px;
  font-size: 14px;
}

.status.error {
  color: var(--danger);
  font-weight: 700;
}

.import-preview {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.preview-head span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 13px;
}

.preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-actions button {
  min-height: 34px;
  padding: 0 12px;
}

#selectAllPreviewBtn,
#clearPreviewBtn {
  background: var(--secondary);
  color: var(--text);
}

#selectAllPreviewBtn:hover,
#clearPreviewBtn:hover {
  background: var(--secondary-hover);
}

#deletePreviewBtn {
  background: var(--danger);
}

#deletePreviewBtn:hover {
  background: #912018;
}

.preview-notes {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding: 12px;
}

.preview-note {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-note.is-saved {
  opacity: 0.58;
}

.preview-note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.preview-note-title {
  font-weight: 800;
  font-size: 13px;
  line-height: 1.35;
}

.preview-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  padding: 10px;
}

.preview-image-tile {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e8ebf0;
  cursor: pointer;
}

.preview-image-tile img,
.preview-image-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-image-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
}

.preview-image-select {
  position: absolute;
  top: 5px;
  left: 30px;
  z-index: 1;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.92);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.saved-badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(44, 52, 64, 0.88);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.status strong {
  color: var(--ok);
}

.progress-block {
  margin-top: 10px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.progress-label {
  font-weight: 700;
  color: var(--text);
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e9f0;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #6bc8ff);
  transition: width 220ms ease;
}

.progress-block.is-active .progress-fill {
  background-image: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent) 25%,
    #8bb5ff 25%,
    #8bb5ff 50%,
    var(--accent) 50%,
    var(--accent) 75%,
    #8bb5ff 75%,
    #8bb5ff 100%
  );
  background-size: 28px 28px;
  animation: progress-stripes 900ms linear infinite;
}

.progress-block.is-error .progress-fill {
  background: var(--danger);
}

.progress-block.is-done .progress-fill {
  background: var(--ok);
}

@keyframes progress-stripes {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 28px 0;
  }
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.toolbar {
  margin: 18px 0;
  padding: 12px;
}

.toolbar select {
  max-width: 260px;
}

.batch-panel {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.batch-panel textarea,
.copywriting-panel textarea {
  min-height: 82px;
}

.reference-row {
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(220px, 1fr) minmax(120px, auto);
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin: 0;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.file-picker:hover {
  background: var(--accent-dark);
}

.file-picker input {
  display: none;
}

.fusion-select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.fusion-select {
  min-width: 120px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.background-picker {
  position: relative;
  min-width: 0;
}

.background-picker-trigger {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  justify-content: space-between;
  font-weight: 400;
  text-align: left;
}

.background-picker-trigger:hover {
  background: #fff;
  border-color: #aeb9c8;
}

.background-picker-trigger span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-picker-preview {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  margin-right: 8px;
  border-radius: 4px;
  object-fit: cover;
}

.background-picker-chevron {
  margin-left: 12px;
  color: var(--muted);
  font-size: 18px;
}

.background-picker-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: min(520px, calc(100vw - 48px));
  max-height: 330px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgb(24 38 61 / 18%);
}

.background-picker-menu[hidden] {
  display: none;
}

.background-picker-option {
  position: relative;
  min-height: 72px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #eef2f7;
}

.background-picker-option:hover {
  background: #e0e6ef;
}

.background-picker-option[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgb(39 100 231 / 16%);
}

.background-picker-image img {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: cover;
}

.background-picker-none {
  grid-column: 1 / -1;
  min-height: 38px;
  padding: 0 10px;
  color: var(--text);
  background: var(--secondary);
}

.batch-actions {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.selection-actions,
.primary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-actions {
  justify-content: flex-end;
}

.batch-actions button,
.copywriting-actions button {
  min-height: 36px;
  padding: 0 12px;
}

#selectAllBtn,
#clearSelectionBtn {
  background: var(--secondary);
  color: var(--text);
}

#selectAllBtn:hover,
#clearSelectionBtn:hover {
  background: var(--secondary-hover);
}

#deleteSelectedBtn {
  background: var(--danger);
}

#deleteSelectedBtn:hover {
  background: #912018;
}

#selectionStatus,
.inline-status {
  color: var(--muted);
  font-size: 14px;
}

#selectionStatus {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f7f9fc;
  border: 1px solid var(--line);
}

.inline-status {
  grid-column: 1 / -1;
  min-height: 18px;
}

.inline-status:empty,
.copywriting-status:empty {
  display: none;
}

.inline-status.error {
  color: var(--danger);
  font-weight: 700;
}

.copywriting-panel {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.copywriting-actions {
  display: grid;
  grid-template-columns: minmax(260px, auto) 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

#copyGeneratedCopyBtn {
  background: var(--secondary);
  color: var(--text);
}

#copyGeneratedCopyBtn:hover {
  background: var(--secondary-hover);
}

.copywriting-status {
  justify-self: end;
  color: var(--muted);
  font-size: 14px;
}

.copywriting-status.error {
  color: var(--danger);
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.select-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  margin: 0;
  padding: 0 10px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 1px 6px rgb(23 32 42 / 0.16);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.select-badge input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.cover-frame {
  position: relative;
}

.cover {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: #e8ebf0;
  object-fit: cover;
  display: block;
}

.image-count-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgb(23 32 42 / 0.86);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.card-body {
  padding: 12px;
}

.card-title {
  font-weight: 700;
  line-height: 1.35;
}

.card-content {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.card-meta {
  margin-top: 10px;
  font-size: 13px;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.card-actions button {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
}

.card-detail-btn {
  background: var(--secondary);
  color: var(--text);
}

.card-detail-btn:hover {
  background: var(--secondary-hover);
}

.empty {
  padding: 42px 0;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  overflow: auto;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.35);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

#closeDialogBtn {
  width: 40px;
  padding: 0;
  background: var(--secondary);
  color: var(--text);
  font-size: 24px;
}

#closeDialogBtn:hover {
  background: var(--secondary-hover);
}

.dialog-images {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.dialog-image-card {
  flex: 0 0 min(760px, calc(100vw - 96px));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.image-preview-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  padding: 8px;
  background: #f2f4f7;
}

.image-preview-row a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #e8ebf0;
}

.dialog-images img {
  width: 100%;
  height: min(48vh, 460px);
  border-radius: 6px;
  object-fit: contain;
  background: #e8ebf0;
}

.edited-preview {
  border-left: 1px solid var(--line);
}

.image-card-actions {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.image-card-actions button,
.image-card-actions a {
  flex: 1;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
}

.image-card-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--secondary);
  color: var(--text);
  text-decoration: none;
}

.image-card-actions a:hover {
  background: var(--secondary-hover);
}

.delete-image-btn {
  background: var(--danger);
}

.delete-image-btn:hover {
  background: #912018;
}

.background-panel {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafc;
}

.background-panel textarea {
  min-height: 74px;
}

.background-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.background-actions .fusion-select {
  width: auto;
}

.edit-status {
  color: var(--muted);
  font-size: 14px;
}

.edit-status.error {
  color: var(--danger);
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  line-height: 1.55;
}

.note-text-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.note-text-panel label {
  margin-bottom: 0;
}

.tag-row,
.actions {
  margin-top: 12px;
}

@media (max-width: 720px) {
  .automation-hub { grid-template-columns:1fr; }.plan-entry-card { min-height:108px; }.automation-form-grid { grid-template-columns:1fr; }.automation-wide { grid-column:auto; }.automation-panel-head, .automation-plan { align-items:flex-start; flex-direction:column; }.automation-plan { display:flex; }.automation-plan-actions { justify-content:flex-start; }
  .automation-background-row { align-items: stretch; }.automation-background-row select { min-width: 0; width: 100%; flex: none; }
  .topbar,
  .import-row,
  .toolbar,
  .reference-row,
  .batch-actions,
  .selection-actions,
  .primary-actions,
  .copywriting-actions,
  .tag-row,
  .actions,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  main {
    padding: 16px;
  }

  .site-footer {
    padding: 8px 16px 24px;
  }

  .toolbar select {
    max-width: none;
  }

  .reference-row {
    grid-template-columns: 1fr;
  }

  .batch-actions,
  .copywriting-actions {
    grid-template-columns: 1fr;
  }

  .primary-actions {
    justify-content: stretch;
  }

  .selection-actions button,
  .primary-actions button {
    width: 100%;
  }

  .copywriting-status {
    justify-self: stretch;
  }

}

.image-preview-stage img { max-height:calc(76vh - 150px); }

.topbar-actions,.cost-filters,.quick-range,.cost-dashboard-controls { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.cost-dashboard { margin-top:26px; padding:30px 48px 40px; border:1px solid #dbe6f8; background:#fff; display:grid; gap:32px; }.cost-dashboard-head { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:start; gap:24px; padding-bottom:30px; border-bottom:1px solid #dbe3ef; }.cost-dashboard h2,.cost-dashboard h3 { margin:0; color:#111827; }.cost-dashboard-title > span { color:#2864e8; font-size:15px; font-weight:800; }.cost-dashboard-title h2 { margin-top:12px; font-size:32px; letter-spacing:-.04em; }.cost-dashboard-head p { color:#71809a; margin:12px 0 0; font-size:16px; }.cost-dashboard-controls { justify-content:flex-end; padding-top:2px; }.quick-range { gap:0; }.quick-range button { min-width:82px; margin:0; border-radius:0; border-color:#d6e0f0; background:#fff; color:#52627b; box-shadow:none; }.quick-range button:first-child { border-radius:9px 0 0 9px; }.quick-range button:last-child { border-radius:0 9px 9px 0; }.quick-range button + button { margin-left:-1px; }.quick-range button.active,.quick-range button:hover { position:relative; border-color:#2864e8; background:#2864e8; color:#fff; z-index:1; }.cost-filters { gap:12px; }.cost-filters label { margin:0; font-size:14px; color:#60708b; font-weight:700; }.cost-filters input { display:block; width:170px; margin-top:7px; padding:12px 14px; border:1px solid #d6e0f0; border-radius:8px; color:#172033; font-weight:700; background:#fff; }.cost-filters button { align-self:end; min-height:43px; }.cost-range-separator { align-self:end; padding-bottom:13px; color:#71809a; }.cost-back-button { align-self:start; }.cost-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; }.cost-metric,.cost-card { border:1px solid #d6e3fa; border-radius:18px; background:linear-gradient(135deg,#fbfdff,#fff); }.cost-metric { min-height:116px; padding:20px 30px; }.cost-metric > span { color:#62728d; font-size:16px; font-weight:800; }.cost-metric > div { display:flex; align-items:baseline; gap:8px; margin-top:20px; }.cost-metric strong { color:#1d5bd8; font-size:43px; line-height:.8; letter-spacing:-.06em; }.cost-metric em { color:#53637c; font-size:16px; font-style:normal; font-weight:700; }.cost-metric i { height:30px; margin:0 8px; border-left:1px solid #cddcf5; }.cost-metric b { color:#44658f; font-size:20px; }.cost-content-grid { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(360px,.8fr); gap:22px; }.cost-side-stack { display:grid; align-content:start; gap:18px; }.cost-card { padding:28px 30px; }.cost-card h3 { font-size:20px; }.cost-card-heading { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }.cost-card-heading > span { color:#71809a; font-size:14px; }.cost-trend-summary { margin:12px 0 24px; color:#71809a; font-weight:600; }.cost-trend { min-height:242px; display:grid; align-content:end; gap:13px; padding-top:25px; border-bottom:1px solid #d6e3f5; }.trend-row { display:grid; grid-template-columns:54px 1fr 36px; align-items:center; gap:12px; color:#71809a; font-size:13px; }.trend-row i { height:18px; background:#f1f5fc; border-radius:3px 3px 0 0; overflow:hidden; }.trend-row i b { display:block; height:100%; background:linear-gradient(90deg,#3175ef,#5f97fb); border-radius:3px 3px 0 0; }.trend-row strong { color:#2864e8; text-align:right; }.cost-configuration { display:grid; gap:12px; margin-top:22px; }.cost-configuration > div { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:12px; padding:15px 16px; border:1px solid #dbe5f4; border-radius:12px; }.cost-configuration i { width:10px; height:10px; border-radius:50%; background:#14b87a; }.cost-configuration span { color:#20293a; font-weight:800; }.cost-configuration small { display:block; margin-top:4px; color:#62728d; font-size:14px; font-weight:600; }.cost-configuration b { color:#2864e8; font-size:14px; }.cost-sync-status strong { color:#b45309; }.cost-sync-status p { color:#71809a; line-height:1.65; }.cost-table-wrap { overflow:auto; }.cost-card table { width:100%; border-collapse:collapse; font-size:13px; }.cost-card th,.cost-card td { padding:11px 10px; border-bottom:1px solid var(--line); text-align:left; white-space:nowrap; }.cost-card th { color:var(--muted); background:#f8fafc; }.cost-pending { color:#b45309; font-weight:700; }.empty-state { color:#71809a; text-align:center; }
@media (min-width:981px) and (max-width:1300px) { .cost-dashboard { padding:28px 36px 36px; }.cost-dashboard-head { gap:16px; }.quick-range button { min-width:72px; padding-left:12px; padding-right:12px; }.cost-filters { gap:8px; }.cost-filters input { width:150px; }.cost-filters button { padding-left:14px; padding-right:14px; } }
@media (max-width:980px) { .cost-dashboard { padding:28px; }.cost-dashboard-head { grid-template-columns:1fr; }.cost-dashboard-controls { justify-content:flex-start; }.cost-back-button { position:absolute; right:38px; top:28px; }.cost-content-grid { grid-template-columns:1fr; } }
@media (max-width:720px) { .cost-dashboard { position:relative; padding:24px 18px; }.cost-dashboard-title h2 { font-size:28px; }.cost-dashboard-head { padding-top:50px; }.cost-back-button { top:20px; right:18px; }.cost-dashboard-controls,.cost-filters { align-items:stretch; }.cost-filters label { flex:1 1 145px; }.cost-filters input { width:100%; box-sizing:border-box; }.cost-range-separator { display:none; }.quick-range { width:100%; }.quick-range button { flex:1; min-width:0; }.cost-metrics { grid-template-columns:1fr; }.cost-metric { min-height:0; }.cost-content-grid { gap:16px; }.cost-card { padding:22px 18px; }.cost-card-heading { align-items:flex-start; flex-direction:column; }.cost-trend { min-height:190px; } }

/* Keep this dashboard on the same compact type scale and column chart as the copy system. */
.cost-dashboard-title h2 { font-size:28px; }.cost-dashboard-head p { font-size:14px; }.cost-metric { min-height:92px; padding:18px 30px; }.cost-metric > span { font-size:14px; }.cost-metric > div { margin-top:16px; }.cost-metric strong { font-size:30px; }.cost-metric em { font-size:14px; }.cost-metric b { font-size:17px; }.cost-metric i { height:24px; margin:0 5px; }.cost-card { padding:22px 30px; }.cost-card h3 { font-size:18px; }.cost-card-heading > span,.cost-trend-summary { font-size:13px; }.cost-trend-summary { margin:10px 0 18px; }.cost-trend { min-height:0; display:block; padding:0; border:0; }.trend-chart { display:flex; align-items:stretch; height:210px; padding:0 18px; border-bottom:1px solid #d6e3f5; background:repeating-linear-gradient(to bottom,transparent 0,transparent 64px,#edf3fb 65px,transparent 66px); }.trend-column { flex:1; min-width:0; display:grid; grid-template-rows:25px 1fr 44px; justify-items:center; }.trend-column b { align-self:end; color:#2864e8; font-size:13px; font-weight:700; }.trend-column i { display:flex; align-items:end; width:28px; height:100%; }.trend-column i span { display:block; width:100%; min-height:4px; border-radius:5px 5px 0 0; background:linear-gradient(90deg,#3175ef,#5f97fb); }.trend-column em { align-self:start; padding-top:15px; color:#71809a; font-size:12px; font-style:normal; transform:rotate(-45deg); transform-origin:top center; white-space:nowrap; }.cost-configuration > div { padding:13px 16px; }.cost-configuration small,.cost-configuration b { font-size:12px; }
.cost-dashboard { font-size:14px; }
.cost-dashboard .cost-dashboard-title h2 { font-size:24px; }
.cost-dashboard .cost-dashboard-title > span { font-size:13px; }
.cost-dashboard .cost-dashboard-head p,
.cost-dashboard .cost-filters label,
.cost-dashboard .cost-metric > span,
.cost-dashboard .cost-metric em { font-size:13px; }
.cost-dashboard button,
.cost-dashboard .cost-filters input { font-size:14px; }
.cost-dashboard .cost-metric strong { font-size:26px; }
.cost-dashboard .cost-metric b { font-size:15px; }
.cost-dashboard .cost-card h3 { font-size:16px; }
.cost-sync-card { display:none; }
.cost-content-grid { align-items:start; }
/* One header plus ten 40px records; additional records scroll inside the table. */
.cost-table-wrap { max-height:441px; overflow:auto; margin-top:12px; }
.cost-table-wrap th,.cost-table-wrap td { box-sizing:border-box; height:40px; padding:9px 10px; line-height:21px; }
.cost-table-wrap thead { position:sticky; top:0; z-index:1; background:#f8fafc; }
.cost-table-wrap:focus-visible { outline:2px solid #2864e8; outline-offset:3px; }
.cost-dashboard-head { grid-template-columns:minmax(220px,1fr) auto; }
.cost-dashboard-controls { align-items:flex-end; flex-wrap:nowrap; }
.cost-dashboard .quick-range { flex-wrap:nowrap; gap:8px; }
.cost-dashboard .quick-range button { border:1px solid #d6e0f0; border-radius:8px; margin:0; }
.cost-dashboard .quick-range button.active { border-color:#2864e8; }
.cost-dashboard .quick-range button,.cost-dashboard .cost-filters input,.cost-dashboard #costQueryBtn { height:44px; min-height:44px; }
.cost-dashboard .cost-filters { align-items:flex-end; flex-wrap:nowrap; }
@media (max-width:1100px) { .cost-dashboard-head { grid-template-columns:1fr; }.cost-dashboard-controls { justify-content:flex-start; } }
@media (max-width:720px) { .cost-dashboard-head { padding-top:0; }.cost-dashboard-controls,.cost-dashboard .cost-filters { flex-wrap:wrap; } }

/* Keep failure diagnostics readable, including the request reference. */
.follow-candidate .follow-candidate-error { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; line-height:1.5; }
