:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e3e6eb;
  --text: #1f2328;
  --text-2: #5b6472;
  --text-3: #8b949e;
  --brand: #1f6feb;
  --brand-soft: #e8f0fe;
  --danger: #c62828;
  --ok: #1a7f37;
  --warn: #9a6700;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

.hidden { display: none !important; }

button {
  font: inherit;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: #c9ced6; background: #fafbfc; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: #1a5fd0; }
button.danger { color: var(--danger); border-color: #f0c4c4; }
button.danger:hover { background: #fdf3f3; }
button.link { border: none; background: none; color: var(--brand); padding: 4px 6px; }
button.wide { width: 100%; padding: 9px; }
button:disabled { opacity: .5; cursor: default; }

input, select {
  font: inherit;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 340px; background: var(--panel); padding: 30px 28px;
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(20, 30, 50, .06);
}
.login-card .brand { font-size: 20px; font-weight: 600; letter-spacing: .5px; }
.login-card .brand-sub { color: var(--text-3); margin-bottom: 20px; }
.login-card label { display: block; margin-bottom: 12px; color: var(--text-2); font-size: 13px; }
.login-card label input { display: block; width: 100%; margin-top: 5px; }
.msg { margin-top: 10px; font-size: 13px; color: var(--danger); min-height: 18px; }
.force-out { text-align: center; margin-top: 14px; }
.force-out .link { color: var(--text-3); font-size: 13px; }

/* ---------- 框架 ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 0 22px; height: 56px; position: sticky; top: 0; z-index: 10;
}
.logo { font-weight: 600; font-size: 15px; }
.logo span { color: var(--text-3); font-weight: 400; margin-left: 6px; font-size: 13px; }
.tabs { display: flex; gap: 4px; }
.tab { border: none; background: none; padding: 8px 12px; color: var(--text-2); border-radius: 6px; }
.tab.on { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.who { margin-left: auto; color: var(--text-2); font-size: 13px; }

.panel { padding: 20px 22px 60px; }
.bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.bar .spacer { flex: 1; }
.bar input { width: 240px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.card.narrow { max-width: 520px; }
.card-title { font-weight: 600; margin-bottom: 12px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.form-row label.grow { flex: 1; }
.form-actions { display: flex; gap: 8px; }
.code-out {
  background: #f6f8fa; border: 1px solid var(--line); border-radius: 6px;
  padding: 12px; margin: 12px 0 0; font: 13px/1.7 Consolas, Menlo, monospace;
  white-space: pre-wrap; word-break: break-all; max-height: 240px; overflow: auto;
}

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; background: var(--panel); }
table.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { background: #fafbfc; color: var(--text-2); font-weight: 500; font-size: 12.5px; white-space: nowrap; }
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: #fcfdfe; }
table.slim th, table.slim td { padding: 6px 8px; font-size: 13px; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px;
  background: #eef1f5; color: var(--text-2); margin: 1px 4px 1px 0; white-space: nowrap;
}
.tag.ok { background: #e7f6ec; color: var(--ok); }
.tag.off { background: #fdecec; color: var(--danger); }
.tag.warn { background: #fff5e0; color: var(--warn); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 2px; flex-wrap: wrap; }

/* ---------- 抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 30; }
.drawer-mask { position: absolute; inset: 0; background: rgba(15, 23, 35, .28); }
.drawer-body {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(760px, 94vw);
  background: var(--bg); box-shadow: -8px 0 30px rgba(20, 30, 50, .12);
  display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--panel); border-bottom: 1px solid var(--line); font-weight: 600;
}
#dr-content { padding: 16px 18px 40px; overflow: auto; }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: #232a35; color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 13px; z-index: 50; box-shadow: 0 6px 22px rgba(0, 0, 0, .2);
}
.toast.bad { background: #8c1d1d; }

.empty { padding: 30px; text-align: center; color: var(--text-3); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
