:root {
  --bg: #eef2f6;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e2e8f0;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #b45309;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--brand); }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1000px 520px at 15% -10%, rgba(15, 118, 110, .35), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(29, 78, 137, .35), transparent 55%),
    #0b1220;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  padding: 34px 32px 28px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, .45);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.login-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0f766e, #0e7490);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.login-title { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.login-sub { color: var(--muted); font-size: 12.5px; margin: 2px 0 24px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

input[type="text"],
input[type="password"],
select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}

.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }
.btn.danger:hover { background: #fee2e2; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; border-color: transparent; }
.btn.block { width: 100%; height: 42px; font-size: 15px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 12.5px;
  margin: -4px 0 10px;
}

.login-foot {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- 后台 ---------- */
.topbar {
  height: 56px;
  background: #0b1220;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .3px; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: #2dd4bf; box-shadow: 0 0 10px #2dd4bf; }

.top-right { display: flex; align-items: center; gap: 8px; }
.who { color: #cbd5e1; font-size: 13px; margin-right: 6px; }
.who b { color: #fff; font-weight: 600; }
.role-tag {
  display: inline-block;
  padding: 0 7px;
  height: 20px;
  line-height: 20px;
  border-radius: 999px;
  font-size: 11.5px;
  background: rgba(45, 212, 191, .16);
  color: #5eead4;
  margin-left: 6px;
}

.layout { max-width: 1180px; margin: 22px auto 60px; padding: 0 20px; display: grid; gap: 16px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-body { padding: 16px 18px; }

.hint {
  padding: 9px 14px;
  margin: 0;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13.5px; white-space: nowrap; }
.grid th { background: #f8fafc; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.grid tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: #fafcff; }
.grid .ops { text-align: right; }
.grid .ops .btn { margin-left: 6px; }
.grid .muted { color: var(--muted); }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.tag.super { background: #eef2ff; color: #4338ca; }
.tag.admin { background: var(--brand-soft); color: var(--brand-dark); }
.tag.user { background: #f1f5f9; color: #475569; }
.tag.active { background: #ecfdf5; color: #047857; }
.tag.disabled { background: #fef2f2; color: #b91c1c; }

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

/* ---------- 弹窗 ---------- */
dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  box-shadow: 0 30px 70px rgba(2, 6, 23, .35);
}
dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.dlg-head { padding: 16px 20px 0; font-size: 15px; font-weight: 600; }
.dlg-body { padding: 16px 20px 4px; }
.dlg-foot { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.dlg-err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin: 2px 0 6px; }
.dlg-tip { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- 提示条 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 99;
  max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: #b91c1c; }

@media (max-width: 720px) {
  .grid th:nth-child(4), .grid td:nth-child(4),
  .grid th:nth-child(6), .grid td:nth-child(6) { display: none; }
  .who .role-tag { display: none; }
}
