* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f1115;
  --sidebar: #161920;
  --panel: #1a1e26;
  --panel-hd: #1f242e;
  --border: #2a303c;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --primary: #4f8cff;
  --primary-hover: #6ba0ff;
  --green: #2ecc71;
  --red: #ff5c5c;
  --orange: #ffb84d;
  --purple: #a78bfa;
  --radius: 12px;
}
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }

/* 登录 */
.login-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(circle at 50% 30%, #1c2333, #0b0d12);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 360px; padding: 40px 36px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-card h2 { font-size: 20px; margin-bottom: 6px; }
.login-sub { color: var(--muted); margin-bottom: 24px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 14px;
  background: #0f1218; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--primary); }
.login-err { color: var(--red); font-size: 12px; margin-top: 10px; min-height: 18px; }

/* 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid var(--border); }
.brand-icon { font-size: 30px; }
.brand-title { font-size: 16px; font-weight: 700; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav { flex: 1; padding: 16px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: 8px; cursor: pointer; color: var(--muted);
  text-decoration: none; transition: .15s;
}
.nav-item:hover { background: #1e232c; color: var(--text); }
.nav-item.active { background: rgba(79,140,255,.15); color: var(--primary); font-weight: 600; }
.nav-item .ni { font-size: 18px; width: 22px; text-align: center; }
.sidebar-foot {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.busy { background: var(--orange); box-shadow: 0 0 8px var(--orange); }

.main { flex: 1; margin-left: 220px; min-width: 0; }
.topbar {
  height: 60px; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.clock { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.icon-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { border-color: var(--primary); }

.page { padding: 24px 28px; }

/* 卡片 */
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--panel-hd);
}
.panel-head h3 { font-size: 15px; font-weight: 600; }
.head-actions { display: flex; gap: 8px; }

/* 统计 */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px;
}
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.c-blue { background: rgba(79,140,255,.15); }
.c-green { background: rgba(46,204,113,.15); }
.c-red { background: rgba(255,92,92,.15); }
.c-purple { background: rgba(167,139,250,.15); }
.stat-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; background: #181c23; }
.table tbody tr:hover { background: #1e232c; }
.table td { font-size: 13px; }
.empty { text-align: center !important; color: var(--muted); padding: 30px !important; }

/* 按钮 */
.btn {
  padding: 9px 16px; background: var(--panel-hd); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; cursor: pointer; font-size: 13px; transition: .15s;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { color: var(--red); }
.btn-block { width: 100%; padding: 12px; }

/* 状态标签 */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-ok { background: rgba(46,204,113,.15); color: var(--green); }
.badge-fail { background: rgba(255,92,92,.15); color: var(--red); }
.badge-on { background: rgba(46,204,113,.15); color: var(--green); }
.badge-off { background: rgba(139,147,163,.15); color: var(--muted); }

/* 快捷操作 */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 20px; }
.action-card {
  background: var(--panel-hd); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; text-align: left; cursor: pointer; color: var(--text); transition: .15s;
}
.action-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.ac-icon { font-size: 28px; margin-bottom: 10px; }
.ac-title { font-weight: 600; margin-bottom: 4px; }
.ac-desc { color: var(--muted); font-size: 12px; }

/* 执行控制 */
.run-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.run-body { padding: 24px; }
.hint { color: var(--muted); margin-bottom: 20px; font-size: 13px; }
.account-checklist {
  max-height: 200px; overflow-y: auto; margin-bottom: 20px;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  background: #0f1218;
}
.account-checklist .ac-item { display: flex; align-items: center; gap: 8px; padding: 7px 4px; cursor: pointer; font-size: 13px; }
.account-checklist .ac-item input { accent-color: var(--primary); }
.account-checklist .muted { color: var(--muted); padding: 10px 4px; font-size: 13px; }
.run-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.progress-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.progress-bar { height: 8px; background: #0f1218; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--green)); transition: width .3s; }
.run-summary { margin-top: 16px; font-size: 13px; }
.console-panel { display: flex; flex-direction: column; }
.console {
  flex: 1; min-height: 400px; max-height: 520px; overflow-y: auto;
  padding: 16px; background: #0c0e13; font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px; line-height: 1.7;
}
.console-line { padding: 2px 0; word-break: break-all; }
.console-line .ct { color: #5c6675; }
.console-line.ok { color: var(--green); }
.console-line.err { color: var(--red); }
.console-line.warn { color: var(--orange); }
.console-line.info { color: #aab3c0; }
.console-line.muted { color: var(--muted); }

/* 表单 */
.form-body { padding: 20px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; margin-bottom: 7px; color: #c9cfda; }
.form-group small { display: block; color: var(--muted); font-size: 11px; margin-top: 6px; }
.form-group input {
  width: 100%; padding: 10px 12px; background: #0f1218;
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 13px; outline: none;
}
.form-group input:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; margin-bottom: 8px; }
.lbl { font-size: 13px; }
.lbl-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.switch { appearance: none; width: 42px; height: 24px; background: #3a4150; border-radius: 12px; position: relative; cursor: pointer; transition: .2s; flex-shrink: 0; }
.switch:checked { background: var(--primary); }
.switch::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; }
.switch:checked::after { left: 21px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.tag-box { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 4px 10px; background: rgba(79,140,255,.15); color: var(--primary); border-radius: 6px; font-size: 12px; }
.save-bar { margin-top: 8px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { width: 480px; max-width: 100%; max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
.test-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.test-result { font-size: 12px; color: var(--muted); }

/* Toast */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 200;
  padding: 12px 20px; background: #232a35; border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.4); font-size: 13px;
}

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .brand { padding: 18px; }
  .brand > div:last-child, .nav-item span + *, .sidebar-foot span, .nav-item { font-size: 0; }
  .nav-item .ni { font-size: 20px; }
  .main { margin-left: 64px; }
  .stats-grid, .settings-grid, .run-layout { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
}
