:root {
  --bg: #0d0f14;
  --panel: #151922;
  --panel-2: #1c2230;
  --line: #262d3d;
  --text: #e6e9f0;
  --dim: #8b94a7;
  --primary: #ffb648;
  --primary-2: #ff9a1f;
  --ok: #35d07f;
  --warn: #ffcc4d;
  --bad: #ff5c6c;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2030 0%, var(--bg) 60%);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.dim { color: var(--dim); }
.spacer { flex: 1; }
.err { color: var(--bad); margin: 8px 0 0; font-size: 13px; }
.hint { color: var(--dim); font-size: 13px; margin: 8px 0 0; }
a.link, .link { color: var(--primary); text-decoration: none; cursor: pointer; }
.as-btn { background: none; border: 0; padding: 0; font: inherit; }

/* ---------- 登录 ---------- */
.view { min-height: 100%; }
#view-login { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.brand { margin: 0 0 4px; font-size: 24px; letter-spacing: 2px; }
.brand-sub { margin: 0 0 20px; color: var(--dim); font-size: 13px; }
.brand-sm { font-weight: 600; letter-spacing: 1px; }
.label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }

/* ---------- 输入 ---------- */
.input {
  width: 100%;
  background: #0f131b;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 182, 72, .15); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  transition: transform .1s, border-color .15s, background .15s;
}
.btn:hover { border-color: #38415a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--primary), var(--primary-2)); color: #201400; border: 0; font-weight: 600; }
.btn-danger { background: #3a1f26; border-color: #5c2b36; color: #ff9aa5; }
.btn-block { width: 100%; margin: 12px 0; padding: 11px; }
.btn-xs { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }

/* ---------- 顶部 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  background: rgba(21, 25, 34, .8); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chip {
  font-size: 12px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
}

/* ---------- 统计 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding: 16px 20px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat-label { font-size: 12px; color: var(--dim); }
.stat-value { font-size: 18px; font-weight: 600; margin-top: 4px; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 16px 20px; flex-wrap: wrap; }

/* ---------- 表格 ---------- */
.table-wrap { margin: 0 20px 24px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.table { width: 100%; border-collapse: collapse; min-width: 680px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.table th { color: var(--dim); font-weight: 500; white-space: nowrap; background: #131720; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #171c27; }
.col-check { width: 40px; }
.empty { text-align: center; color: var(--dim); padding: 28px 0 !important; }
.state { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.dot.idle { background: var(--dim); }
.dot.queued { background: var(--warn); }
.dot.running { background: var(--ok); box-shadow: 0 0 0 3px rgba(53, 208, 127, .18); }
.dot.stopped { background: #5a6377; }
.dot.error { background: var(--bad); }

/* ---------- 模态 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 6, 10, .72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  overflow: auto;
}
.modal-box {
  width: 100%; max-width: 720px;
  background: linear-gradient(180deg, #1a202c, #141821);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  max-height: calc(100vh - 40px); display: flex; flex-direction: column;
}
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 900px; }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.modal-head { border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-foot { border-top: 1px solid var(--line); gap: 10px; justify-content: flex-end; }
.modal-body { padding: 18px; overflow: auto; }
.close { background: none; border: 0; color: var(--dim); font-size: 22px; line-height: 1; cursor: pointer; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--dim); }
.field > span { color: var(--dim); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.section-title { margin: 6px 0 0; font-size: 13px; color: var(--primary); letter-spacing: 1px; }
.inline-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); margin-top: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; }
.chip-check {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; cursor: pointer; color: var(--text);
}
.chip-check:has(input:checked) { border-color: var(--primary); color: var(--primary); background: rgba(255, 182, 72, .08); }
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); white-space: nowrap; }
.field-inline .input { width: auto; min-width: 110px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: #1f2634; border: 1px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 999px; z-index: 80; font-size: 13px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
}
.toast.bad { border-color: #5c2b36; color: #ff9aa5; }

@media (max-width: 640px) {
  .topbar { padding: 12px 14px; }
  .stat-row, .toolbar { padding-left: 14px; padding-right: 14px; }
  .table-wrap { margin: 0 14px 20px; }
  .brand { font-size: 20px; }
}