:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ok: #16a34a;
  --err: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; }
.brand .dot { margin: 0 6px; color: var(--primary); }
.brand small { font-weight: 400; color: var(--muted); }
.user { display: flex; align-items: center; gap: 12px; color: var(--muted); }

.link { background: none; border: 0; color: var(--primary); cursor: pointer; font-size: 14px; padding: 2px 4px; }

.tabs { display: flex; gap: 6px; padding: 10px 18px 0; max-width: 1080px; margin: 0 auto; }
.tab {
  border: 1px solid transparent; background: none; padding: 8px 14px; cursor: pointer;
  border-radius: 8px 8px 0 0; color: var(--muted); font-size: 15px;
}
.tab.active { background: #fff; border-color: var(--line); border-bottom-color: #fff; color: var(--text); font-weight: 600; }

main { max-width: 1080px; margin: 0 auto; padding: 14px 18px 60px; }
.view { display: none; }
.view.active { display: block; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 14px; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 18px 0 10px; color: #111827; }
.row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--muted); }
input[type=number], select {
  height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px;
  background: #fff; font-size: 15px; color: var(--text);
}

.uploads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.upload {
  display: flex; flex-direction: column; gap: 4px; padding: 12px;
  border: 1px dashed #c7d2fe; border-radius: var(--radius); background: #f8faff; cursor: pointer;
}
.upload .t { font-weight: 600; }
.upload .d { font-size: 12px; color: var(--muted); }
.upload input[type=file] { font-size: 12px; margin-top: 4px; }
.upload input[type=file]::file-selector-button {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 8px; cursor: pointer;
}

.radios { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 10px; }
.radios label, .check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check { margin-top: 16px; color: var(--muted); }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; }

button.primary, .btn-link.primary {
  background: var(--primary); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 18px; font-size: 15px; cursor: pointer; text-decoration: none; display: inline-block;
}
button.primary:hover, .btn-link.primary:hover { background: var(--primary-dark); }
button.primary:disabled { opacity: .6; cursor: progress; }

.error { color: var(--err); margin: 10px 0 0; }
.muted { color: var(--muted); }

.job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: #eef2ff; color: #3730a3; }
.badge.done { background: #dcfce7; color: #166534; }
.badge.failed { background: #fee2e2; color: #991b1b; }
.badge.running, .badge.queued { background: #fef3c7; color: #92400e; }

.progress { height: 10px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin: 14px 0 8px; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, #60a5fa, #2563eb); transition: width .4s; }

.result { margin-top: 18px; }
.result-actions { margin-bottom: 12px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.gallery img { width: 100%; display: block; cursor: zoom-in; }
.gallery figcaption { font-size: 12px; padding: 6px 8px; color: var(--muted); }

.file-list { list-style: none; padding: 0; margin: 14px 0 0; }
.file-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.file-list a { color: var(--primary); text-decoration: none; }

.logbox { margin-top: 18px; }
.logbox summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.logbox pre {
  background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px;
  max-height: 300px; overflow: auto; font-size: 12px; line-height: 1.5; white-space: pre-wrap;
}

.archive-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.archive-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; flex-wrap: wrap;
}
.archive-row .meta { font-size: 13px; color: var(--muted); }
.archive-row .ops { display: flex; gap: 12px; }
.archive-row a { color: var(--primary); text-decoration: none; font-size: 14px; }

.lightbox {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .85); display: flex;
  align-items: center; justify-content: center; z-index: 50; cursor: zoom-out; padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 100%; }

/* 登录页 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 28px 24px; box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}
.login-card h1 { font-size: 20px; margin: 0; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 6px 0 20px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.login-card input {
  width: 100%; height: 40px; margin-top: 6px; border: 1px solid var(--line);
  border-radius: 8px; padding: 0 12px; font-size: 15px;
}
.login-card button {
  width: 100%; height: 42px; border: 0; border-radius: 8px; background: var(--primary);
  color: #fff; font-size: 15px; cursor: pointer; margin-top: 4px;
}
.login-card button:hover { background: var(--primary-dark); }

@media (max-width: 720px) {
  .row, .uploads { grid-template-columns: 1fr; }
  .tabs { padding: 8px 12px 0; overflow-x: auto; }
  main { padding: 12px; }
  .card { padding: 14px; }
}
