:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --danger: #dc2626;
  --success: #16a34a;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
/* 登录页 */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4f46e5 100%); padding: 20px;
}
.auth-card {
  background: var(--card); width: 100%; max-width: 400px; border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0,0,0,.35); padding: 36px 32px;
}
.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 8px;
  font-size: 14px; cursor: pointer; color: var(--muted); transition: .2s;
}
.tabs button.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  font-size: 14px; outline: none; transition: border .2s, box-shadow .2s; font-family: inherit; background:#fff;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
textarea { resize: vertical; min-height: 70px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 8px; padding: 10px 16px; font-size: 14px; cursor: pointer;
  transition: .15s; font-family: inherit; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; margin-top: 22px; padding: 11px; }
.msg { font-size: 13px; margin-top: 14px; min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }
.hint { margin-top: 18px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.7; }

/* 通用头部 */
.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .logo { font-weight: 700; font-size: 16px; color: var(--primary); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13.5px; }
.container { max-width: 1080px; margin: 26px auto; padding: 0 20px; }
.card { background: var(--card); border-radius: 12px; padding: 26px 28px; box-shadow: 0 1px 4px rgba(15,23,42,.06); margin-bottom: 20px; }
.card h2 { font-size: 17px; margin-bottom: 6px; }
.card .desc { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.form-grid .full { grid-column: 1 / -1; }

/* 表格 */
.table-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.table-tools input[type=search] { width: 260px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
td.wrap, th.wrap { white-space: normal; min-width: 140px; }
th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faff; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.tag.on { background: #dcfce7; color: var(--success); }
.tag.off { background: #fee2e2; color: var(--danger); }
.pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--muted); justify-content: flex-end; }
.pager button { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.empty { text-align: center; color: var(--muted); padding: 34px 0 !important; }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none;
  align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 480px; padding: 26px 28px; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 16px; margin-bottom: 4px; }
.modal .modal-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.pw-result { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--success); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-top: 12px; display: none; user-select: all; }
.actions-cell { display: flex; gap: 6px; }
.footer-note { text-align: center; color: var(--muted); font-size: 12px; margin: 30px 0 20px; }
