:root {
  --bg: #f7f8fc;
  --panel: #ffffff;
  --panel-soft: #f4f6fb;
  --panel-strong: #eef2f9;
  --border: #e6e9f2;
  --border-strong: #d6dbe7;
  --text: #1c1f2b;
  --text-sub: #4f5668;
  --text-muted: #8a91a3;
  --primary: #3b6cf6;
  --primary-hover: #2f5ce0;
  --primary-soft: #eaf0ff;
  --primary-strong: #284cc9;
  --primary-gradient: linear-gradient(135deg, #4777f5 0%, #3b6cf6 50%, #2f5ce0 100%);
  --primary-glow: 0 6px 18px rgba(59, 108, 246, 0.32);
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 2px 8px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
  --shadow-xl: 0 20px 60px rgba(16, 24, 40, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.1px;
}

/* ========== 应用壳体 ========== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ========== 左侧栏 ========== */
.app-sidebar {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--border);
  -webkit-app-region: drag;
}

.sidebar-brand {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand .brand-title {
  font-size: 15.5px;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.2px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 4px;
  overflow-y: auto;
  -webkit-app-region: no-drag;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-sub);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  white-space: nowrap;
}

.sidebar-nav-item svg {
  flex-shrink: 0;
}

.sidebar-nav-item:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.sidebar-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  -webkit-app-region: no-drag;
}

/* ========== 主内容区 ========== */
.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

input,
textarea,
select {
  user-select: text;
}

.hidden {
  display: none !important;
}

/* 锁定遮罩 - 覆盖在应用之上，阻止交互，但弹窗在其之上 */
.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(16, 24, 40, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: auto;
}

/* 弹窗在锁定遮罩之上 */
.modal {
  z-index: 1000;
}

.toast-container {
  z-index: 1001;
}

/* ========== 布局 ========== */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
  padding: 10px 10px 10px 10px;
  gap: 10px;
  background: var(--bg);
}

.left-panel {
  width: 360px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.left-panel .panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}

.left-panel .panel-scroll::-webkit-scrollbar {
  width: 6px;
}
.left-panel .panel-scroll::-webkit-scrollbar-thumb {
  background: #c7d0e0;
  border-radius: 3px;
}
.left-panel .panel-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.left-panel .panel-footer {
  flex-shrink: 0;
  padding-top: 4px;
}

.center-panel {
  width: 320px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.center-header {
  height: 54px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.center-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.task-item {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.task-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.task-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.task-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 6px;
}

.task-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.task-type {
  font-size: 12px;
  font-weight: 600;
}

.task-count-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
}

.task-type.type-main {
  color: var(--primary);
}

.task-type.type-detail {
  color: #8b5cf6;
}

.task-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--text-muted);
}

.task-status.pending {
  background: #fff7ed;
  color: #ea580c;
}

.task-status.generating {
  background: var(--primary-soft);
  color: var(--primary);
}

.task-status.success {
  background: #ecfdf5;
  color: var(--success);
}

.task-status.failed {
  background: #fef2f2;
  color: var(--danger);
}

.task-info {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.meta-tag {
  font-size: 10.5px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.task-info .task-prompt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}

.task-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.task-thumbnails {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.task-thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel-strong);
  position: relative;
}

.task-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.task-thumb .loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 10px;
  color: var(--primary);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.right-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* ========== 表单区 ========== */
.panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-row {
  display: flex;
  gap: 12px;
}

.panel-section.half {
  flex: 1;
  min-width: 0;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-label::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--primary-gradient);
}

/* ========== 上传区 ========== */
.upload-area {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fafbff 0%, #f4f6fb 100%);
  min-height: 130px;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.upload-area::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(59, 108, 246, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

.upload-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  min-height: 100px;
}

.upload-main:hover {
  background: rgba(59, 108, 246, 0.04);
}

.upload-main.has-images {
  display: none;
}

.upload-area.dragover .upload-main {
  background: var(--primary-soft);
}

.upload-area.has-images {
  border-style: solid;
  border-color: var(--border);
  background: #fff;
  min-height: auto;
  gap: 0;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  padding: 12px;
  text-align: center;
}

.upload-placeholder svg {
  color: var(--primary);
  opacity: 0.7;
}

.upload-text {
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 500;
}

.upload-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* 缩略图插槽 */
.upload-slots {
  display: none;
}

.upload-area.has-images .upload-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.upload-slots .upload-slot {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
}

.upload-slot {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  border: 1.5px dashed var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
  color: var(--text-muted);
}

.upload-slot:hover {
  border-color: var(--primary);
  border-style: solid;
  color: var(--primary);
  transform: translateY(-1px);
}

.upload-slot.filled {
  border-style: solid;
  border-color: var(--border-light);
  background: #fff;
  cursor: pointer;
}

.upload-slot.filled:hover {
  border-color: var(--primary);
}

.upload-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.upload-slot .slot-add {
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
}

.upload-slot .slot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}

.upload-slot:hover .slot-remove {
  opacity: 1;
}

.upload-slot-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  z-index: 3;
}

.upload-slot-loading .spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.upload-count {
  font-size: 11.5px;
  color: var(--primary);
  font-weight: 600;
  padding: 6px 10px;
  margin-top: 8px;
  background: var(--primary-soft);
  border-radius: 6px;
  display: inline-block;
}

.multi-hint {
  font-size: 10.5px;
  color: var(--primary);
  font-weight: 500;
  margin-left: 4px;
}

.remove-img {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.remove-img:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* ========== 输入控件 ========== */
.prompt-input,
.text-input,
.select {
  width: 100%;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  outline: none;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.prompt-input {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

.prompt-input:focus,
.text-input:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 108, 246, 0.12);
}

.select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6272' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* ========== 类型选择按钮 ========== */
.type-group {
  display: flex;
  gap: 8px;
}

.type-btn {
  flex: 1;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.type-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.type-btn.active {
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(59, 108, 246, 0.25);
}

/* ========== 模板多选面板 ========== */
.template-scroll {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  max-height: 210px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px;
}

.template-scroll::-webkit-scrollbar {
  width: 6px;
}
.template-scroll::-webkit-scrollbar-thumb {
  background: #c7d0e0;
  border-radius: 3px;
}
.template-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.template-group {
  padding: 10px 4px 12px 4px;
  display: none;
}
.template-group:last-child {
  border-bottom: none;
}

.template-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.template-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.template-group-select {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
}

.template-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tpl-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: #657084;
  padding-top: 4px;
  padding-bottom: 2px;
}

.tpl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-sub);
  transition: all 0.15s;
  line-height: 1.35;
}
.tpl-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.tpl-item:has(input:checked) {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.tpl-item input[type="checkbox"],
.tpl-item input[type="radio"] {
  accent-color: var(--primary);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}
.tpl-item span {
  flex: 1;
  min-width: 0;
}

/* ========== 模型徽章 ========== */
.model-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
  border-radius: var(--radius);
  border: 1px solid #d8e1fc;
  position: relative;
  overflow: hidden;
}

.model-badge-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-gradient);
}

.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
}

.model-badge svg {
  color: var(--primary);
}

.model-badge-note {
  font-size: 11px;
  color: var(--text-sub);
  margin-left: auto;
}

/* ========== 按钮 ========== */
.btn-primary {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: var(--radius);
  background: var(--primary-gradient);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 4px;
  letter-spacing: 2px;
  box-shadow: 0 6px 18px rgba(59, 108, 246, 0.32);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, transparent 50%);
  pointer-events: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(59, 108, 246, 0.42);
  filter: brightness(1.04);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 14px rgba(59, 108, 246, 0.32);
}

.btn-primary:disabled {
  background: #c5d0ef;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

/* ========== 日志面板 ========== */
.log-section {
  margin-top: 6px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.log-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
}

.log-title::before {
  content: "";
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--primary-gradient);
}

.log-actions {
  display: flex;
  gap: 6px;
}

.log-btn {
  font-size: 11px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.18s;
  font-weight: 500;
}

.log-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.log-box {
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", "Consolas",
    "Microsoft YaHei Mono", monospace;
  font-size: 11.5px;
  line-height: 1.55;
  height: 170px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  tab-size: 2;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.log-box .log-time {
  color: #6e7681;
}

.log-box .log-info {
  color: #79c0ff;
}

.log-box .log-success {
  color: #56d364;
}

.log-box .log-warn {
  color: #d29922;
}

.log-box .log-error {
  color: #ff7b72;
}

.log-box .log-debug {
  color: #8b949e;
}

/* ========== 设置分组 ========== */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.settings-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sub-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
  display: block;
}

.cos-status {
  font-size: 10.5px;
  padding: 2px 10px;
  border-radius: 12px;
  background: #f3f4f6;
  color: var(--text-muted);
  font-weight: 500;
}

.cos-status.ready {
  background: #dcfce7;
  color: #16a34a;
}

.cos-status.missing {
  background: #fef3c7;
  color: #d97706;
}

.cos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cos-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cos-item.full {
  grid-column: 1 / -1;
}

/* ========== 图片放大预览 ========== */
.preview-modal-content {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.preview-image-wrap {
  position: relative;
  display: inline-block;
  max-width: 92vw;
  max-height: 85vh;
  border-radius: 10px;
  overflow: visible;
}

.preview-image-wrap img {
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  display: block;
}

.preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #000;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.preview-close:hover {
  background: #333;
  transform: scale(1.08);
}

.preview-btn {
  padding: 8px 20px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.preview-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.btn-ghost {
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
  font-weight: 500;
}

.btn-ghost:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.text-btn:hover {
  background: var(--panel-soft);
  color: var(--text);
}

/* ========== 预览区 ========== */
.preview-toolbar {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.preview-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg {
  color: #c5c9d4;
  opacity: 0.7;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-sub);
  margin-top: 4px;
}

.empty-state span {
  font-size: 12px;
}

/* ========== 结果卡片 ========== */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.22s, transform 0.22s;
}

.result-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.result-card .card-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 6px;
}

.result-card .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fcfcfe 0%, #ffffff 100%);
}

.result-card .card-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.result-card .card-size {
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--panel-soft);
  padding: 3px 9px;
  border-radius: 5px;
  white-space: nowrap;
  font-weight: 500;
}

.result-card .card-status {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.result-card .img-wrap {
  background: linear-gradient(180deg, #f7f8fa 0%, #eef1f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 14px;
  cursor: zoom-in;
}

.result-card .img-wrap img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 8px;
  transition: transform 0.22s;
}

.result-card .img-wrap:hover img {
  transform: scale(1.02);
}

.result-card .card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.btn-action {
  flex: 1;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-sub);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.18s;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-action:hover {
  background: var(--panel-soft);
  color: var(--text);
  border-color: var(--text-sub);
  transform: translateY(-1px);
}

.btn-action.primary {
  border-color: transparent;
  color: #fff;
  background: var(--primary-gradient);
  box-shadow: 0 3px 10px rgba(59, 108, 246, 0.3);
}

.btn-action.primary:hover {
  box-shadow: 0 5px 14px rgba(59, 108, 246, 0.4);
  filter: brightness(1.04);
}

.result-card .img-wrap .loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 36px 0;
}

.result-card .card-error {
  padding: 28px 16px;
  font-size: 12.5px;
  color: var(--danger);
  line-height: 1.6;
  text-align: center;
}

/* ========== 结果卡片 ========== */

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== 弹窗 ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalIn 0.22s ease;
}

@keyframes modalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.48);
  backdrop-filter: blur(6px);
}

.modal-box {
  position: relative;
  width: 480px;
  max-width: 92vw;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  animation: modalBoxIn 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalBoxIn {
  from { transform: translateY(10px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-box.small {
  width: 380px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fcfcfe 0%, #ffffff 100%);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  font-family: inherit;
}

.icon-btn:hover {
  background: var(--panel-strong);
  color: var(--text);
}

.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  font-size: 14px;
}

.modal-tip {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 2px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #fcfcfe 100%);
}

.modal-footer .btn-primary {
  width: auto;
  padding: 0 28px;
  height: 40px;
  margin-top: 0;
  font-size: 14px;
  letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(59, 108, 246, 0.28);
}

.modal-footer .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 108, 246, 0.38);
}

.alert-message {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ========== 激活弹窗 ========== */
.modal-box-small {
  width: 520px;
}

.activation-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}

.activation-status-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.activation-status.activated .activation-status-icon {
  color: var(--success);
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.activation-status.expired .activation-status-icon {
  color: var(--danger);
  background: #fef2f2;
  border-color: #fecaca;
}

.activation-status-text {
  flex: 1;
  min-width: 0;
}

.activation-status-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.activation-status-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
}

.activation-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.activation-code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.activation-code-input {
  flex: 1;
  min-width: 0;
  font-family: "SF Mono", "Consolas", "Monaco", monospace;
  font-size: 14px;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-weight: 500;
  outline: none;
  transition: border-color 0.18s;
}

.activation-code-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 108, 246, 0.12);
}

.activation-code-input[readonly] {
  background: var(--panel-soft);
  color: var(--text);
}

.activation-code-row .tool-btn {
  flex-shrink: 0;
  height: auto;
  padding: 0 14px;
  font-size: 13px;
}

.activation-code-textarea {
  resize: none;
  word-break: break-all;
  line-height: 1.6;
  min-height: 38px;
  max-height: 160px;
  height: auto;
  overflow-y: hidden;
}

#btn-deactivate.hidden {
  display: none;
}

/* 激活弹窗内 section-label 加大 */
#activation-modal .section-label {
  font-size: 13px;
}

/* 激活弹窗内 modal-tip 加大 */
#activation-modal .modal-tip {
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.6;
}

/* ========== Toast 轻提示 ========== */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #333;
  color: #fff;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.25s ease;
  pointer-events: auto;
  min-width: 160px;
  max-width: 360px;
}

.toast-item.success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.toast-item.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-item.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast-item.info {
  background: linear-gradient(135deg, #3b6cf6, #2554d4);
}

.toast-item .toast-icon {
  flex-shrink: 0;
}

.toast-item .toast-msg {
  line-height: 1.5;
  word-break: break-all;
}

.toast-item.fade-out {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #d3d7e0;
  border-radius: 4px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: #b8bec9;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ========== 功能开发中占位页 ========== */
.under-construction {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: var(--bg);
  padding: 20px;
}

.construction-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 60px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: center;
  min-width: 320px;
}

.construction-content h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.construction-content p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ========== 工具页（压缩/转化） ========== */
.tool-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  padding: 10px;
}

.tool-main {
  flex: 1;
  display: flex;
  gap: 10px;
  min-height: 0;
}

.tool-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tool-col-left {
  flex: 1;
  min-width: 0;
}

.tool-col-right {
  width: 280px;
  flex-shrink: 0;
  padding: 12px;
  gap: 12px;
  overflow-y: auto;
}

.tool-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tool-count-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.tool-btn {
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
}

.tool-btn:hover {
  background: var(--panel-soft);
  color: var(--text);
  border-color: var(--text-sub);
}

.tool-btn.primary {
  border-color: transparent;
  color: #fff;
  background: var(--primary-gradient);
  box-shadow: 0 3px 10px rgba(59, 108, 246, 0.3);
}

.tool-btn.primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 5px 14px rgba(59, 108, 246, 0.4);
}

.tool-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.tool-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.compress-mode-switch {
  display: flex;
  gap: 12px;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-sub);
  user-select: none;
}

.mode-option input[type="radio"] {
  accent-color: var(--primary);
}

.size-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.size-input-row .opt-input {
  flex: 1;
}

.size-unit {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.tool-field-label {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 500;
}

.tool-checkbox-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.tool-save-row {
  display: flex;
  gap: 6px;
}

.tool-estimate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--panel-soft);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.tool-estimate-label {
  color: var(--text-sub);
}

.tool-estimate-value {
  color: var(--primary);
  font-weight: 600;
}

.save-path-input {
  flex: 1;
  min-width: 0;
}

.opt-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
}

.opt-select.full-width {
  width: 100%;
}

.opt-input {
  width: 90px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
}

.opt-input.full-width {
  width: 100%;
}

.tool-run-btn {
  width: 100%;
  height: 42px;
  font-size: 14px;
  justify-content: center;
}

/* 抠图右侧面板 */
.cutout-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cutout-panel-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cutout-panel-actions .tool-btn {
  width: 100%;
  height: 42px;
  font-size: 14px;
  justify-content: center;
}

#btn-cutout-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================================================== */
/* Fengdao AI website edition                                                 */
/* ========================================================================== */

:root {
  --primary: #173c34;
  --primary-hover: #102d27;
  --primary-light: #e9f0ed;
  --bg: #f3f0e9;
  --panel: #fbfaf7;
  --panel-strong: #ffffff;
  --border: #d9d2c6;
  --border-light: #e7e0d5;
  --text: #181713;
  --text-sub: #6f685e;
  --text-muted: #948b7e;
  --accent: #b06442;
  --gold: #9b7c45;
  --shadow: 0 14px 36px rgba(43, 38, 29, 0.08);
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  user-select: auto;
}

body {
  background-image:
    radial-gradient(circle at 12% 8%, rgba(155, 124, 69, 0.08), transparent 27%),
    radial-gradient(circle at 92% 92%, rgba(23, 60, 52, 0.08), transparent 30%);
}

.app-shell {
  width: min(100%, 1600px);
  height: 100vh;
  margin: 0 auto;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  background: transparent;
}

.app-sidebar {
  position: static;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 18px 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(251, 250, 247, 0.94);
  box-shadow: none;
}

.sidebar-brand {
  min-height: 0;
  padding: 4px 6px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.brand-eyebrow,
.studio-kicker {
  color: var(--gold);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.17em;
}

.brand-title {
  color: var(--text);
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.sidebar-brand .brand-title {
  background: none;
  color: var(--text);
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  background-clip: border-box;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.sidebar-nav {
  padding: 14px 0 0;
  gap: 7px;
}

.sidebar-nav-item {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.sidebar-nav-item:hover {
  transform: translateX(2px);
  border-color: var(--border);
  background: #fff;
  color: var(--primary);
}

.sidebar-nav-item.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(23, 60, 52, 0.14);
}

.sidebar-nav-item.active svg {
  color: #d6bd88;
}

.sidebar-footer,
#settings-modal,
#activation-modal,
#lock-overlay {
  display: none !important;
}

.app-body {
  position: static;
  height: auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.studio-topbar {
  min-height: 92px;
  padding: 17px 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(251, 250, 247, 0.96);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.reference-lock-note {
  margin: 10px 0 0;
  padding: 10px 11px;
  border: 1px solid #c7d5d0;
  border-radius: 11px;
  background: #edf3f0;
  color: var(--text-sub);
  font-size: 11px;
  line-height: 1.55;
}

.reference-lock-note strong,
.reference-lock-note span {
  display: block;
}

.reference-lock-note strong {
  margin-bottom: 2px;
  color: var(--primary);
  font-size: 12px;
}

.studio-topbar h1 {
  margin: 3px 0 0;
  font-size: clamp(24px, 2vw, 32px);
  font-weight: 740;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.studio-topbar p {
  margin: 7px 0 0;
  color: var(--text-sub);
  font-size: 12px;
}

.studio-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.studio-badges span {
  padding: 7px 10px;
  border: 1px solid #c7d5d0;
  border-radius: 999px;
  background: #edf3f0;
  color: var(--primary);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.layout,
.tool-page,
.under-construction {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
}

.layout {
  height: auto;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(250px, 290px) minmax(320px, 1fr);
  gap: 12px;
  background: transparent;
}

.left-panel,
.center-panel,
.right-panel,
.tool-col,
.tool-panel {
  border-color: var(--border);
  background: var(--panel);
}

.left-panel,
.center-panel,
.right-panel {
  width: auto;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: none;
}

.left-panel {
  padding: 0;
  gap: 0;
}

.panel-scroll {
  padding: 16px 16px 12px;
  scrollbar-color: #c8bda9 transparent;
  scrollbar-width: thin;
}

.panel-footer,
.center-header,
.preview-toolbar,
.tool-col-header {
  border-color: var(--border-light);
  background: rgba(251, 250, 247, 0.96);
}

.panel-footer {
  padding: 12px 16px 16px;
}

.center-header,
.preview-toolbar {
  min-height: 58px;
  padding: 0 16px;
}

.center-title,
.preview-title,
.tool-panel-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-section {
  margin-bottom: 15px;
}

.section-label,
.tool-field-label,
.sub-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 660;
}

.multi-hint,
.upload-hint,
.empty-state span,
.modal-tip,
.task-meta,
.task-time {
  color: var(--text-muted);
}

.type-group {
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #eee9e0;
}

.type-btn {
  min-height: 39px;
  border: 0;
  border-radius: 10px;
  color: var(--text-sub);
  font-weight: 650;
}

.type-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(23, 60, 52, 0.13);
}

.template-scroll {
  border-color: var(--border);
  border-radius: 14px;
  background: #fff;
}

.tpl-item {
  border-radius: 9px;
  color: var(--text-sub);
}

.tpl-item:hover {
  background: #f3efe7;
  color: var(--primary);
}

.tpl-item:has(input:checked) {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 650;
}

.tpl-item input,
.mode-option input,
.tool-checkbox-label input {
  accent-color: var(--primary);
}

.prompt-input,
.select,
.text-input,
.opt-input,
.opt-select {
  border-color: var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  box-shadow: none;
}

.prompt-input:focus,
.select:focus,
.text-input:focus,
.opt-input:focus,
.opt-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(155, 124, 69, 0.1);
}

.upload-area,
.edit-upload-empty,
.cutout-empty {
  border-color: #cfc4b2;
  border-radius: 14px;
  background: #f7f3eb;
  color: var(--text-sub);
}

.upload-area:hover,
.edit-upload-empty:hover,
.cutout-empty:hover {
  border-color: var(--gold);
  background: #fffaf0;
  color: var(--primary);
}

.upload-placeholder svg,
.empty-state svg,
.edit-upload-empty svg,
.cutout-empty svg {
  color: var(--gold);
}

.btn-primary,
.tool-btn.primary {
  border: 1px solid var(--primary);
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  box-shadow: none;
  font-weight: 680;
}

.btn-primary:hover,
.tool-btn.primary:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.text-btn {
  color: var(--text-sub);
}

.text-btn:hover {
  color: var(--primary);
}

.task-list,
.preview-container,
.edit-preview-wrap,
.cutout-canvas-wrap,
.cutout-result-wrap {
  background-color: #f6f2eb;
}

.task-card,
.result-card,
.tool-panel,
.modal-box {
  border-color: var(--border);
  border-radius: 15px;
  background: #fff;
}

.task-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(23, 60, 52, 0.08);
}

.empty-state {
  color: var(--text-sub);
}

.empty-state p {
  color: var(--text);
}

.tool-page {
  height: 100%;
  overflow: hidden;
}

.tool-main {
  height: 100%;
  padding: 0;
  gap: 12px;
  background: transparent;
}

.tool-col {
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.tool-panel {
  border: 1px solid var(--border);
  box-shadow: none;
}

.toast-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .app-sidebar {
    padding: 12px;
    display: grid;
    grid-template-columns: minmax(190px, auto) 1fr;
    align-items: center;
    gap: 16px;
  }

  .sidebar-brand {
    padding: 3px 12px 3px 3px;
    border-bottom: 0;
    border-right: 1px solid var(--border-light);
  }

  .brand-subtitle {
    display: none;
  }

  .sidebar-nav {
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-nav-item:hover {
    transform: none;
  }

  .app-body {
    min-height: calc(100vh - 28px);
    overflow: visible;
  }

  .layout {
    min-height: 720px;
    grid-template-columns: minmax(300px, 340px) minmax(240px, 280px) minmax(300px, 1fr);
  }
}

@media (max-width: 920px) {
  .app-body {
    display: block;
  }

  .studio-topbar {
    margin-bottom: 12px;
  }

  .layout {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .left-panel,
  .center-panel,
  .right-panel {
    height: auto;
    min-height: 520px;
  }

  .left-panel {
    min-height: 680px;
  }

  .panel-scroll {
    max-height: none;
  }

  .tool-page {
    height: auto;
  }

  .tool-main,
  .tool-main-2col,
  .tool-main-3col {
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
  }

  .tool-col {
    min-height: 460px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 9px;
    gap: 9px;
  }

  .app-sidebar {
    display: block;
    border-radius: 18px;
  }

  .sidebar-brand {
    padding: 2px 4px 11px;
    border-right: 0;
    border-bottom: 1px solid var(--border-light);
  }

  .brand-title {
    font-size: 17px;
  }

  .sidebar-nav {
    padding-top: 9px;
    gap: 5px;
  }

  .sidebar-nav-item {
    min-height: 42px;
    padding: 0 7px;
    justify-content: center;
    gap: 5px;
    font-size: 12px;
  }

  .sidebar-nav-item svg {
    width: 17px;
    height: 17px;
  }

  .studio-topbar {
    padding: 15px;
    border-radius: 18px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .studio-topbar h1 {
    font-size: 25px;
  }

  .studio-badges {
    justify-content: flex-start;
  }

  .layout {
    gap: 9px;
  }

  .left-panel,
  .center-panel,
  .right-panel,
  .tool-col {
    border-radius: 18px;
  }

  .left-panel {
    min-height: 640px;
  }

  .center-panel,
  .right-panel {
    min-height: 420px;
  }

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

  .panel-section.half {
    width: 100%;
  }
}

.tool-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.tool-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 60px 0;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.tool-empty .empty-icon {
  opacity: 0.4;
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--panel-soft);
  transition: all 0.15s;
}

.tool-item:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.tool-item.processing {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.tool-item.success {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.06);
}

.tool-item.failed {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.06);
}

.tool-thumb {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.tool-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tool-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

.tool-status-badge.pending {
  color: var(--text-muted);
  background: var(--panel-strong);
}

.tool-status-badge.processing {
  color: var(--primary);
  background: var(--primary-soft);
}

.tool-status-badge.success {
  color: var(--success);
  background: rgba(16, 185, 129, 0.12);
}

.tool-status-badge.failed {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

.tool-ratio {
  color: var(--success);
  font-weight: 700;
}

.tool-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.tool-action-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.tool-action-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.tool-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* ========== 抠图页 3 栏布局 ========== */
.tool-main-3col {
  display: flex;
  gap: 10px;
  min-height: 0;
  flex: 1;
}

.tool-main-3col .tool-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tool-main-3col .tool-col-left {
  flex: 1;
  min-width: 0;
  max-width: 45%;
}

.tool-main-3col .tool-col-mid {
  flex: 1;
  min-width: 0;
  max-width: 45%;
}

.tool-main-3col .tool-col-right {
  width: 260px;
  flex-shrink: 0;
  padding: 12px;
  gap: 12px;
  overflow-y: auto;
}

/* ========== 图片编辑页 2 栏布局 ========== */
.tool-main-2col {
  display: flex;
  gap: 10px;
  min-height: 0;
  flex: 1;
}

.tool-main-2col .tool-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tool-main-2col .tool-col-left {
  flex: 1;
  min-width: 0;
}

.tool-main-2col .tool-col-right {
  width: 280px;
  flex-shrink: 0;
  padding: 12px;
  gap: 12px;
  overflow-y: auto;
}

.edit-preview-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #fff;
  overflow: hidden;
}

.edit-upload-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 20px;
  border: 2px dashed #d0d5dd;
  border-radius: 12px;
  background: #fafafa;
  width: 100%;
  max-width: 400px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.edit-upload-empty:hover {
  border-color: var(--primary);
  background: #f0f4ff;
  color: var(--primary);
}

.edit-upload-empty svg {
  color: var(--text-muted);
}

.edit-upload-empty:hover svg {
  color: var(--primary);
}

.edit-upload-empty span {
  font-size: 12px;
  color: var(--text-muted);
}

.edit-upload-btn {
  gap: 6px;
}

.edit-size-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.edit-size-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.edit-lock-row {
  margin-top: 10px;
}

.edit-preview-scaler {
  position: relative;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.edit-preview-img {
  display: block;
  max-width: none;
  user-select: none;
}

.upload-filename {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 8px;
  background: var(--bg);
  border-radius: 4px;
}

.full-width {
  width: 100%;
}

.edit-format-row {
  display: flex;
  gap: 20px;
}

/* Canvas 包裹区 */
.cutout-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
  position: relative;
  background: #fff;
  overflow: hidden;
  border-radius: var(--radius);
}

.cutout-canvas-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
}

/* 图片操作按钮组 */
.cutout-img-actions {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.cutout-img-actions.hidden {
  display: none;
}

.cutout-img-actions .tool-btn {
  flex: 1;
  height: 34px;
  justify-content: center;
  font-size: 12.5px;
}

#cutout-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
  box-shadow: var(--shadow);
  border-radius: 4px;
}

#cutout-canvas.hidden {
  display: none;
}

/* 空状态 */
.cutout-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 20px;
  border: 2px dashed #d0d5dd;
  border-radius: 12px;
  background: #fafafa;
  width: 100%;
  max-width: 400px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.cutout-empty:hover {
  border-color: var(--primary);
  background: #f0f4ff;
  color: var(--primary);
}

.cutout-empty svg {
  color: var(--text-muted);
}

.cutout-empty:hover svg {
  color: var(--primary);
}

.cutout-empty .tool-btn.primary svg {
  color: inherit;
}

.cutout-empty .tool-btn.primary:hover svg {
  color: inherit;
}

.cutout-empty p {
  font-size: 14px;
  color: var(--text-sub);
  margin: 0;
}

.cutout-empty span {
  font-size: 12px;
  color: var(--text-muted);
}

/* 底部工具栏 */
.cutout-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
  background: #fff;
}

.cutout-toolbar-left {
  flex: 1;
  min-width: 0;
}

.cutout-toolbar-right {
  display: flex;
  gap: 6px;
}

.cutout-selection-info {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* 结果区 */
.cutout-result-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: var(--bg);
  /* 透明背景棋盘格 */
  background-image:
    linear-gradient(45deg, #ddd 25%, transparent 25%),
    linear-gradient(-45deg, #ddd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd 75%),
    linear-gradient(-45deg, transparent 75%, #ddd 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  overflow: hidden;
}

.cutout-result-wrap .cutout-empty {
  background: transparent;
  border: none;
  padding: 20px;
  max-width: none;
}

.cutout-result-wrap .cutout-empty:hover {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}

.cutout-result-wrap .cutout-empty svg {
  color: var(--text-muted);
}

.cutout-result-wrap .cutout-empty:hover svg {
  color: var(--text-muted);
}

.cutout-result-img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.cutout-result-img.hidden {
  display: none;
}

#btn-cutout-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
