/* Voneip 统一认证中心 - 共享样式 */
:root {
  --bg: #0f172a;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success: #16a34a;
  --surface: #f1f5f9;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--text);
}

/* ---------- 认证类页面（居中卡片 + 深色渐变） ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 400px;
  padding: 32px 28px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.card.wide { max-width: 560px; }

h1 { margin: 0 0 6px; font-size: 22px; text-align: center; }
h2 { margin: 0 0 16px; font-size: 18px; }

.subtitle {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

button {
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
button:hover { background: var(--primary-hover); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

button.block { width: 100%; }
button.ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}
button.ghost:hover { background: var(--surface); }
button.danger { background: var(--danger); }
button.danger:hover { background: #b91c1c; }
button.small { padding: 6px 12px; font-size: 13px; }

.btn-row { display: flex; gap: 12px; }
.btn-row > * { flex: 1; }

.error { min-height: 18px; margin-top: 14px; font-size: 13px; color: var(--danger); text-align: center; }
.hint { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; }
.hint a { color: var(--primary); text-decoration: none; }
.hint a:hover { text-decoration: underline; }

/* ---------- 站点类页面（顶部导航 + 内容区） ---------- */
.site-body { background: var(--surface); min-height: 100vh; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.nav .brand { font-size: 16px; font-weight: 700; color: var(--text); text-decoration: none; }
.nav .links { display: flex; align-items: center; gap: 16px; }
.nav .links a { font-size: 14px; color: var(--muted); text-decoration: none; }
.nav .links a:hover, .nav .links a.active { color: var(--primary); }

.container { max-width: 880px; margin: 0 auto; padding: 32px 24px; }

.panel {
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel + .panel { margin-top: 20px; }

.hero { text-align: center; padding: 56px 24px; }
.hero h1 { font-size: 30px; margin-bottom: 12px; }
.hero p { max-width: 560px; margin: 0 auto 28px; color: var(--muted); line-height: 1.7; }

.info-list { display: grid; grid-template-columns: 120px 1fr; gap: 12px 16px; font-size: 14px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; }

.scope-list { list-style: none; margin: 0 0 20px; padding: 0; }
.scope-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 14px;
  background: var(--surface);
  border-radius: 8px;
}
.scope-list li::before { content: "✓"; color: var(--success); font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tbody tr:hover { background: var(--surface); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
}
.tag.gray { background: #e2e8f0; color: #475569; }
.tag.green { background: #dcfce7; color: #15803d; }
.tag.red { background: #fee2e2; color: #b91c1c; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar input { margin-bottom: 0; }
.toolbar .spacer { flex: 1; }

.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

/* 后台布局：侧边栏 + 主区 */
.admin-body { display: flex; min-height: 100vh; background: var(--surface); }
.sidebar {
  width: 200px;
  flex-shrink: 0;
  padding: 20px 12px;
  background: #0f172a;
  color: #cbd5e1;
}
.sidebar .brand { display: block; padding: 0 12px 20px; font-weight: 700; color: #fff; text-decoration: none; }
.sidebar a {
  display: block;
  padding: 10px 12px;
  margin-bottom: 4px;
  font-size: 14px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 8px;
}
.sidebar a:hover, .sidebar a.active { background: #1e293b; color: #fff; }
.admin-main { flex: 1; padding: 28px 32px; overflow-x: auto; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat-card { padding: 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .label { margin-top: 6px; font-size: 13px; color: var(--muted); }

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.6);
}
.modal-mask.show { display: flex; }
.modal { width: 100%; max-width: 460px; padding: 24px; background: var(--card); border-radius: var(--radius); }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

/* ---------- 个人中心：标签页 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.tabs .tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
}
.tabs .tab:hover { color: var(--text); background: transparent; }
.tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- 表单栅格 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.form-msg { min-height: 18px; margin: 4px 0 14px; font-size: 13px; }
.form-msg.ok { color: var(--success); }
.form-msg.err { color: var(--danger); }

/* ---------- 行内操作 ---------- */
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 复选框列与批量操作栏 ---------- */
.check-col { width: 36px; text-align: center; }
.check-col input { width: auto; margin: 0; }
.batch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
}
.batch-bar .spacer { flex: 1; }

/* ---------- 授权应用列表 ---------- */
.grant-list { display: grid; gap: 12px; }
.grant-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.grant-item .grant-name { font-weight: 600; }
.grant-item .grant-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }
.grant-item .grant-scopes { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.pagination button { padding: 6px 12px; font-size: 13px; }

/* ---------- 文档页 ---------- */
/* 左侧目录 + 右侧正文 */
.docs-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px;
}
.docs-sidebar {
  position: sticky;
  top: 24px;
  width: 220px;
  flex-shrink: 0;
  padding: 18px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.docs-group + .docs-group { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.docs-group-title {
  margin: 0 0 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.docs-nav a, .docs-toc a {
  display: block;
  padding: 8px 10px;
  margin-bottom: 2px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
}
.docs-nav a:hover, .docs-toc a:hover { background: var(--surface); color: var(--primary); }
.docs-nav a.active { background: var(--primary); color: #fff; }
.docs-toc a { font-size: 13px; color: var(--muted); }
.docs-toc a.level-3 { padding-left: 24px; font-size: 12px; }
.docs-main { flex: 1; min-width: 0; }
.docs-main .panel + .panel { margin-top: 0; }

@media (max-width: 860px) {
  .docs-layout { flex-direction: column; padding: 20px 16px; }
  .docs-sidebar { position: static; width: 100%; }
  .docs-toc { display: flex; flex-wrap: wrap; gap: 4px; }
  .docs-toc a { margin-bottom: 0; }
  .docs-toc a.level-3 { padding-left: 10px; }
}

.doc { padding: 32px 40px; line-height: 1.75; }
.doc h1 { text-align: left; font-size: 26px; }
.doc h2 { margin-top: 32px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.doc h3 { margin-top: 24px; }
.doc code {
  padding: 2px 6px;
  font-size: 13px;
  background: var(--surface);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.doc pre {
  padding: 16px;
  overflow-x: auto;
  background: #0f172a;
  border-radius: 8px;
}
.doc pre code { padding: 0; color: #e2e8f0; background: transparent; }
.doc table { margin: 16px 0; }
.doc blockquote {
  margin: 16px 0;
  padding: 8px 16px;
  color: var(--muted);
  border-left: 3px solid var(--border);
}
.doc a { color: var(--primary); }
