:root {
  --brand: #4a5bd8;
  --brand-dark: #3a49b8;
  --accent: #f2994a;
  --mint: #2fb59a;
  --rose: #e8637a;
  --bg: #f6f7fc;
  --ink: #1a1b26;
  --muted: #6b7080;
  --line: #e6e8f2;
  --card: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

.boot { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5b6bec 0%, #8e5bf0 100%);
  padding: 20px;
}
.login-box {
  width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(30, 34, 80, 0.25);
}
.login-box h1 { margin: 0 0 4px; font-size: 22px; }
.login-box .sub { color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.login-box label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 208px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.logo { font-size: 18px; font-weight: 700; color: var(--brand); padding: 4px 10px 18px; }
.logo span { font-size: 11px; color: var(--muted); font-weight: 400; display: block; margin-top: 2px; }
.nav-item {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: #444a5e;
  margin-bottom: 4px;
  font-size: 13.5px;
}
.nav-item:hover { background: #f1f3fb; }
.nav-item.active { background: rgba(74, 91, 216, 0.12); color: var(--brand); font-weight: 600; }
.side-foot { margin-top: auto; padding: 10px; font-size: 11px; color: var(--muted); }

.main { flex: 1; padding: 22px 26px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; }
.page-head .spacer { flex: 1; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { min-height: 90px; resize: vertical; }

button {
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  font-weight: 500;
}
button:hover { background: var(--brand-dark); }
button.ghost { background: #eef0fa; color: var(--brand); }
button.ghost:hover { background: #e2e6f8; }
button.danger { background: #fdeef1; color: var(--rose); }
button.danger:hover { background: #fbdde3; }
button.small { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 160px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: #fafbff; position: sticky; top: 0; }
tr:hover td { background: #fbfcff; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: #eef0fa;
  color: var(--brand);
}
.tag.green { background: #e6f7f2; color: var(--mint); }
.tag.orange { background: #fdf1e6; color: #c9752a; }
.tag.red { background: #fdeef1; color: var(--rose); }
.tag.gray { background: #f0f1f5; color: var(--muted); }
.tag.ok { background: #e6f7f2; color: var(--mint); }
.tag.bad { background: #fdeef1; color: var(--rose); }

.muted { color: var(--muted); font-size: 12px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-grid label { display: block; font-size: 12px; color: var(--muted); }
.form-grid input { width: 100%; margin-top: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.stat .num { font-size: 26px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }

.empty { padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }
.hint {
  background: #f3f5ff;
  border: 1px solid #e2e6f8;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: #4a5170;
  line-height: 1.65;
}
.hint code { background: #fff; padding: 1px 5px; border-radius: 4px; border: 1px solid #e2e6f8; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #1a1b26;
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
  z-index: 99;
  max-width: 80vw;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--rose); }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow: auto;
  padding: 22px;
}
.modal.wide { max-width: 900px; }
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.drop {
  border: 2px dashed #c9cfe8;
  border-radius: 12px;
  padding: 26px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  background: #fafbff;
}
.drop:hover, .drop.over { border-color: var(--brand); background: #f2f4ff; }

.preview-table { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.unit-block { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.unit-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #fafbff; border-bottom: 1px solid var(--line);
}
.unit-head .name { font-weight: 600; font-size: 13px; }
.unit-head .cnt { color: var(--muted); font-size: 11.5px; }
.unit-body { max-height: 260px; overflow: auto; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .logo { padding: 4px 8px 8px; width: 100%; }
  .side-foot { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
