:root {
  --bg: #f5f6fb;
  --panel: #ffffff;
  --ink: #101426;
  --ink-2: #4b5468;
  --ink-3: #8992a6;
  --line: #e6e8f2;
  --brand: #5b5bf0;
  --brand-2: #8b5cf6;
  --brand-soft: #eeeeff;
  --ok: #0f9d6b;
  --ok-soft: #e6f7f0;
  --warn: #b7791f;
  --warn-soft: #fdf6e3;
  --danger: #d9424f;
  --danger-soft: #fdecef;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 20, 38, .04), 0 8px 24px rgba(16, 20, 38, .06);
  --shadow-lg: 0 24px 64px rgba(16, 20, 38, .16);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .16s ease; white-space: nowrap;
}
.btn:hover { border-color: #cfd4e6; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(91, 91, 240, .28);
}
.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 8px 22px rgba(91, 91, 240, .34); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(16,20,38,.05); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-danger { color: var(--danger); border-color: #f3c9ce; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }

.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font-size: 13px; font-family: inherit;
  outline: none; transition: .16s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 91, 240, .12);
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--ink-3); line-height: 1.6; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.card-title { font-size: 14px; font-weight: 700; margin: 0; }
.card-body { padding: 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #eef0f6; color: var(--ink-3); }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: #fafbff; white-space: nowrap;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid #f0f1f7; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafbff; }
.mono { font-family: var(--mono); font-size: 12px; }

.empty {
  padding: 36px 16px; text-align: center; color: var(--ink-3); font-size: 13px;
}

.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 20, 38, .42);
  backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center;
  padding: 20px; z-index: 90;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; max-height: 88vh; overflow: auto;
  animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { padding: 20px 22px 0; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px 22px; }
.modal-foot {
  padding: 0 22px 20px; display: flex; gap: 10px; justify-content: flex-end;
}

.toast-wrap {
  position: fixed; top: 18px; right: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #101426; color: #fff; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow-lg); animation: slide .2s ease;
  max-width: 340px;
}
.toast.err { background: #b3242f; }
.toast.ok { background: #0b7a55; }
@keyframes slide { from { opacity: 0; transform: translateX(12px); } }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5d9e8; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
