* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel2: #1e2740;
  --border: #2a3552;
  --text: #e6ebf5;
  --muted: #8b96b0;
  --primary: #4f7cff;
  --primary-hover: #3a66eb;
  --green: #2ecc8f;
  --red: #ff5f6d;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 48px 40px; width: 360px; text-align: center; margin-top: 15vh;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo { font-size: 42px; margin-bottom: 12px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-sub { color: var(--muted); margin-bottom: 28px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel2); color: var(--text); font-size: 14px;
}
.login-err { color: var(--red); margin-top: 12px; min-height: 18px; font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.logo { font-size: 17px; font-weight: 600; }
.run-status { color: var(--muted); font-size: 12px; }
.run-status.running { color: var(--green); }
.topbar-right { display: flex; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); cursor: pointer; font-size: 13px;
  transition: all .15s;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---------- 主体 ---------- */
.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; text-align: center;
}
.stat-num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-num.small { font-size: 15px; padding-top: 8px; }
.stat-label { color: var(--muted); margin-top: 6px; font-size: 12px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 20px; background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.panel { display: none; }
.panel.active { display: block; }

/* ---------- 工具条 / 表格 ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar select, .toolbar input {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font-size: 13px;
}
.toolbar input { flex: 1; min-width: 200px; }

.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
th { background: var(--panel2); color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(79,124,255,.05); }
td .muted { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px;
  background: rgba(79,124,255,.15); color: #7ea1ff;
}
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; color: var(--muted); }

/* ---------- 平台卡片 ---------- */
.hint { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.6; }
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.plat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
}
.plat-card.disabled { opacity: .55; }
.plat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.plat-name { font-size: 15px; font-weight: 600; }
.plat-kws { display: flex; gap: 8px; }
.plat-kws input {
  flex: 1; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font-size: 12px;
}
.plat-actions { margin-top: 10px; text-align: right; }

/* ---------- 开关 ---------- */
.switch { position: relative; width: 44px; height: 24px; display: inline-block; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--border); border-radius: 24px;
  cursor: pointer; transition: .2s;
}
.slider::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- 添加表单 ---------- */
.add-form { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.add-form input {
  flex: 1; min-width: 180px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel2); color: var(--text); font-size: 13px;
}

/* ---------- 日志 ---------- */
.log-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; max-height: 560px; overflow-y: auto;
  font-family: Consolas, monospace; font-size: 12.5px; line-height: 1.9;
}
.log-line .ts { color: var(--muted); margin-right: 10px; }
.log-line .lv-INFO { color: var(--green); margin-right: 10px; }
.log-line .lv-WARN { color: #f5b342; margin-right: 10px; }
.log-line .lv-ERROR { color: var(--red); margin-right: 10px; }

/* ---------- 设置 ---------- */
.settings-form { max-width: 560px; display: flex; flex-direction: column; gap: 18px; }
.settings-form label { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; }
.settings-form input, .settings-form textarea {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font-size: 13px; font-family: inherit; resize: vertical;
}
.check-line { flex-direction: row !important; align-items: center; }
.check-line input { width: auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 24px; border-radius: 10px; opacity: 0; transition: .25s; z-index: 100;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--red); }

@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-direction: column; gap: 10px; }
}
