:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #155eef;
  --accent-soft: #eef4ff;
  --ok: #12b76a;
  --warn: #f79009;
  --bad: #f04438;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --panel: #161b22;
    --text: #e6edf3;
    --muted: #8b949e;
    --line: #30363d;
    --accent: #4c8dff;
    --accent-soft: #1a2740;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; gap: 24px; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--text); }
.nav { display: flex; gap: 4px; overflow-x: auto; }
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--bg); }
.nav a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
main { padding-top: 24px; padding-bottom: 60px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card .k { color: var(--muted); font-size: 12.5px; }
.card .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .d { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; min-height: 70px; font-family: var(--mono); font-size: 12.5px; }
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 7px 14px; border-radius: 8px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
button:hover { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); color: #fff; }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button.sm { padding: 3px 9px; font-size: 12.5px; }
button:disabled { opacity: .5; cursor: wait; }
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: 1px; }
.dot.up { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.down { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 20%, transparent); }
.dot.degraded { background: var(--warn); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.tag.blue { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.chart { width: 100%; height: 180px; display: block; }
.chart .bar { fill: var(--accent); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .axis { stroke: var(--line); }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.status-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.status-item .name { font-weight: 600; font-family: var(--mono); font-size: 13px; word-break: break-all; }
.hb { display: flex; gap: 2px; align-items: flex-end; height: 22px; }
.hb i { flex: 1; min-width: 2px; max-width: 6px; height: 100%; border-radius: 2px; background: var(--ok); opacity: .8; }
.hb i.f { background: var(--bad); }
.login { max-width: 380px; margin: 60px auto; }
.code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; position: relative; }
.copy { cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.bar-mini { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; min-width: 80px; }
.bar-mini > div { height: 100%; background: var(--accent); }
.bar-mini.warn > div { background: var(--warn); }
.bar-mini.bad > div { background: var(--bad); }
.route-group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.route-group .rg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg); flex-wrap: wrap; }
.route-group .rg-head b { font-family: var(--mono); }
.route-group table td, .route-group table th { padding: 8px 14px; }
/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 540px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; margin-bottom: 5px; font-weight: 500; }
.field input, .field select { width: 100%; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.checklist { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 6px; font-family: var(--mono); font-size: 12.5px; cursor: pointer; }
.checklist label:hover { background: var(--bg); }
#toast-root { position: fixed; top: 70px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--panel); padding: 10px 14px; border-radius: 8px; max-width: 360px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--bad); color: #fff; }
.quiz { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.quiz div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.quiz .ans { color: var(--muted); font-family: var(--mono); font-size: 12px; word-break: break-all; margin-top: 2px; }
@media (max-width: 640px) {
  .topbar-in { gap: 10px; }
  .brand span { display: none; }
  .card .v { font-size: 20px; }
  .panel { padding: 14px; }
  .tbl-wrap { margin: 0 -14px; padding: 0 14px; }
}
