:root {
  --bg: #0f1420;
  --bg2: #161d2e;
  --bg3: #1e2740;
  --border: #2a3554;
  --text: #e6ebf5;
  --muted: #8b96b3;
  --primary: #4f7cff;
  --primary-h: #6b91ff;
  --green: #34c98e;
  --red: #f0616d;
  --yellow: #f5b74e;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
}
a { color: var(--primary-h); text-decoration: none; }
#app { height: 100%; }

/* ---------- 登录页 ---------- */
.login-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% -10%, #1c2a52 0%, var(--bg) 55%);
}
.login-card {
  width: 360px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 36px 32px;
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.auth-tabs { display: flex; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.auth-tabs a { flex: 1; text-align: center; padding: 10px 0; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-size: 14px; }
.auth-tabs a.active { color: var(--text); border-bottom-color: var(--primary); }
.auth-tabs a:hover { color: var(--text); }

/* ---------- 布局 ---------- */
.layout { display: flex; height: 100vh; }
.sidebar {
  width: 210px; flex: none; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.sidebar .brand { font-size: 17px; font-weight: 700; padding: 4px 10px 20px; }
.sidebar .brand small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; margin-top: 3px; }
.sidebar nav { flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 8px;
  color: var(--muted); margin-bottom: 3px; font-size: 14px;
}
.sidebar nav a:hover { background: var(--bg3); color: var(--text); }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .foot { color: var(--muted); font-size: 12px; padding: 10px 12px; }
.sidebar .foot a { cursor: pointer; }
.main { flex: 1; overflow-y: auto; padding: 28px 34px; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.page-desc { color: var(--muted); margin-bottom: 22px; font-size: 13px; }

/* ---------- 组件 ---------- */
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px;
}
.cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .num { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat-card .lbl { color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg3); color: var(--text);
  cursor: pointer; font-size: 13px; transition: .15s;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-h); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; outline: none; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 80px; }
label.fld { display: block; margin-bottom: 14px; }
label.fld span.t { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
label.chk { display: inline-flex; align-items: center; gap: 7px; margin-right: 18px; color: var(--text); font-size: 13px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
tr:hover td { background: rgba(79,124,255,.04); }
td.mono, .mono { font-family: Consolas, Menlo, monospace; font-size: 12px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.badge.queued    { background: rgba(139,150,179,.15); color: var(--muted); }
.badge.running   { background: rgba(79,124,255,.15); color: var(--primary-h); }
.badge.succeeded { background: rgba(52,201,142,.15); color: var(--green); }
.badge.failed    { background: rgba(240,97,109,.15); color: var(--red); }
.badge.cancelled { background: rgba(139,150,179,.15); color: var(--muted); }
.badge.expired   { background: rgba(245,183,78,.15); color: var(--yellow); }
.badge.on  { background: rgba(52,201,142,.15); color: var(--green); }
.badge.off { background: rgba(240,97,109,.15); color: var(--red); }

/* modal */
.modal-mask {
  position: fixed; inset: 0; background: rgba(5,8,16,.66); display: flex;
  align-items: flex-start; justify-content: center; padding: 60px 20px; z-index: 100; overflow-y: auto;
}
.modal {
  width: 640px; max-width: 100%; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px 26px;
}
.modal h3 { margin-bottom: 18px; font-size: 16px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* toast */
#toast-box { position: fixed; top: 18px; right: 18px; z-index: 999; }
.toast {
  background: var(--bg3); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  color: var(--text); padding: 11px 16px; border-radius: 8px; margin-bottom: 10px;
  min-width: 200px; max-width: 380px; font-size: 13px; animation: slidein .2s;
}
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* code block */
pre.code {
  background: #0b0f1a; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.65;
  font-family: Consolas, Menlo, monospace; color: #c6d4f0; margin: 10px 0 18px;
  white-space: pre;
}
.docs h2 { font-size: 16px; margin: 26px 0 8px; }
.docs h2:first-child { margin-top: 0; }
.docs p { color: var(--muted); line-height: 1.8; margin-bottom: 6px; }
.docs code.inline { background: var(--bg3); padding: 1px 7px; border-radius: 5px; font-size: 12.5px; color: #ffd28a; }
.docs table { margin: 10px 0 16px; }

/* playground */
.pg-grid { display: grid; grid-template-columns: 1fr 420px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .pg-grid { grid-template-columns: 1fr; } }
.media-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.media-row select { width: 130px; flex: none; }
.media-row .kind { width: 90px; flex: none; color: var(--muted); font-size: 12px; }
.pg-result video { width: 100%; border-radius: 8px; margin-top: 10px; background: #000; }
.pg-status { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { color: var(--muted); text-align: center; padding: 34px 0; font-size: 13px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.toolbar .sp { flex: 1; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 13px; }
.kv { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.6; }
