/* Masternan 门户样式：深色、克制、移动优先 */
:root {
  --bg: #0b0f14;
  --bg-soft: #111822;
  --panel: rgba(20, 28, 38, 0.72);
  --panel-solid: #141c26;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: #e6edf3;
  --muted: #8b9cb0;
  --faint: #5b6b7f;
  --accent: #f0b429;
  --accent-soft: rgba(240, 180, 41, 0.12);
  --teal: #4fd1c5;
  --danger: #f27d7d;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(240, 180, 41, 0.08), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(79, 209, 197, 0.07), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 38px 32px 30px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.5px;
  color: #0b0f14;
  background: linear-gradient(135deg, #ffd166, var(--accent));
  box-shadow: 0 10px 30px rgba(240, 180, 41, 0.28);
  margin-bottom: 20px;
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.login-card .sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 26px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.06em;
}
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 17, 0.6);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: rgba(240, 180, 41, 0.55);
  box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.12);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.06); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #ffd166, var(--accent));
  color: #151008;
  border: none;
  font-weight: 650;
  width: 100%;
  margin-top: 8px;
  padding: 13px 18px;
  box-shadow: 0 10px 26px rgba(240, 180, 41, 0.22);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}
.login-foot {
  margin-top: 24px;
  color: var(--faint);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.login-foot a { color: var(--muted); border-bottom: 1px dashed var(--line-strong); }

/* ---------- 主体 ---------- */
.shell { max-width: 1180px; margin: 0 auto; padding: 0 22px 90px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 0 14px;
  background: linear-gradient(to bottom, rgba(11, 15, 20, 0.94), rgba(11, 15, 20, 0.72) 70%, transparent);
  backdrop-filter: blur(10px);
}
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #4fd1c5, #38a169);
  color: #06221f; display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
}
.user-name { font-size: 14px; color: var(--muted); }

.hero { padding: 26px 0 30px; }
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: -0.03em;
  font-weight: 750;
}
.hero p { margin: 0; color: var(--muted); font-size: 15px; max-width: 62ch; line-height: 1.7; }
.hero .meta { margin-top: 14px; display: flex; gap: 18px; color: var(--faint); font-size: 13px; flex-wrap: wrap; }
.hero .meta b { color: var(--text); font-weight: 600; }

.search-row { display: flex; gap: 12px; align-items: center; margin: 6px 0 34px; }
.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  transition: border-color 0.15s;
}
.search:focus-within { border-color: rgba(240, 180, 41, 0.5); }
.search input {
  border: none; background: transparent; outline: none; width: 100%;
  font-size: 15px;
}
.search svg { opacity: 0.5; flex: none; }

.group { margin-bottom: 40px; }
.group-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 16px;
}
.group-head h2 {
  margin: 0; font-size: 13px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.group-head .count { font-size: 12px; color: var(--faint); font-family: var(--mono); }
.group-head .line { flex: 1; height: 1px; background: var(--line); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.card {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.18s, background 0.18s;
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(420px 120px at 100% 0%, rgba(240, 180, 41, 0.1), transparent 70%);
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: rgba(24, 33, 44, 0.85);
}
.card:hover::after { opacity: 1; }
.card .icon {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.card .body { min-width: 0; }
.card h3 {
  margin: 1px 0 5px; font-size: 16px; font-weight: 640;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card p {
  margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .tags { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--faint);
  font-family: var(--mono);
  white-space: nowrap;
}
.chip.on { color: var(--teal); border-color: rgba(79, 209, 197, 0.3); }
.empty {
  padding: 60px 20px; text-align: center; color: var(--faint);
  border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ---------- 管理页 ---------- */
.admin-shell { max-width: 1080px; margin: 0 auto; padding: 0 22px 100px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.panel h2 { margin: 0 0 4px; font-size: 17px; }
.panel .hint { margin: 0 0 18px; color: var(--faint); font-size: 13px; line-height: 1.6; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.status-line {
  font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.ok { background: #48bb78; box-shadow: 0 0 10px rgba(72, 187, 120, 0.6); }
.dot.bad { background: var(--danger); box-shadow: 0 0 10px rgba(242, 125, 125, 0.5); }

table.svc { width: 100%; border-collapse: collapse; }
table.svc th {
  text-align: left; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
table.svc td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
table.svc tr:last-child td { border-bottom: none; }
table.svc .svc-name { display: flex; align-items: center; gap: 10px; font-weight: 560; }
table.svc .svc-name .icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 18px;
}
table.svc .muted { color: var(--faint); font-size: 12px; }
table.svc code {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: rgba(255, 255, 255, 0.03); padding: 2px 6px; border-radius: 6px;
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.modal-back {
  position: fixed; inset: 0; background: rgba(3, 6, 10, 0.7);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 60; padding: 20px;
}
.modal {
  width: min(640px, 100%);
  max-height: 88dvh; overflow: auto;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 20px; font-size: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.modal .field { margin-bottom: 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
textarea.input { resize: vertical; min-height: 74px; font-family: var(--mono); font-size: 13px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1c2733; border: 1px solid var(--line-strong); color: var(--text);
  padding: 10px 18px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 90;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { border-color: rgba(242, 125, 125, 0.5); }

.footer {
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line);
  color: var(--faint); font-size: 12px; display: flex; gap: 18px; flex-wrap: wrap;
  font-family: var(--mono);
}

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero { padding-top: 10px; }
  .topbar { padding-top: 14px; }
  table.svc th:nth-child(2), table.svc td:nth-child(2),
  table.svc th:nth-child(3), table.svc td:nth-child(3) { display: none; }
}
