/* ============================================================
   图片优化生成 · 设计系统
   浅色专业主题 / 圆角卡片 / 细腻阴影 / 无 emoji
   ============================================================ */
:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --border: #e5e8ef;
  --border-strong: #d4d9e3;
  --text: #1c2333;
  --text-2: #5a6478;
  --text-3: #8a93a6;
  --accent: #3370ff;
  --accent-strong: #245bdb;
  --accent-soft: #eef3ff;
  --danger: #d83931;
  --danger-soft: #fdeceb;
  --ok: #2ea121;
  --ok-soft: #e8f7e6;
  --warn: #d5770a;
  --warn-soft: #fdf3e4;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 35, 51, .05), 0 4px 16px rgba(28, 35, 51, .06);
  --shadow-lg: 0 8px 40px rgba(28, 35, 51, .16);
  --font: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

.hidden { display: none !important; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* ========== 顶栏 ========== */
.topbar {
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 700; letter-spacing: .02em;
  color: var(--text);
}
.brand svg { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-menu {
  display: flex; align-items: center; gap: 9px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.user-name {
  max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-2); font-size: 13px; font-weight: 600;
}
.logout-btn { padding: 6px 10px; }

.queue-status {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-2);
  padding: 5px 12px;
  background: var(--bg);
  border-radius: 99px;
  border: 1px solid var(--border);
}
.queue-status .dot { width: 7px; height: 7px; border-radius: 50%; }
.credits-badge { color: var(--accent); }
.credits-badge.negative { color: #dc2626; border-color: rgba(220, 38, 38, 0.35); }
.dot.idle { background: #b6bfcb; }
.dot.busy { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ========== 主体布局 ========== */
.body { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 212px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.tool-item {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
}
.tool-item:hover { background: var(--bg); }
.tool-item.active {
  background: var(--accent-soft);
  border-color: rgba(51, 112, 255, .25);
}
.tool-item .ti-icon {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--bg);
  color: var(--text-2);
  transition: all .15s;
}
.tool-item.active .ti-icon { background: var(--accent); color: #fff; }
.tool-item .ti-name { font-size: 13.5px; font-weight: 600; line-height: 32px; }
.tool-item .ti-desc {
  font-size: 11.5px; color: var(--text-3); margin-top: 1px; line-height: 1.4;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  font-size: 11px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  line-height: 1.7;
}

/* ========== 工作区 ========== */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  gap: 16px;
  padding: 16px;
  min-width: 0;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-head { padding: 18px 20px 6px; flex: none; }
.panel-head h2 { font-size: 16px; font-weight: 700; }
.panel-head p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.panel-head.row {
  display: flex; justify-content: space-between; align-items: flex-start;
}

/* ---- 创作台 ---- */
.studio { overflow-y: auto; }
#studio-form { padding: 10px 20px 16px; display: flex; flex-direction: column; gap: 18px; }

.field-label {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 8px;
}
.field-label .tip { font-weight: 400; font-size: 11.5px; color: var(--text-3); }

/* 上传区 */
.dropzone {
  border: 1.6px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  color: var(--text-3);
  cursor: pointer;
  transition: all .18s;
  background: #fbfcfe;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.dropzone .dz-title { font-size: 13.5px; color: var(--text-2); font-weight: 600; }
.dropzone .dz-title em { color: var(--accent); font-style: normal; }
.dropzone .dz-sub { font-size: 12px; margin-top: 4px; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#f1f3f7 0% 25%, #fff 0% 50%) 0 0 / 14px 14px;
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.preview-item .pv-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px 6px;
  font-size: 10px; line-height: 1.4;
  color: #fff;
  background: rgba(28, 35, 51, .62);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.preview-item .rm {
  position: absolute; top: 5px; right: 5px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(28, 35, 51, .66);
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity .15s;
}
.preview-item:hover .rm { opacity: 1; }
.preview-item .rm svg { width: 11px; height: 11px; }
.rc-bar .rc-meta { font-size: 11px; color: var(--text-3, #98a2b3); white-space: nowrap; }

/* 裁剪选区 */
.crop-stage {
  position: relative;
  margin-top: 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  touch-action: none;
  user-select: none;
}
.crop-stage img { width: 100%; display: block; pointer-events: none; }
.crop-box {
  position: absolute;
  border: 1.5px solid #fff;
  outline: 1px solid rgba(28, 35, 51, .4);
  box-shadow: 0 0 0 9999px rgba(15, 20, 32, .5);
  cursor: move;
}
.crop-box .crop-info {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  color: #fff;
  background: rgba(28, 35, 51, .72);
  pointer-events: none;
  white-space: nowrap;
}
.crop-box .h {
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border: 1px solid rgba(28, 35, 51, .35);
  border-radius: 3px;
}
.crop-box .h.nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-box .h.ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-box .h.sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-box .h.se { right: -8px; bottom: -8px; cursor: nwse-resize; }

/* 输入控件 */
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(51, 112, 255, .14);
}
textarea { resize: vertical; min-height: 40px; }

/* 比例选择 */
.ratio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ratio-chip {
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 7px 0;
  min-width: 56px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
  font-variant-numeric: tabular-nums;
}
.ratio-chip:hover { border-color: var(--accent); color: var(--accent); }
.ratio-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.custom-size { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.custom-size input { width: 96px; padding: 7px 10px; }
.custom-size .cs-label { font-size: 12.5px; color: var(--text-2); }
.custom-size .cs-tip { font-size: 11.5px; color: var(--text-3); }

.seg-row { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg-row button {
  flex: 1; padding: 8px 0; border: none; background: #fff; color: var(--text-2);
  font-size: 13px; cursor: pointer; transition: all .15s;
}
.seg-row button + button { border-left: 1px solid var(--border); }
.seg-row button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* 提交按钮 */
.submit-btn {
  margin: auto 20px 18px;
  flex: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #3d7bff, var(--accent-strong));
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(51, 112, 255, .32);
  transition: all .18s;
}
.submit-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(51, 112, 255, .42); }
.submit-btn:active:not(:disabled) { transform: translateY(0); }
.submit-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ========== 结果区 ========== */
.output { overflow-y: auto; }
.output-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.secondary { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn.secondary:hover { background: #dfe9ff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 空状态 */
.empty {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  color: var(--text-3);
  padding: 30px;
}
.empty p { font-size: 14px; color: var(--text-2); font-weight: 600; margin-top: 12px; }
.empty span { font-size: 12.5px; }

/* 进度 */
.progress-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  padding: 30px;
}
.spinner {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3.5px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-info { text-align: center; display: flex; flex-direction: column; gap: 3px; }
.progress-info strong { font-size: 15px; }
.progress-info span { font-size: 12.5px; color: var(--text-3); }
.elapsed {
  font-size: 12px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
}

/* 错误 */
.error-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  padding: 30px;
  text-align: center;
}
.error-state strong { font-size: 15px; }
.error-state p {
  font-size: 12.5px; color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  max-width: 90%;
  word-break: break-all;
}

/* 结果内容 */
.result-body { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 18px; }

/* 多张增量生成中的横幅 */
.partial-banner {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid rgba(51, 112, 255, .25);
  color: var(--accent);
  font-size: 12.5px;
}
.partial-banner b { font-variant-numeric: tabular-nums; }
.mini-spinner {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(51, 112, 255, .25);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
  flex: none;
}

/* 对比滑块 */
.compare-wrap { display: flex; flex-direction: column; gap: 8px; }
.compare {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#f1f3f7 0% 25%, #fff 0% 50%) 0 0 / 18px 18px;
  user-select: none;
  touch-action: none;
  max-height: 520px;
}
.compare img { display: block; width: 100%; max-height: 520px; object-fit: contain; pointer-events: none; }
.compare-before-clip {
  position: absolute; inset: 0;
  overflow: hidden;
  width: 50%;
  border-right: 2px solid #fff;
  box-shadow: 4px 0 12px rgba(0, 0, 0, .12);
}
.compare-before-clip img {
  display: block;
  max-width: none;
  max-height: 520px;
  object-fit: contain;
}
.compare-handle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 0;
  cursor: ew-resize;
}
.compare-knob {
  position: absolute; top: 50%; left: 0;
  transform: translate(-50%, -50%);
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(28, 35, 51, .3);
  display: grid; place-items: center;
  color: var(--text-2);
}
.compare-tag {
  position: absolute; bottom: 10px;
  font-size: 11px;
  color: #fff;
  background: rgba(28, 35, 51, .55);
  padding: 2px 10px;
  border-radius: 99px;
  backdrop-filter: blur(4px);
}
.compare-tag.left { left: 10px; }
.compare-tag.right { right: 10px; }
.compare-hint { font-size: 11.5px; color: var(--text-3); text-align: center; }

/* 结果网格 */
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: repeating-conic-gradient(#f1f3f7 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
  transition: box-shadow .18s;
}
.result-card:hover { box-shadow: var(--shadow-lg); }
.result-card img {
  width: 100%; aspect-ratio: 1; object-fit: contain; display: block; cursor: zoom-in;
}
.result-card.landscape img { aspect-ratio: auto; max-height: 240px; }
.result-card .rc-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px;
  background: #fff;
  border-top: 1px solid var(--border);
}
.result-card .rc-name {
  font-size: 11.5px; color: var(--text-3);
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rc-dl {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 600;
}
.rc-dl:hover { color: var(--accent-strong); }

/* 重试卡 */
.retry-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafbfe;
  padding: 16px;
}
.retry-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.retry-head strong { font-size: 14px; }
.retry-head span { font-size: 12px; color: var(--text-3); }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  padding: 5px 13px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: all .14s;
  font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.retry-foot { display: flex; justify-content: flex-end; margin-top: 12px; }

/* 尝试记录 */
.attempts { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.attempts-head {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  background: #fafbfe;
  color: var(--text-2);
}
.attempts-head svg { transition: transform .18s; }
.attempts.open .attempts-head svg { transform: rotate(90deg); }
.attempts-list { display: none; }
.attempts.open .attempts-list { display: flex; flex-direction: column; }
.attempt-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}
.attempt-row .idx {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  background: var(--bg); color: var(--text-2);
}
.attempt-row.ok .idx { background: var(--ok-soft); color: var(--ok); }
.attempt-row.bad .idx { background: var(--danger-soft); color: var(--danger); }
.attempt-row .a-main { flex: 1; min-width: 0; }
.attempt-row .a-status { font-weight: 600; }
.attempt-row.ok .a-status { color: var(--ok); }
.attempt-row.bad .a-status { color: var(--danger); }
.attempt-row .a-time { color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.attempt-row .a-prompt {
  color: var(--text-3); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ========== 登录引导 ========== */
.login-gate {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: min(420px, 100%);
  padding: 42px 36px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.login-mark {
  width: 58px; height: 58px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 16px;
}
.login-card h1 { font-size: 22px; line-height: 1.4; }
.login-card p { margin-top: 10px; color: var(--text-2); font-size: 14px; }
.login-platform-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 26px;
  padding: 11px 22px;
  color: #fff; text-decoration: none;
  font-size: 14px; font-weight: 600;
  background: linear-gradient(135deg, #3d7bff, var(--accent-strong));
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(51, 112, 255, .26);
  transition: all .18s;
}
.login-platform-link:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(51, 112, 255, .36); }

/* ========== 历史抽屉 ========== */
.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(28, 35, 51, .38);
  z-index: 60;
  animation: fade .2s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 380px;
  background: var(--panel);
  z-index: 61;
  display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(28, 35, 51, .18);
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h3 { font-size: 15px; }
.drawer-filter {
  display: flex; gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.drawer-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }

.h-item {
  display: flex; gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
}
.h-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.h-thumb {
  flex: none;
  width: 62px; height: 62px;
  border-radius: 6px;
  overflow: hidden;
  background: repeating-conic-gradient(#f1f3f7 0% 25%, #fff 0% 50%) 0 0 / 12px 12px;
  display: grid; place-items: center;
  color: var(--text-3);
}
.h-thumb img { width: 100%; height: 100%; object-fit: cover; }
.h-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.h-row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.h-tool { font-size: 13px; font-weight: 600; }
.h-actions { flex: none; display: flex; align-items: center; gap: 5px; }
.h-delete {
  width: 27px; height: 27px;
  display: grid; place-items: center;
  flex: none;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s;
}
.h-delete:hover { color: var(--danger); background: var(--danger-soft); border-color: rgba(216, 57, 49, .16); }
.h-delete:disabled { opacity: .45; cursor: not-allowed; }
.h-time { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.h-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  flex: none;
  font-size: 10.5px;
  padding: 1px 8px;
  border-radius: 99px;
  font-weight: 600;
}
.badge.queued, .badge.running { background: var(--accent-soft); color: var(--accent); }
.badge.succeeded { background: var(--ok-soft); color: var(--ok); }
.badge.partial { background: var(--accent-soft); color: var(--accent); }
.badge.failed { background: var(--danger-soft); color: var(--danger); }

.h-empty { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 40px 0; }

/* ========== 灯箱 ========== */
.lightbox {
  position: fixed; inset: 0;
  z-index: 80;
  background: rgba(15, 19, 30, .88);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
  animation: fade .18s;
}
.lightbox img {
  max-width: 88vw; max-height: 84vh;
  border-radius: var(--radius);
  box-shadow: 0 20px 80px rgba(0, 0, 0, .5);
}
.lightbox-close {
  position: absolute; top: 18px; right: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .24); }
.lightbox-dl {
  position: absolute; bottom: 22px; left: 50%;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px;
  color: #fff; text-decoration: none;
  background: var(--accent);
  padding: 9px 22px;
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 600;
}
.lightbox-dl:hover { background: var(--accent-strong); }

/* ========== Toast ========== */
.toast-wrap {
  position: fixed; top: 64px; right: 20px;
  z-index: 90;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 11px 16px;
  font-size: 13px;
  max-width: 340px;
  animation: toastIn .22s ease;
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } }
.toast.leaving { transition: all .25s; opacity: 0; transform: translateX(30px); }

/* ========== 响应式 ========== */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; overflow-y: auto; }
  .output { min-height: 480px; }
}
@media (max-width: 860px) {
  .sidebar { width: 64px; }
  .tool-item .ti-text { display: none; }
  .drawer { width: 100vw; }
  .user-name { display: none; }
  .user-menu { padding-left: 8px; }
  .topbar-right { gap: 7px; }
}

/* 平台模型配置 */
.model-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
}
.model-panel {
  width: min(1080px, 96vw);
  max-height: 90vh;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}
.model-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid #edf0f5;
}
.model-head h2 { margin: 0; font-size: 18px; }
.model-head p { margin: 6px 0 0; color: #7b8497; font-size: 12px; }
.model-head .icon-btn { width: 32px; height: 32px; padding: 0; font-size: 24px; }
.model-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); max-height: calc(90vh - 85px); }
.model-list { padding: 16px; overflow-y: auto; border-right: 1px solid #edf0f5; background: #f8fafc; }
.model-list > .btn { width: 100%; margin-bottom: 12px; }
.model-list-item {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #3c465a;
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.model-list-item.active { border-color: #bfcdfd; background: #eaf0ff; color: #2454c6; }
.model-list-item strong, .model-list-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-list-item strong { font-size: 13px; }
.model-list-item span { margin-top: 4px; color: #8992a5; font-size: 11px; }
.model-form { padding: 20px 24px; overflow-y: auto; }
.model-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.model-form-grid label { display: flex; flex-direction: column; gap: 6px; color: #596277; font-size: 12px; }
.model-form-grid input:not([type="checkbox"]), .model-form-grid select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid #dce2ec;
  border-radius: 8px;
  color: #20283a;
  background: #fff;
  outline: none;
}
.model-form-grid input:focus, .model-form-grid select:focus { border-color: #7395ef; box-shadow: 0 0 0 3px #edf2ff; }
.model-form-grid input:disabled { color: #8992a5; background: #f3f5f8; }
.model-wide { grid-column: 1 / -1; }
.model-form-grid .model-check { flex-direction: row; align-items: center; gap: 8px; padding-top: 20px; }
.model-status { min-height: 20px; margin-top: 14px; color: #3370ff; font-size: 12px; }
.model-status.error { color: #d83931; }
.model-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.model-actions .danger { color: #d83931; border-color: #f0c4c0; background: #fff; }
@media (max-width: 760px) {
  .model-modal { padding: 10px; }
  .model-layout { grid-template-columns: 1fr; overflow-y: auto; }
  .model-list { display: flex; gap: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #edf0f5; }
  .model-list > .btn { min-width: 110px; margin: 0; }
  .model-list-item { min-width: 150px; margin: 0; }
  .model-form { overflow: visible; }
  .model-form-grid { grid-template-columns: 1fr; }
  .model-wide { grid-column: auto; }
}

.models-standalone {
  box-sizing: border-box;
  min-height: calc(100vh - 64px);
  padding: 28px;
  background: #f4f6fa;
}
.models-standalone .model-panel {
  width: min(1080px, 100%);
  max-height: none;
  margin: 0 auto;
}
.models-standalone .model-layout { max-height: none; }
.models-standalone .model-list { max-height: calc(100vh - 210px); }
.models-standalone .model-form { max-height: calc(100vh - 210px); }
@media (max-width: 760px) {
  .models-standalone { padding: 12px; }
  .models-standalone .model-list, .models-standalone .model-form { max-height: none; }
}
