:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #303133;
  --muted: #909399;
  --line: #ebeef5;
  --accent: #1476ff;
  --accent-2: #4f8dff;
  --ok: #19be6b;
  --bad: #ed4014;
  --warn: #b26a00;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { min-height: 100vh; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code { font-family: Consolas, monospace; font-size: 12px; background: #f2f7ff; padding: 1px 5px; border-radius: 4px; color: #1476ff; }
a { color: var(--accent); }

/* login */
.login-layer {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(680px 420px at 18% 0%, rgba(20, 118, 255, .12), transparent 62%),
    radial-gradient(560px 380px at 96% 18%, rgba(118, 92, 255, .10), transparent 60%),
    #f4f6fb;
}
.login-card {
  width: min(420px, 100%); padding: 30px; border-radius: 14px; background: #fff;
  box-shadow: 0 18px 50px rgba(31, 45, 61, .10);
  border: 1px solid #f0f2f5;
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.logo {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  color: #fff; font-weight: 800; font-size: 18px;
  background: linear-gradient(135deg, #1476ff, #5b8cff);
  box-shadow: 0 8px 20px rgba(20, 118, 255, .28);
}
.login-brand strong { display: block; font-size: 17px; }
.login-brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.login-card h1 { margin: 0; font-size: 21px; }
.login-sub { margin: 7px 0 20px; color: var(--muted); font-size: 13px; }
.field { display: grid; gap: 7px; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid #dcdfe6; border-radius: 8px;
  background: #fbfcff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #8fbfff; box-shadow: 0 0 0 3px rgba(20, 118, 255, .10); }
.hint { color: #a8abb2; font-size: 11px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 8px 14px; border-radius: 8px; border: 1px solid #dcdfe6;
  background: #fff; color: #606266; font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { color: var(--accent); border-color: #a8ccff; background: #f7fbff; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { color: #fff; border-color: var(--accent); background: linear-gradient(135deg, #1476ff, #4f8dff); box-shadow: 0 8px 20px rgba(20, 118, 255, .22); }
.btn.ghost { color: var(--accent); background: #f2f7ff; border-color: #d6e6ff; }
.btn.danger { color: var(--bad); background: #fff5f5; border-color: #ffd6cc; }
.btn.block { width: 100%; min-height: 42px; margin-top: 4px; border-radius: 20px; }
.result { min-height: 18px; margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.result.ok { color: var(--ok); }
.result.error { color: var(--bad); }
.result.inline { margin: 0; }
.qr-login-result { margin-top: 14px; }
.qr-login { display: flex; align-items: flex-start; gap: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.qr-login img { width: 240px; height: 240px; border-radius: 10px; background: #fff; }
.qr-login-copy { max-width: 460px; }
.qr-login-copy strong { display: block; margin-bottom: 8px; color: var(--text); font-size: 14px; }
.qr-login-copy p { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.7; }
@media (max-width: 720px) {
  .qr-login { flex-direction: column; }
  .qr-login img { width: 200px; height: 200px; }
}
.login-foot { margin: 16px 0 0; color: #a8abb2; font-size: 11px; line-height: 1.6; }

/* shell */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px;
  color: #606266; background: #fff; border-right: 1px solid var(--line);
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 22px; }
.side-brand strong { display: block; font-size: 16px; color: var(--ink); }
.side-brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.nav-list { display: grid; gap: 5px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border: 0; border-radius: 8px;
  background: transparent; color: #606266; font-size: 13px; text-align: left; transition: .15s;
}
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.35; }
.nav-item:hover { color: var(--accent); background: #f5f9ff; }
.nav-item.active { color: var(--accent); background: #e8f1ff; box-shadow: inset 0 0 0 1px #d6e6ff; }
.side-foot { margin-top: auto; padding: 14px 6px 2px; border-top: 1px solid #f2f4f8; }
.admin-id { margin-bottom: 8px; color: #909399; font-size: 12px; }
.logout { width: 100%; padding: 9px; border-radius: 8px; border: 1px solid #dcdfe6; background: #fff; color: #606266; font-size: 12px; }
.logout:hover { color: var(--accent); border-color: #a8ccff; background: #f7fbff; }

.workspace { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 8; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 28px; background: rgba(244, 246, 251, .92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 21px; letter-spacing: .2px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.relay-pill { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 11px; }
.relay-pill.ok { color: #19be6b; background: #f0fff7; border-color: #b7f0d2; }
.relay-pill.bad { color: #ed4014; background: #fff5f2; border-color: #ffd6cc; }

.content { display: grid; gap: 16px; padding: 22px 28px 40px; max-width: 1280px; }
.tab-panel { display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; box-shadow: 0 1px 4px rgba(0, 0, 0, .03); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 500; }
.card-head .muted { color: var(--muted); font-size: 12px; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 999px; background: #e8f1ff; color: var(--accent); font-size: 11px; }
.link { border: 0; background: transparent; color: var(--accent); font-size: 12px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar input { width: 180px; padding: 8px 10px; border: 1px solid #dcdfe6; border-radius: 8px; background: #fbfcff; outline: none; }
.muted { color: var(--muted); font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { padding: 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; box-shadow: 0 0 10px 2px #eee; }
.metric-label { color: var(--muted); font-size: 11px; }
.metric-value { margin-top: 8px; font-size: 24px; font-weight: 600; letter-spacing: .2px; color: #303133; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.info-grid > div { padding: 13px 14px; border-radius: 12px; background: #f8faff; border: 1px solid #eef2fb; }
.info-grid span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.info-grid strong { font-size: 12px; line-height: 1.6; }

/* forms */
.inline-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.inline-form .field { margin: 0; min-width: 180px; }
.inline-form .field.narrow { min-width: 90px; width: 100px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.field.span-2, .check.span-2, .form-actions.span-2 { grid-column: span 2; }
.field textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; color: var(--muted); font-size: 12px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.callout { margin-top: 14px; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line); background: #f8faff; color: var(--muted); font-size: 12px; line-height: 1.7; }
.callout.ok { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.callout.bad { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

/* tables */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 10px 10px; text-align: left; border-bottom: 1px solid #ebeef5; vertical-align: middle; }
th { color: #909399; font-weight: 500; font-size: 11px; background: #fafafa; white-space: nowrap; }
td { color: #606266; }
tr:last-child td { border-bottom: 0; }
.mono { font-family: Consolas, monospace; font-size: 11px; word-break: break-all; }
.tag { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 500; }
.tag.ok { color: #19be6b; background: #f0fff7; }
.tag.warn { color: #ff9900; background: #fff7e6; }
.tag.bad { color: #ed4014; background: #fff5f2; }
.actions { display: flex; gap: 5px; flex-wrap: wrap; }
.actions .btn { min-height: 28px; padding: 4px 9px; font-size: 11px; border-radius: 6px; }
.mini-table table th, .mini-table table td { padding: 8px 6px; }
.mini-table:empty::after { content: "暂无数据"; color: #a8abb2; font-size: 12px; }
.nowrap { white-space: nowrap; }
.relay-tables { grid-template-columns: 440px minmax(0, 1fr); }
#relayTable { table-layout: fixed; }
#relayTable th:nth-child(1) { width: 100px; }
#relayTable th:nth-child(2) { width: 60px; }
#relayTable th:nth-child(3) { width: 50px; }
#relayTable th:nth-child(4) { width: 45px; }
#relayTable th:nth-child(5) { width: 45px; }
#relayTable th:nth-child(6) { width: 80px; }
#relayTasksTable { table-layout: fixed; }
#relayTasksTable th:nth-child(1) { width: 120px; }
#relayTasksTable th:nth-child(2) { width: 108px; }
#relayTasksTable th:nth-child(3) { width: 72px; }
#relayTasksTable th:nth-child(5) { width: 118px; }
#relayTasksTable th:nth-child(6) { width: 58px; }
#relayTasksTable td.task-result { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* detail */
.detail-card { border-color: #d6e6ff; background: linear-gradient(180deg, #fff, #fafcff); }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 10px 0 14px; }
.detail-item { padding: 10px 12px; border-radius: 8px; background: #f8faff; border: 1px solid #eef2fb; }
.detail-item span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 4px; }
.detail-item strong { font-size: 12px; word-break: break-all; color: #303133; }
.detail-section { margin-top: 12px; }
.detail-section h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 500; }
.provision-box { margin-top: 14px; padding: 14px; border-radius: 10px; background: #f8faff; border: 1px dashed #b6d4ff; }
.provision-box .inline-form { align-items: stretch; }
.provision-box textarea { width: 100%; min-height: 70px; }
.secret-note { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.65; }

/* relay */
.flow-list { display: grid; gap: 12px; }
.flow-list > div { display: flex; gap: 12px; align-items: flex-start; }
.flow-list b { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: #eff2ff; color: var(--accent); font-size: 11px; }
.flow-list p { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.plain-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 200px minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .relay-tables { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px; }
  .side-brand { padding-bottom: 12px; }
  .nav-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-item { justify-content: center; padding: 9px; }
  .nav-item span { font-size: 11px; }
  .side-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
  .logout { width: auto; padding: 8px 12px; }
  .topbar { position: static; padding: 16px; }
  .content { padding: 16px; }
  .two-col, .form-grid, .info-grid { grid-template-columns: 1fr; }
  .field.span-2, .check.span-2, .form-actions.span-2 { grid-column: auto; }
}
@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 15px; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
