:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1d2129;
  --border: #282d39;
  --text: #e6e8ef;
  --muted: #8a93a6;
  --brand: #4f8bff;
  --brand-2: #7ba8ff;
  --danger: #ff5b6e;
  --ok: #39d8a4;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  min-height: 100vh;
}
a { color: inherit; cursor: pointer; text-decoration: none; }
input, select, button { font-family: inherit; font-size: inherit; }
input, select {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; outline: none;
}
input:focus, select:focus { border-color: var(--brand); }
button {
  background: var(--brand); color: #fff;
  border: none; border-radius: 6px;
  padding: 8px 14px; cursor: pointer;
  transition: background .15s;
}
button:hover { background: var(--brand-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; border: 1px solid var(--border); }
button.ghost:hover { background: var(--panel2); }
button.mini-btn {
  padding: 4px 10px; font-size: 12px; margin-left: 4px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
}
button.mini-btn:hover { background: var(--border); }
button.mini-btn.danger { color: var(--danger); border-color: var(--danger); }
.muted { color: var(--muted); font-size: 12px; }
.err { color: var(--danger); }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; }

/* ───── 登录 ───── */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at top, #1f2535 0%, var(--bg) 60%);
}
.login-card {
  background: var(--panel); border: 1px solid var(--border);
  padding: 36px 40px; border-radius: 14px; width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; }

/* ───── 顶栏 ───── */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-weight: 600; }
.topbar .menu { display: flex; gap: 4px; flex: 1; }
.topbar .menu a {
  padding: 6px 14px; border-radius: 6px; color: var(--muted);
}
.topbar .menu a:hover { color: var(--text); background: var(--panel2); }
.topbar .menu a.active { color: #fff; background: var(--brand); }
.topbar .user { display: flex; align-items: center; gap: 8px; }
.role-tag {
  padding: 2px 8px; border-radius: 10px; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--border);
}
.role-tag.super { color: #ffd27a; border-color: #ffd27a; }
.role-tag.sub   { color: var(--ok); border-color: var(--ok); }

/* ───── 页面容器 ───── */
.page { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; }
.toolbar h2 { margin: 0; font-size: 18px; }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}

/* ───── KPI ───── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
}
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px;
}
.kpi .k-num { font-size: 22px; font-weight: 600; }
.kpi .k-lbl { color: var(--muted); margin-top: 4px; font-size: 12px; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

/* ───── 卡片 / 表格 ───── */
.cards-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
@media (max-width: 1100px) { .cards-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px)  { .cards-row { grid-template-columns: 1fr; } }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px;
}
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }

table.mini, table.full {
  width: 100%; border-collapse: collapse;
}
table.mini th, table.mini td,
table.full th, table.full td {
  padding: 8px 10px; text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.mini th, table.full th { color: var(--muted); font-weight: 500; font-size: 12px; }
table.full { font-size: 13px; }
table.full tr:hover td { background: var(--panel2); }
.actions { display: flex; gap: 4px; flex-wrap: wrap; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 0 0; }

/* ───── 弹窗 ───── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-body {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 24px; width: 420px; max-width: 90vw;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-body h3 { margin: 0 0 6px; }
.modal-body label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.check-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  max-height: 220px; overflow: auto; padding: 6px 2px;
}
.chk {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel2); font-size: 13px; cursor: pointer;
  color: var(--text);
}

.tag {
  display: inline-block; padding: 2px 8px; margin-right: 4px;
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 10px; font-size: 12px; color: var(--brand-2);
}

a.link {
  color: var(--brand-2); cursor: pointer; border-bottom: 1px dashed transparent;
}
a.link:hover { color: var(--brand); border-bottom-color: var(--brand); }

/* 对接指引弹窗 */
.guide-modal { width: 560px; max-width: 95vw; }
.guide-section { margin-bottom: 14px; }
.guide-label { font-size: 13px; color: var(--brand-2); font-weight: 600; margin-bottom: 4px; }
.guide-value {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; word-break: break-all; display: flex; align-items: center; gap: 8px;
}
.guide-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.guide-code {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; font-size: 12px; line-height: 1.6;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  overflow-x: auto; white-space: pre-wrap; color: var(--text); margin: 4px 0 0;
}
code {
  background: var(--panel2); padding: 1px 5px; border-radius: 3px;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px;
}
