:root {
  --bg: #0f1320;
  --surface: #161b2e;
  --surface-2: #1d2440;
  --border: rgba(120, 140, 210, 0.22);
  --text: #e8ecff;
  --text-muted: #9aa3c7;
  --accent: #2de2e6;
  --danger: #ff6b81;
  --ok: #4ade80;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 800px at 70% -10%, #1b2347 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }

/* ===== 登录页 ===== */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); text-align: center;
}
.auth-logo { font-size: 40px; color: var(--accent); margin-bottom: 8px; }
.auth-title { font-size: 20px; margin: 6px 0 4px; }
.auth-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 20px; }
.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 10px; }
.auth-input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 14px; outline: none;
}
.auth-input:focus { border-color: var(--accent); }
.auth-btn {
  width: 100%; padding: 12px; border: none; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, #2de2e6, #4f8cff); color: #08111f; font-weight: 700; font-size: 15px;
}
.auth-btn:disabled { opacity: .6; cursor: default; }
.auth-foot { color: var(--text-muted); font-size: 12px; margin-top: 16px; }

/* ===== 控制台 ===== */
.console { max-width: 760px; margin: 0 auto; padding: 24px 16px 60px; }
.console-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; margin-bottom: 18px;
}
.console-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.console-title i { color: var(--accent); }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 18px;
}
.panel-title { font-size: 15px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.panel-title i { color: var(--accent); }

.create-row { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-input.inline { flex: 1 1 160px; margin-bottom: 0; }
.auth-btn.inline { width: auto; padding: 12px 22px; white-space: nowrap; }
.msg { font-size: 13px; margin-top: 10px; min-height: 16px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

.user-list { display: flex; flex-direction: column; gap: 12px; }
.loading { color: var(--text-muted); font-size: 14px; padding: 8px 0; }
.user-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
}
.user-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-name { font-weight: 700; font-size: 15px; }
.badge-me { font-size: 11px; background: rgba(45,226,230,.18); color: var(--accent); padding: 2px 8px; border-radius: 999px; }
.badge-date { font-size: 12px; color: var(--text-muted); }
.user-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; display: flex; gap: 16px; flex-wrap: wrap; }
.user-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn-sm {
  border: 1px solid var(--border); background: transparent; color: var(--text);
  padding: 7px 12px; border-radius: 9px; cursor: pointer; font-size: 13px;
}
.btn-sm:hover { border-color: var(--accent); }
.btn-sm:disabled { opacity: .4; cursor: default; }
.btn-danger { color: var(--danger); border-color: rgba(255,107,129,.4); }
.btn-danger:hover { background: rgba(255,107,129,.12); border-color: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  z-index: 99999; max-width: 90vw;
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }

@media (max-width: 520px) {
  .create-row { flex-direction: column; }
  .auth-input.inline, .auth-btn.inline { width: 100%; }
}

/* ===== 账号列表：标题行 + 搜索 ===== */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head .panel-title { margin: 0; }
.auth-input.inline.search { flex: 1 1 160px; margin-bottom: 0; padding: 8px 12px; font-size: 13px; }

/* ===== 模态框（独立域名，无锁屏遮挡问题，z-index 取高值即可） ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6, 10, 22, .72);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 9000;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(0,0,0,.5); overflow: hidden;
}
.modal-lg { max-width: 720px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-title i { color: var(--accent); }
.modal-close {
  background: transparent; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-sub {
  padding: 12px 18px 0; font-size: 12px; color: var(--text-muted); display: flex; gap: 16px; flex-wrap: wrap;
}
.modal-sub b { color: var(--text); font-weight: 600; }

/* ===== 数据查看 / 编辑 ===== */
.data-tabs { display: flex; gap: 4px; padding: 12px 18px 0; }
.tab {
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  padding: 7px 14px; border-radius: 9px 9px 0 0; cursor: pointer; font-size: 13px;
}
.tab.active { background: var(--surface-2); color: var(--text); border-bottom-color: var(--surface-2); }
.data-body { padding: 0 18px; flex: 1; min-height: 0; }
.data-view, .data-edit {
  margin: 0; width: 100%; height: 46vh; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 0 0 10px 10px;
  padding: 14px; color: var(--text); font-size: 12.5px; line-height: 1.55;
  font-family: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  white-space: pre-wrap; word-break: break-word;
}
.data-edit { resize: none; outline: none; }
.data-edit:focus { border-color: var(--accent); }

.modal-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.footer-left, .footer-right { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-primary {
  border: none; background: linear-gradient(135deg, #2de2e6, #4f8cff); color: #08111f;
  font-weight: 700; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-size: 13px;
}
.btn-primary:hover { opacity: .92; }

/* ===== 历史版本 ===== */
.history-hint { padding: 12px 18px 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.history-list { padding: 12px 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.history-item .hi-time { font-size: 13px; }
.history-item .hi-time small { color: var(--text-muted); display: block; font-size: 11px; }
.history-item .hi-empty { color: var(--text-muted); font-size: 12px; }

