:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e2e5ea;
  --text: #1f2329;
  --text-2: #5f6672;
  --text-3: #9aa1ac;
  --accent: #185fa5;
  --accent-2: #e6f1fb;
  --danger: #a32d2d;
  --danger-bg: #fcebeb;
  --radius: 12px;
}

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

body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
}
.topbar-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: baseline; gap: 14px; }
.topbar h1 { font-size: 18px; font-weight: 600; }
.topbar .sub { color: var(--text-2); font-size: 13px; }

.layout {
  max-width: 1200px; margin: 0 auto; padding: 20px 24px;
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px; align-items: start;
}

.left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.right { min-width: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

/* 上传卡片 */
.field-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
#model-select {
  width: 100%; padding: 8px 10px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text);
  margin-bottom: 14px; cursor: pointer;
}
#model-select:focus { outline: none; border-color: var(--accent); }

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 10px; padding: 26px 14px;
  text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent); background: var(--accent-2);
}
.dz-main { font-size: 14px; }
.dropzone .hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }

.options { display: flex; gap: 22px; margin-top: 14px; }
.opt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.opt input { width: 15px; height: 15px; accent-color: var(--accent); }

.file-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 14px;
  background: var(--bg); border-radius: 8px; padding: 10px 12px;
}
.file-info { display: flex; flex-direction: column; min-width: 0; }
#file-name { font-weight: 600; word-break: break-all; }
#file-size { color: var(--text-3); font-size: 12px; }

button {
  font-size: 14px; padding: 8px 18px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  cursor: pointer; transition: background .15s;
}
button:hover { background: #f0f2f5; }
button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  flex-shrink: 0;
}
button.primary:hover { background: #0c447c; }
button.primary:disabled { background: #9db8d4; border-color: #9db8d4; cursor: not-allowed; }
button.small { padding: 4px 12px; font-size: 12px; }

/* 进度卡片 */
.progress-head { display: flex; justify-content: space-between; align-items: baseline; }
.progress-head .status { font-weight: 600; }
.progress-head .elapsed { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.bar {
  height: 8px; border-radius: 999px; background: var(--bg);
  margin-top: 10px; overflow: hidden;
}
#progress-bar {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--accent); transition: width .4s ease;
}
.progress-sub { color: var(--text-3); font-size: 12px; margin-top: 8px; }
.error {
  margin-top: 10px; background: var(--danger-bg); color: var(--danger);
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
  white-space: pre-wrap; word-break: break-all;
}

/* 结果卡片 */
.result-head { display: flex; justify-content: space-between; align-items: center; }
.result-head h2 { font-size: 15px; font-weight: 600; }
.tabs { display: flex; gap: 6px; }
.tab {
  padding: 4px 14px; font-size: 13px; border-radius: 999px;
  color: var(--text-2); border-color: var(--border);
}
.tab.active { background: var(--accent-2); color: var(--accent); border-color: var(--accent); }
.result-meta { color: var(--text-3); font-size: 12px; margin: 8px 0 10px; }
#result-content {
  background: var(--bg); border-radius: 8px; padding: 14px 16px;
  font-family: Consolas, "Courier New", monospace; font-size: 13px;
  white-space: pre-wrap; word-break: break-word; max-height: 480px; overflow: auto;
  line-height: 1.8;
}
.downloads { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.downloads a {
  font-size: 13px; color: var(--accent); text-decoration: none;
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 14px;
}
.downloads a:hover { background: var(--accent-2); border-color: var(--accent); }

/* 历史侧栏 */
.history-card { position: sticky; top: 20px; }
.history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.history-head h2 { font-size: 15px; font-weight: 600; }
#history-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
#history-list li {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
#history-list li:hover { border-color: var(--accent); background: var(--accent-2); }
#history-list li.active { border-color: var(--accent); background: var(--accent-2); }
.h-item-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.h-name { font-weight: 600; font-size: 13px; word-break: break-all; }
.h-model {
  font-size: 11px; background: var(--bg); border-radius: 6px; padding: 1px 8px;
  color: var(--text-2); white-space: nowrap; flex-shrink: 0;
}
.h-meta { color: var(--text-3); font-size: 12px; margin-top: 3px; }
.h-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.h-actions button { padding: 2px 10px; font-size: 12px; }
.h-del:hover { color: var(--danger); border-color: var(--danger); }

.hint { color: var(--text-3); font-size: 12px; }
.hint.bottom { margin-top: 12px; }

/* 小屏适配 */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .history-card { position: static; }
}

.loading { color: var(--text-3); text-align: center; padding: 14px 0; font-size: 13px; }
