/* MCPanel — original stylesheet. Dark default, light theme via [data-theme]. */
:root {
  --bg: #0f1115; --bg-soft: #161a21; --panel: #1b2029; --panel-2: #212734;
  --line: #2a313d; --line-soft: #222834;
  --text: #e6eaf2; --text-dim: #98a2b3; --text-mute: #6b7688;
  --brand: #3b82f6; --brand-ink: #ffffff; --brand-soft: rgba(59,130,246,.14);
  --ok: #22c55e; --warn: #f59e0b; --danger: #ef4444; --info: #06b6d4;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 8px 28px rgba(0,0,0,.35);
}
[data-theme="light"] {
  --bg: #f4f6fa; --bg-soft: #eef1f7; --panel: #ffffff; --panel-2: #f7f9fc;
  --line: #dde3ec; --line-soft: #e8edf4;
  --text: #16202e; --text-dim: #566274; --text-mute: #8894a6;
  --brand: #2563eb; --brand-soft: rgba(37,99,235,.10);
  --shadow: 0 8px 28px rgba(20,35,60,.10);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--brand); text-decoration: none; }
h1,h2,h3 { margin: 0; font-weight: 650; }
svg { width: 18px; height: 18px; fill: currentColor; flex: none; }

/* ── 认证页 ─────────────────────────────────────────────── */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1100px 520px at 50% -10%, var(--brand-soft), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 520px; }
.auth-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.auth-brand h1 { font-size: 20px; letter-spacing: .3px; }
.auth-brand p { margin: 3px 0 0; color: var(--text-dim); font-size: 12.5px; }
.logo { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #7c3aed); color: #fff; font-weight: 700; letter-spacing: .5px; }
.logo.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.auth-foot { margin: 16px 0 0; text-align: center; color: var(--text-dim); font-size: 12.5px; }

/* ── 表单 ──────────────────────────────────────────────── */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--text-dim); }
input, select, textarea {
  width: 100%; padding: 10px 12px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; }
.form-error { margin: -4px 0 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.32); color: #fca5a5; font-size: 12.5px; }
[data-theme="light"] .form-error { color: #b91c1c; }
.form-error.ok { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.32); color: #86efac; }
[data-theme="light"] .form-error.ok { color: #15803d; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ── 按钮 ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 15px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
  color: var(--text); font: inherit; font-weight: 500; cursor: pointer; transition: .15s; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--brand-ink); }
.btn.danger { border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn.danger:hover { background: rgba(239,68,68,.14); border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text-dim); cursor: pointer; font-size: 15px; }
.icon-btn:hover { color: var(--brand); border-color: var(--brand); }

/* ── 布局 ──────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100%; }
.sidebar { background: var(--bg-soft); border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 16px; }
#nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm); color: var(--text-dim); font-weight: 500; }
#nav a:hover { background: var(--panel); color: var(--text); }
#nav a.active { background: var(--brand-soft); color: var(--brand); }
#nav .section { padding: 14px 12px 6px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-mute); }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line-soft); }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft); background: var(--panel); position: sticky; top: 0; z-index: 20; }
.topbar h2 { font-size: 16px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip { padding: 5px 11px; background: var(--brand-soft); color: var(--brand);
  border-radius: 999px; font-size: 12px; font-weight: 600; }
.view { padding: 22px; flex: 1; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 29; }
.only-mobile { display: none; }

/* ── 组件 ──────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 14.5px; }
.card-head .spacer { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--text-dim); font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.stat .value { font-size: 27px; font-weight: 680; margin-top: 7px; letter-spacing: -.5px; }
.stat.accent .value { color: var(--brand); }
.stat.warn .value { color: var(--warn); }
.stat.ok .value { color: var(--ok); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.toolbar .spacer { margin-left: auto; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { background: var(--panel-2); color: var(--text-dim); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
td.actions { display: flex; gap: 7px; }
.empty { padding: 46px 20px; text-align: center; color: var(--text-mute); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge.owner { background: rgba(124,58,237,.16); color: #c084fc; }
.badge.admin { background: rgba(59,130,246,.16); color: #93c5fd; }
.badge.moderator { background: rgba(6,182,212,.16); color: #67e8f9; }
.badge.user { background: rgba(148,163,184,.16); color: #cbd5e1; }
.badge.active, .badge.approved, .badge.online { background: rgba(34,197,94,.15); color: #86efac; }
.badge.disabled, .badge.rejected, .badge.offline { background: rgba(239,68,68,.15); color: #fca5a5; }
.badge.pending, .badge.maintenance { background: rgba(245,158,11,.15); color: #fcd34d; }
[data-theme="light"] .badge.owner { color: #7e22ce; }
[data-theme="light"] .badge.admin { color: #1d4ed8; }
[data-theme="light"] .badge.moderator { color: #0e7490; }
[data-theme="light"] .badge.active, [data-theme="light"] .badge.approved,
[data-theme="light"] .badge.online { color: #15803d; }
[data-theme="light"] .badge.disabled, [data-theme="light"] .badge.rejected,
[data-theme="light"] .badge.offline { color: #b91c1c; }
[data-theme="light"] .badge.pending, [data-theme="light"] .badge.maintenance { color: #b45309; }

.pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--text-dim); font-size: 12.5px; }
.pager .spacer { margin-left: auto; }
.muted { color: var(--text-mute); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ── 模态 / 提示 ───────────────────────────────────────── */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center;
  padding: 20px; z-index: 100; }
.modal { width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column;
  gap: 9px; z-index: 200; }
.toast { padding: 11px 16px; border-radius: var(--radius-sm); background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; max-width: 330px;
  animation: slide-in .18s ease-out; }
.toast.err { border-color: rgba(239,68,68,.45); color: #fca5a5; }
.toast.ok { border-color: rgba(34,197,94,.45); color: #86efac; }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.bar-row .label { width: 92px; color: var(--text-dim); }
.bar { flex: 1; height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar-row .num { width: 44px; text-align: right; color: var(--text-dim); }

.timeline { display: flex; flex-direction: column; gap: 2px; }
.timeline li { list-style: none; display: flex; gap: 12px; padding: 8px 2px;
  border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.timeline li:last-child { border-bottom: none; }
.timeline .t { color: var(--text-mute); width: 132px; flex: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; width: 236px; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; }
  .only-mobile { display: grid; }
  .view { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
}