/* 授权管理后台 · 黑白克制风格 */
:root {
  --ink: #14161a;
  --muted: #6b6f76;
  --line: #e4e4e0;
  --line-strong: #cfcfc9;
  --bg: #fafaf8;
  --sand: #f4f4f0;
  --danger: #b42318;
  --ok: #157347;
  --warn: #a15c07;
  --radius: 8px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[v-cloak] { display: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 13.5px/1.6 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 620; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 620; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- 登录 ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-image:
    linear-gradient(rgba(20, 22, 26, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 22, 26, .028) 1px, transparent 1px);
  background-size: 28px 28px;
}
.login-card {
  width: 360px;
  padding: 32px 30px 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 20px 50px -30px rgba(20, 22, 26, .35);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-mark, .brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.login-brand h1 { font-size: 19px; margin-top: 12px; }
.login-brand p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.login-button { width: 100%; margin-top: 6px; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px;
  flex: 0 0 208px;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: #fff;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 8px 22px; font-size: 15px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav button {
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 520;
  color: #4c4f56;
}
nav button:hover { background: var(--sand); color: var(--ink); }
nav button.active { background: var(--ink); color: #fff; font-weight: 600; }
.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}
.sidebar-user { flex: 1 1 100%; font-weight: 600; font-size: 12.5px; }
.workspace { flex: 1; min-width: 0; padding: 30px 34px 60px; max-width: 1280px; }

/* ---------- 控制 ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
}
.button:hover { background: var(--sand); }
.button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.button.primary:hover { background: #000; }
.button.danger { color: var(--danger); border-color: #e6cbc7; }
.button.danger:hover { background: #fdf1ef; }
.text-button {
  border: 0;
  background: transparent;
  padding: 3px 2px;
  font-size: 12.5px;
  color: var(--ink);
}
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
input:not([type=checkbox]), select, textarea {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.search-input { width: 280px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }

/* ---------- 概览 ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; margin-bottom: 22px; }
.stat { padding: 18px 20px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; }
.stat strong { display: block; margin-top: 6px; font-size: 28px; font-weight: 620; font-variant-numeric: tabular-nums; }
.stat.warn strong { color: var(--warn); }
.stat.danger strong { color: var(--danger); }
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* ---------- 表格 ---------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 12px;
  background: var(--sand);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .06em;
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid #f1f1ec; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfbf8; }
td.ops, th.ops { text-align: right; white-space: nowrap; }
td.ops .text-button { margin-left: 8px; }
.empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.ok { background: #eef5f0; color: var(--ok); }
.badge.warn { background: #fdf6e8; color: var(--warn); }
.badge.bad { background: #fbeceb; color: var(--danger); }

/* ---------- 弹窗 / 抽屉 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, .34);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}
.dialog {
  width: 560px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.dialog.small { width: 420px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.dialog-body { padding: 16px 24px; overflow: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--line); }
.close-button { border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.close-button:hover { background: var(--sand); color: var(--ink); }
.form-field { display: block; margin-bottom: 12px; color: #565a62; font-size: 12.5px; font-weight: 550; }
.form-field input, .form-field textarea, .form-field select { display: block; width: 100%; margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { color: var(--muted); font-size: 12px; }
.inline-error {
  margin: 8px 0 0;
  padding: 9px 12px;
  border-radius: 6px;
  background: #fdf1ef;
  color: var(--danger);
  font-size: 12.5px;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(720px, 100%);
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px -40px rgba(20, 22, 26, .5);
  display: flex;
  flex-direction: column;
  z-index: 60;
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 26px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; }
.drawer-body { padding: 20px 26px 40px; overflow: auto; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-bottom: 18px; }
.kv span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .05em; }
.kv strong { display: block; margin-top: 2px; font-size: 13px; font-weight: 550; }
.kv .badge { display: inline-flex; width: max-content; }
.actions-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.section-title { margin: 22px 0 10px; font-size: 13px; font-weight: 650; letter-spacing: .04em; color: #494d54; }
.code {
  margin: 0;
  padding: 14px 16px;
  background: #f7f7f4;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.code.scroll { max-height: 260px; overflow: auto; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  z-index: 90;
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static; flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; }
  .brand { padding: 0; }
  nav { flex-direction: row; overflow-x: auto; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; flex-wrap: nowrap; }
  .sidebar-user { flex: none; }
  .workspace { padding: 20px 16px 40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-top: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .panels { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
}
