/* ================= 超星任务中心 ================= */
:root {
  --bg: #0b1120;
  --bg-2: #111a2e;
  --card: #141f38;
  --card-2: #1a2745;
  --line: rgba(148, 163, 184, .14);
  --text: #e2e8f0;
  --dim: #8b9ab5;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --grad: linear-gradient(135deg, #6366f1, #22d3ee);
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #38bdf8;
  --gray: #64748b;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }
a { color: var(--accent-2); text-decoration: none; }
.dim { color: var(--dim); }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-size: 13px;
  transition: .15s; user-select: none; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--grad); border: none; color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger { color: #fca5a5; border-color: rgba(239, 68, 68, .35); }
.btn-danger:hover { border-color: var(--red); background: rgba(239, 68, 68, .12); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--line); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- 表单 ---------- */
label.field, .field { display: block; margin-bottom: 14px; }
label.field > span, .field > span.f-label { display: block; color: var(--dim); font-size: 12px; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; background: #0d1526; border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 12px; font-size: 13px; outline: none; transition: .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
select { 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) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.hint { font-size: 11.5px; color: var(--dim); margin: -8px 0 12px; line-height: 1.5; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #26334f; border-radius: 20px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #94a3b8; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--grad); }
.switch input:checked + span::before { transform: translateX(17px); background: #fff; }
.switch-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.switch-row .lbl { font-size: 13px; }

/* ---------- 登录页 ---------- */
.auth-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
.auth-bg { position: absolute; inset: 0; background:
  radial-gradient(600px 400px at 15% 20%, rgba(99, 102, 241, .28), transparent 60%),
  radial-gradient(700px 500px at 85% 80%, rgba(34, 211, 238, .18), transparent 60%), var(--bg); }
.auth-card { position: relative; width: 380px; background: rgba(20, 31, 56, .85); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 18px; padding: 36px 34px; box-shadow: var(--shadow); }
.auth-logo { font-size: 40px; text-align: center; }
.auth-card h1 { text-align: center; font-size: 22px; margin: 8px 0 4px; letter-spacing: 1px; }
.auth-sub { text-align: center; color: var(--dim); font-size: 12.5px; margin-bottom: 22px; }
.auth-hint { margin-top: 16px; font-size: 11.5px; color: var(--dim); text-align: center; line-height: 1.6; }
.tabs { display: flex; background: #0d1526; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.tab { flex: 1; border: none; background: transparent; color: var(--dim); padding: 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px; transition: .15s; }
.tab.active { background: var(--grad); color: #fff; font-weight: 600; }

/* ---------- 布局 ---------- */
.app { display: flex; height: 100vh; }
.sidebar { width: 226px; flex: none; background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 16px; border-bottom: 1px solid var(--line); }
.brand-icon { font-size: 26px; }
.brand b { display: block; font-size: 15px; letter-spacing: .5px; }
.brand small { color: var(--dim); font-size: 11px; }
nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: var(--dim); cursor: pointer; font-size: 13.5px; transition: .15s; position: relative; }
.nav-item i { font-style: normal; width: 18px; text-align: center; }
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, rgba(99, 102, 241, .22), rgba(34, 211, 238, .12)); color: #fff; font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--grad); }
.badge { position: absolute; right: 10px; background: var(--blue); color: #04121f; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#me-info { font-size: 12.5px; color: var(--dim); overflow: hidden; }
#me-info b { color: var(--text); display: block; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px 14px; }
.topbar h2 { font-size: 19px; font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.view { flex: 1; overflow-y: auto; padding: 6px 28px 30px; }

/* ---------- 卡片 / 统计 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -20px; top: -20px; width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle, rgba(99, 102, 241, .25), transparent 70%); }
.stat-card .num { font-size: 28px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-card .lbl { color: var(--dim); font-size: 12.5px; margin-top: 4px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.empty { text-align: center; color: var(--dim); padding: 46px 0; line-height: 2; }
.empty .big { font-size: 34px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--dim); font-size: 12px; font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid rgba(148, 163, 184, .07); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: .12s; }
tbody tr:hover { background: rgba(99, 102, 241, .06); }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 状态标签 ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; padding: 3px 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.running { color: var(--blue); background: rgba(56, 189, 248, .12); }
.pill.running::before { animation: pulse 1.1s infinite; }
.pill.success { color: var(--green); background: rgba(34, 197, 94, .12); }
.pill.failed { color: var(--red); background: rgba(239, 68, 68, .12); }
.pill.pending { color: var(--amber); background: rgba(245, 158, 11, .12); }
.pill.cancelled { color: var(--gray); background: rgba(100, 116, 139, .15); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; font-size: 11.5px; color: var(--dim); }
.tag.admin { color: var(--accent-2); border-color: rgba(34, 211, 238, .4); }

/* ---------- 弹窗 ---------- */
.modal-root { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(2, 6, 18, .65); backdrop-filter: blur(3px); }
.modal { position: relative; width: min(620px, 92vw); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.95) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head b { font-size: 16px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
details.adv { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; background: var(--card); }
details.adv summary { padding: 11px 14px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); list-style: none; display: flex; justify-content: space-between; }
details.adv summary::after { content: "▾"; color: var(--dim); transition: .15s; }
details.adv[open] summary::after { transform: rotate(180deg); }
details.adv .adv-body { padding: 4px 14px 12px; }

/* ---------- 抽屉（日志） ---------- */
.drawer-root { position: fixed; inset: 0; z-index: 65; }
.drawer-mask { position: absolute; inset: 0; background: rgba(2, 6, 18, .6); }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(720px, 94vw); background: var(--bg-2);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head b { font-size: 15px; }
.drawer-tools { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.log-body { flex: 1; overflow: auto; background: #060b16; color: #b7c3d7; padding: 16px 18px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; line-height: 1.65; white-space: pre-wrap; word-break: break-all; }

/* ---------- 课程选择 ---------- */
.course-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.course-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.course-row:hover { background: var(--card-2); }
.course-row input { width: auto; }
.course-row .t { font-size: 13px; }
.course-row .s { font-size: 11.5px; color: var(--dim); }
.course-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column-reverse; gap: 10px; }
.toast { background: var(--card-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); animation: toastin .25s ease; font-size: 13px; max-width: 360px; }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes toastin { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 筛选 chips ---------- */
.chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--dim); padding: 5px 14px; border-radius: 20px; cursor: pointer; font-size: 12.5px; transition: .15s; }
.chip.active { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; }

/* 加载 */
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: rot .8s linear infinite; margin: 30px auto; }
@keyframes rot { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .sidebar { width: 64px; }
  .sidebar .brand div, .nav-item span, .sidebar-foot #me-info { display: none; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
