:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2330;
  --border: #2d3643;
  --text: #dce3ec;
  --muted: #7d8794;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --mono: 'Cascadia Code', 'SF Mono', Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.err { color: var(--red); margin-top: 10px; font-size: 13px; min-height: 18px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px 36px;
  width: 360px;
  text-align: center;
}
.logo { font-size: 26px; font-weight: 800; letter-spacing: 4px; color: var(--accent); }
.logo span { font-size: 13px; letter-spacing: 2px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.logo.small { font-size: 20px; margin: 22px 0 26px; text-align: center; }
.login-card p { margin: 14px 0 22px; }
.login-card input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--mono);
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }

.btn {
  background: var(--accent);
  color: #0b0f14;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 14px;
  width: 100%;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); width: auto; margin: 0; }
.btn.ghost:hover { border-color: var(--accent); }
.btn.small { width: auto; padding: 4px 10px; margin: 0; font-size: 12px; }

/* 布局 */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 190px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
}
.side nav { flex: 1; }
.side nav a {
  display: block;
  padding: 12px 22px;
  color: var(--muted);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.side nav a:hover { color: var(--text); background: var(--panel2); }
.side nav a.active { color: var(--accent); border-left-color: var(--accent); background: var(--panel2); }
.side-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.off { background: var(--red); }

.content { margin-left: 190px; flex: 1; padding: 0 28px 40px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.topbar h1 { font-size: 20px; font-weight: 700; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}
.stat .num { font-size: 26px; font-weight: 700; color: var(--accent); font-family: var(--mono); }
.stat .label { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* 面板与表格 */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.panel-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
}
.tbl td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--panel2); }
.tbl .mono { word-break: break-all; }

.tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); white-space: nowrap; }
.tag.green { color: var(--green); border-color: var(--green); }
.tag.red { color: var(--red); border-color: var(--red); }
.tag.yellow { color: var(--yellow); border-color: var(--yellow); }
.tag.blue { color: var(--accent); border-color: var(--accent); }

.progress { width: 90px; height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }

/* 事件日志 */
.event-log {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--muted);
  max-height: 420px;
  overflow-y: auto;
}
.event-log div { padding: 3px 0; border-bottom: 1px dashed var(--border); }
.event-log b { color: var(--accent); font-weight: 500; }

/* 抽屉 */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 560px;
  max-width: 90vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0,0,0,.5);
  z-index: 50;
  overflow-y: auto;
}
.drawer-inner { padding: 24px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.drawer-head h2 { font-size: 17px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; margin-bottom: 16px; }
.kv .k { color: var(--muted); }
.kv .v { word-break: break-all; font-family: var(--mono); font-size: 12px; }
.sub-title { font-size: 13px; font-weight: 600; margin: 20px 0 10px; color: var(--accent); }
.task-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.task-bar .muted { font-size: 12px; }
.task-bar select, .task-bar input, .cfg-wrap textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
  font-family: var(--mono);
  font-size: 12px;
}
.task-bar select:focus, .task-bar input:focus, .cfg-wrap textarea:focus { border-color: var(--accent); }
.cfg-wrap { padding: 16px; }
.cfg-wrap textarea { width: 100%; resize: vertical; }
#cfg-msg { margin-left: 12px; }

.data-cell { max-width: 380px; }
.data-cell .mono { display: block; max-height: 52px; overflow: hidden; position: relative; }
.data-cell .mono.open { max-height: none; }
.data-cell .more { color: var(--accent); cursor: pointer; font-size: 12px; }
.addr-chip {
  display: inline-block;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  margin: 1px;
  font-size: 11px;
  color: var(--accent);
}
.has-bal { color: var(--green); font-weight: 600; }
#sweep-dest {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  margin-top: -4px;
}
#sweep-dest:focus { border-color: var(--accent); }
