:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1d2129;
  --sub: #86909c;
  --border: #e5e6eb;
  --primary: #165dff;
  --primary-weak: #e8f0ff;
  --danger: #f53f3f;
  --ok: #00b42a;
  --warn: #ff7d00;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef3ff 0%, #f7f9fc 60%, #eaf2ff 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(22, 93, 255, .12);
  padding: 36px 32px 30px;
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card p.sub { margin: 0 0 26px; color: var(--sub); font-size: 13px; }
.login-card .field { margin-bottom: 16px; }
.login-card button { width: 100%; margin-top: 8px; height: 42px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px;
  flex: 0 0 224px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: 18px 20px 14px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-weak);
}
.nav { padding: 6px 10px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #4e5969;
  margin-bottom: 2px;
  font-size: 14px;
}
.nav a:hover { background: #f2f3f5; }
.nav a.on { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.nav .ico { width: 18px; text-align: center; font-size: 15px; }
.nav .group { padding: 14px 12px 6px; color: #b0b4bd; font-size: 12px; letter-spacing: .5px; }
.sidebar .foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--sub);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .t { font-weight: 600; font-size: 15px; }
.topbar .r { display: flex; align-items: center; gap: 14px; color: var(--sub); font-size: 13px; }
.content { padding: 20px 22px 40px; }

/* ---------- 卡片 / 表格 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .desc { color: var(--sub); font-size: 12.5px; margin-bottom: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat .l { color: var(--sub); font-size: 12.5px; margin-top: 2px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .sp { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
th { color: var(--sub); font-weight: 500; font-size: 12.5px; background: #fafbfc; }
tbody tr:hover { background: #fafbff; }
td.wrap { max-width: 340px; word-break: break-all; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-top: 14px; color: var(--sub); font-size: 13px; }

/* ---------- 控件 ---------- */
input, select, textarea, button { font-family: inherit; font-size: 14px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22, 93, 255, .12); }
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 5px; font-size: 13px; color: #4e5969; }
label.field .tip { color: var(--sub); font-size: 12px; margin-top: 4px; display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
}
.btn:hover { border-color: #c9cdd4; background: #fafbfc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #0e4fd8; }
.btn.danger { color: var(--danger); border-color: #ffd2d2; background: #fff5f5; }
.btn.danger:hover { background: #ffecec; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); padding: 4px 8px; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 19px; }
.tag.ok { background: #e8ffea; color: #009a29; }
.tag.off { background: #f2f3f5; color: #86909c; }
.tag.warn { background: #fff7e8; color: #d25f00; }
.tag.red { background: #ffece8; color: #cb2634; }
.tag.blue { background: var(--primary-weak); color: var(--primary); }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.muted { color: var(--sub); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.thumb { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: #f2f3f5; }
.thumb-cell { display: flex; align-items: center; gap: 10px; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(29, 33, 41, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal.wide { max-width: 760px; }
.modal .hd { padding: 18px 20px; border-bottom: 1px solid var(--border); font-weight: 600; display:flex; justify-content: space-between; align-items:center;}
.modal .bd { padding: 18px 20px; overflow-y: auto; }
.modal .ft { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.close { cursor: pointer; color: var(--sub); font-size: 20px; line-height: 1; }

/* ---------- Toast ---------- */
#toast { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1d2129; color: #fff; padding: 9px 18px; border-radius: 8px; font-size: 13.5px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); animation: in .18s ease-out;
}
.toast.err { background: #cb2634; }
@keyframes in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 其它 ---------- */
.empty { text-align: center; color: var(--sub); padding: 46px 0; }
.hint {
  background: #f7f8fa; border: 1px dashed var(--border); border-radius: 10px;
  padding: 12px 14px; color: #4e5969; font-size: 13px; line-height: 1.7;
}
.hint code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.crumbs { color: var(--sub); font-size: 13px; margin-bottom: 10px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.file-row:last-child { border-bottom: 0; }
.file-row .n { flex: 1; word-break: break-all; }
.checkbox { width: 16px; height: 16px; accent-color: var(--primary); }
.codes { background: #f7f8fa; border-radius: 8px; padding: 12px; max-height: 260px; overflow: auto; }
.codes div { font-family: ui-monospace, Menlo, monospace; font-size: 13px; padding: 2px 0; }

.menu-btn { display: none; font-size: 18px; color: #4e5969; }

@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  .sidebar { position: fixed; left: -224px; transition: left .2s; z-index: 50; }
  .sidebar.open { left: 0; box-shadow: 8px 0 30px rgba(0,0,0,.12); }
  .main { margin-left: 0; }
  .content { padding: 14px; }
  .hide-sm { display: none !important; }
  .row { flex-direction: column; gap: 0; }
}

.nowrap { white-space: nowrap; }
