:root {
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1f2329;
  --muted: #8a919c;
  --line: #e6e8eb;
  --primary: #2f6bff;
  --primary-weak: #eaf0ff;
  --ok: #18a058;
  --warn: #e6a23c;
  --danger: #e5484d;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.4em; margin: 8px 0 0; }
a { color: var(--primary); cursor: pointer; text-decoration: none; }

button { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 6px; padding: 6px 14px; cursor: pointer; }
button:hover { border-color: var(--primary); color: var(--primary); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { opacity: .9; color: #fff; }
button.danger { color: var(--danger); border-color: #f3c6c7; }
button.danger:hover { background: #fff1f1; }
button.ghost { border-color: transparent; background: transparent; }
button.small { padding: 2px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
label { display: block; margin: 0 0 12px; color: #4e5969; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 4px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0 16px 8px 0; color: var(--text); }
label.inline > input { width: auto; margin: 0; }
.hint { color: var(--muted); font-size: 12px; margin-top: 2px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; }
.login-card h1 { font-size: 20px; margin: 0 0 20px; text-align: center; }
.login-card button { width: 100%; margin-top: 8px; padding: 9px; }

.top { height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.spacer { flex: 1; }
.layout { display: flex; min-height: calc(100vh - 52px); }
nav { width: 168px; background: #fff; border-right: 1px solid var(--line); padding: 12px 8px; flex-shrink: 0; }
nav a { display: block; padding: 8px 14px; border-radius: 6px; color: var(--text); margin-bottom: 2px; }
nav a:hover { background: var(--bg); }
nav a.on { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
main { flex: 1; padding: 20px 24px 60px; min-width: 0; }
h2 { font-size: 18px; margin: 0 0 16px; }
h3 { font-size: 15px; margin: 0 0 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .n { font-size: 26px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.hl .n { color: var(--primary); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.row > button { margin-top: 26px; }
.row > label { flex: 1; min-width: 160px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { width: 280px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 500; background: #fafbfc; white-space: nowrap; }
tr:hover td { background: #fafbfc; }
td.mono, .mono { font-family: ui-monospace, Consolas, monospace; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap th, .table-wrap td { white-space: nowrap; }
.table-wrap td.wrap { white-space: normal; min-width: 140px; max-width: 320px; word-break: break-all; }
.table-wrap table { border: 0; }
.table-wrap tr:last-child td { border-bottom: 0; }

.tag { display: inline-block; padding: 0 8px; border-radius: 10px; font-size: 12px; line-height: 20px; background: var(--bg); color: #4e5969; white-space: nowrap; }
.tag.ok { background: #e8f7ef; color: var(--ok); }
.tag.warn { background: #fdf3e2; color: #b7791f; }
.tag.bad { background: #fdecec; color: var(--danger); }
.tag.blue { background: var(--primary-weak); color: var(--primary); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c9cdd4; margin-right: 6px; vertical-align: middle; }
.dot.on { background: var(--ok); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 20; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 10px; width: 760px; max-width: 100%; padding: 24px; position: relative; }
.modal-x { position: absolute; right: 12px; top: 10px; border: 0; font-size: 22px; line-height: 1; padding: 4px 8px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin-bottom: 16px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 20px; }

.toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); background: #1f2329; color: #fff; padding: 8px 18px; border-radius: 6px; z-index: 30; max-width: 80vw; }
.toast.bad { background: var(--danger); }
.codes { min-height: 200px; }
.note-box { background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; color: #4e5969; font-size: 13px; margin-bottom: 16px; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  nav { width: auto; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; }
  nav a { white-space: nowrap; }
  main { padding: 16px 12px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  .toolbar input[type=search] { width: 100%; }
}
