:root {
  --purple: #7c3aed;
  --purple-dark: #6d28d9;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #7c8394;
  --line: #e6e9f0;
  --green: #16a34a;
  --orange: #d97706;
  --red: #dc2626;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 13px;
}

body { display: flex; flex-direction: column; }

/* ------------------------------ 顶栏 ------------------------------ */
.topbar {
  height: 64px;
  flex: 0 0 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), #a78bfa);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.brand h1 { font-size: 16px; margin: 0; }
.brand .sub { margin: 2px 0 0; font-size: 11px; color: var(--muted); }

.top-right { display: flex; gap: 8px; }

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef0f6;
  color: #4b5162;
  font-size: 12px;
}

.badge-on { background: #e7f7ee; color: var(--green); }
.badge-off { background: #fdecec; color: var(--red); }
.badge-run { background: #f1ebff; color: var(--purple); }

/* ------------------------------ 布局 ------------------------------ */
.layout {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 16px;
  padding: 16px;
}

.side {
  width: 340px;
  flex: 0 0 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ------------------------------ 卡片 ------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

label input,
label select {
  display: block;
  width: 100%;
  margin-top: 5px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

label input:focus,
label select:focus {
  border-color: var(--purple);
  background: #fff;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

label.check input { width: 15px; height: 15px; margin: 0; }

.row { display: flex; gap: 8px; margin-bottom: 10px; }
.row .btn { flex: 1; }

.hint { margin: 6px 0 0; font-size: 11px; color: var(--muted); }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}

.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn.primary { background: var(--purple); color: #fff; }
.btn.primary:not(:disabled):hover { background: var(--purple-dark); }

.btn.danger { background: #fdecec; color: var(--red); border-color: #f6c9c9; }
.btn.danger:not(:disabled):hover { background: #fadada; }

.btn.ghost { background: #f2f3f8; color: #3a4053; border-color: var(--line); }
.btn.ghost:not(:disabled):hover { background: #e9ebf3; }

.btn.small { height: 28px; font-size: 12px; padding: 0 10px; }

/* ------------------------------ 状态条 ------------------------------ */
.statusbar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-main { display: flex; align-items: center; gap: 10px; font-weight: 600; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c3c8d4;
}

.dot.running { background: var(--purple); animation: pulse 1.2s infinite; }
.dot.working { background: var(--orange); animation: pulse 1s infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, .35); }
  70% { box-shadow: 0 0 0 8px rgba(124, 58, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

.status-sub { color: var(--muted); font-size: 12px; }

/* ------------------------------ 面板 ------------------------------ */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 { margin: 0; font-size: 13px; }

.lines-panel { flex: 1.2; min-height: 220px; }
.log-panel { flex: 1; min-height: 180px; }

.table-wrap { flex: 1; overflow: auto; }

table { width: 100%; border-collapse: collapse; white-space: nowrap; }

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8f9fc;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #f2f3f7;
  font-size: 12px;
}

tbody tr:hover { background: #fafbff; }
tbody tr.disabled { color: #b4b9c6; }

td.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #eef0f6;
  color: #4b5162;
}

.tag.ok { background: #e7f7ee; color: var(--green); }
.tag.warn { background: #fdf3e7; color: var(--orange); }
.tag.err { background: #fdecec; color: var(--red); }

/* ------------------------------ 日志 ------------------------------ */
.log-box {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.7;
}

.log-line { color: #4b5162; word-break: break-all; }
.log-line .t { color: #a0a6b5; margin-right: 8px; }
.log-line.warn { color: var(--orange); }
.log-line.error { color: var(--red); }
.log-line.debug { color: #9197a8; }

/* ------------------------------ 统计 ------------------------------ */
.next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #f7f5ff;
  color: #5b4bb7;
  font-size: 12px;
}

.next strong { font-size: 16px; font-family: Consolas, monospace; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.stats div {
  background: #f8f9fc;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats span { color: var(--muted); font-size: 11px; }
.stats b { font-size: 16px; color: var(--text); font-weight: 600; }

/* ------------------------------ Toast ------------------------------ */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  padding: 10px 16px;
  border-radius: 8px;
  background: #23272f;
  color: #fff;
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  transition: opacity .2s, transform .2s;
  z-index: 100;
}

.toast.error { background: #b91c1c; }
.toast.success { background: #15803d; }
.toast.hidden { opacity: 0; transform: translateY(8px); pointer-events: none; }

.platform-overview { display: flex; flex-direction: column; gap: 8px; }
.platform-item { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.platform-item strong { margin-right: auto; }
.captcha-image { width: 125px; height: 42px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
#captchaGroup[hidden] { display: none; }
.brand .logo { object-fit: contain; background: transparent; border-radius: 0; width: 44px; height: 48px; }

html,body { font-size: 14px; }
.admin-login { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(ellipse at 20% 10%,#e4eaff,transparent 60%),#f5f6fa; }
.login-card { width: min(420px,100%); padding: 32px; box-shadow: 0 16px 48px #27345912; }
.login-icon { width: 68px; height: 68px; object-fit: contain; }
.login-card h1 { font-size: 24px; margin: 12px 0 6px; }
.login-card .hint { margin-bottom: 24px; font-size: 14px; }
.login-card label { font-size: 14px; }
.login-card input { height: 44px; font-size: 16px; }
.login-card button { width: 100%; height: 44px; margin-top: 8px; font-size: 16px; }
#adminError,#historyError { color: var(--red); margin: 8px 14px; }
.history-panel { flex: .6; min-height: 160px; }
.history-panel .empty { padding: 16px; }
@media (max-width: 850px) {
 html,body { height:auto; min-height:100%; }
 .topbar { height:auto; min-height:76px; flex-wrap:wrap; gap:12px; padding:12px 16px; }
 .brand .sub { font-size:12px; }
 .top-right { flex-wrap:wrap; }
 .layout { display:block; padding:12px; }
 .side { width:100%; display:grid; grid-template-columns:repeat(auto-fit,minmax(270px,1fr)); overflow:visible; margin-bottom:12px; }
 .content { display:flex; }
 .lines-panel { min-height:300px; max-height:500px; }
 .log-panel { height:340px; flex:none; }
 .history-panel { height:240px; flex:none; }
 .statusbar { flex-wrap:wrap; gap:8px; }
 .table-wrap { overflow:auto; }
 label { font-size:14px; }
 .hint { font-size:12px; }
}
