:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #101828;
  --muted: #667085;
  --border: #e4e7ec;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f59e0b;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 6px 18px rgba(16, 24, 40, 0.05);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.5px;
}
.brand h1 { margin: 0; font-size: 19px; }
.brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.actions { display: flex; gap: 10px; }

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { border-color: #d0d5dd; background: #f9fafb; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fef2f2; border-color: #fecaca; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: 0.5; cursor: default; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 32px 60px; }
.list-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.list-head h2 { margin: 0; font-size: 17px; }
.muted { color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.12s, box-shadow 0.12s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(16, 24, 40, 0.1), 0 12px 28px rgba(16, 24, 40, 0.08); }
.card-title { font-size: 16px; font-weight: 700; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--muted); }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: #f2f4f7; border-radius: 6px; padding: 2px 8px;
}
.tag.ai { background: #eff6ff; color: var(--primary); }
.tag.ok { background: #ecfdf3; color: #067647; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.card-actions .btn { padding: 6px 12px; font-size: 13px; }

.empty { text-align: center; padding: 90px 0; color: var(--muted); }
.empty-icon { font-size: 46px; margin-bottom: 12px; }
.empty h3 { color: var(--text); margin: 0 0 8px; }
.empty p { max-width: 460px; margin: 0 auto 20px; line-height: 1.6; }

dialog {
  border: none; border-radius: 16px; padding: 0;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.25);
  width: min(560px, 92vw);
}
dialog::backdrop { background: rgba(16, 24, 40, 0.45); }
.dlg-body { padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.dlg-body h3 { margin: 0; font-size: 17px; }
.dlg-body label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--text); }
.dlg-body input, .dlg-body textarea, .dlg-body select {
  border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 12px; font-size: 14px; font-family: inherit;
  background: #fff; color: var(--text);
}
.dlg-body input:focus, .dlg-body textarea:focus, .dlg-body select:focus {
  outline: 2px solid #bfdbfe; border-color: var(--primary);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.hint.error { color: var(--danger); }
.hint.ok { color: #067647; }
.dlg-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.spacer { flex: 1; }

.progress-track { height: 8px; background: #eef2f6; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), #7c3aed); border-radius: 99px; transition: width 0.35s; }
.log {
  background: #0f172a; color: #cbd5e1; border-radius: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px;
  padding: 14px; height: 260px; overflow-y: auto; line-height: 1.7;
  white-space: pre-wrap; word-break: break-all;
}
.log .ok { color: #4ade80; }
.log .err { color: #f87171; }
.log .dim { color: #64748b; }

#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #101828; color: #fff; border-radius: 10px;
  padding: 10px 18px; font-size: 13.5px; z-index: 100;
  box-shadow: 0 8px 30px rgba(16, 24, 40, 0.35);
  max-width: 80vw;
}
