/* ==========================================================================
   认证管理 · cloud-auth 管理中心原型
   设计令牌：surface / ink / series 均取自校验通过的数据可视化色板
   ========================================================================== */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f3f2ee;
  --surface-3: #e9e8e2;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, .10);
  --border-strong: rgba(11, 11, 11, .18);
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --accent-ink: #1c5cab;
  --accent-soft: #e7f0fc;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-bg: rgba(12, 163, 12, .10);
  --warning: #fab219;
  --warning-ink: #7a5200;
  --warning-bg: rgba(250, 178, 25, .16);
  --serious: #ec835a;
  --serious-ink: #a4441c;
  --serious-bg: rgba(236, 131, 90, .16);
  --critical: #d03b3b;
  --critical-ink: #a02222;
  --critical-bg: rgba(208, 59, 59, .10);
  --shadow-1: 0 1px 2px rgba(11, 11, 11, .04), 0 8px 24px rgba(11, 11, 11, .06);
  --shadow-2: 0 16px 56px rgba(11, 11, 11, .22);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-w: 236px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #242423;
  --surface-3: #2e2e2c;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #4a4a46;
  --border: rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .20);
  --accent: #3987e5;
  --accent-hover: #4a94ea;
  --accent-ink: #86b6ef;
  --accent-soft: rgba(57, 135, 229, .18);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --good: #0ca30c;
  --good-ink: #3fce3f;
  --good-bg: rgba(12, 163, 12, .18);
  --warning: #fab219;
  --warning-ink: #fab219;
  --warning-bg: rgba(250, 178, 25, .16);
  --serious: #ec835a;
  --serious-ink: #f0a184;
  --serious-bg: rgba(236, 131, 90, .16);
  --critical: #d03b3b;
  --critical-ink: #f07a7a;
  --critical-bg: rgba(208, 59, 59, .20);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-2: 0 16px 56px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== 布局 ===== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  padding: 16px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.02em;
  flex: none;
}

.brand-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--muted); line-height: 1.4; }

.nav-group { margin-top: 14px; }
.nav-group:first-of-type { margin-top: 0; }

.nav-label {
  font-size: 11px;
  color: var(--muted);
  padding: 0 10px 6px;
  letter-spacing: .04em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
}

.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.nav-item .nav-icon { flex: none; opacity: .85; }
.nav-item .nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0 6px;
  line-height: 17px;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-count { background: rgba(255, 255, 255, .55); color: var(--accent-ink); }
html[data-theme="dark"] .nav-item.active .nav-count { background: rgba(0, 0, 0, .25); }

.sidebar-foot {
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
}

.sidebar-foot .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  margin-right: 6px;
  vertical-align: 1px;
}

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--page) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs b { color: var(--text-primary); font-weight: 500; }
.crumbs .sep { opacity: .5; }

.topbar-spacer { flex: 1; }

.top-search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  width: 230px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.top-search:hover { border-color: var(--border-strong); }

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px 0 4px;
  border-radius: 20px;
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
}
.user-chip:hover { background: var(--surface-2); }

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  flex: none;
}
.avatar.lg { width: 32px; height: 32px; font-size: 13px; }
.avatar.sq { border-radius: 7px; }

.user-name { font-size: 13px; }

.user-menu {
  position: absolute;
  right: 0;
  top: 40px;
  min-width: 200px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 6px;
  display: none;
  z-index: 50;
}
.user-menu.open { display: block; }
.user-menu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu .menu-name { font-size: 13px; font-weight: 500; }
.user-menu .menu-role { font-size: 11px; color: var(--muted); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); color: var(--text-primary); }
.menu-item.danger { color: var(--critical-ink); }

.content {
  padding: 24px 24px 72px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

/* ===== 页头 ===== */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head-main { min-width: 0; flex: 1; }
.page-title { font-size: 20px; line-height: 1.3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-desc { margin-top: 4px; font-size: 13px; color: var(--text-secondary); max-width: 760px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  cursor: pointer;
}
.back-link:hover { color: var(--text-primary); }

/* ===== 卡片 ===== */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 500; }
.card-sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }
.card-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }

/* ===== 指标卡 ===== */
.stat {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 104px;
}
.stat-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.02em;
}
.stat-value small { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.stat-foot { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--critical-ink); }
.delta.flat { color: var(--muted); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--critical-ink); border-color: color-mix(in srgb, var(--critical) 34%, transparent); background: transparent; }
.btn-danger:hover { background: var(--critical-bg); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.btn-sm { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 5px; }
.btn-lg { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--critical-ink); }

/* ===== 表单 ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label, .label {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field .req { color: var(--critical); }
.input, .select, .textarea {
  height: 32px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
  width: 100%;
}
.textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.hint.err { color: var(--critical-ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }

.search-box { position: relative; }
.search-box .icon { position: absolute; left: 9px; top: 8px; color: var(--muted); pointer-events: none; }
.search-box .input { padding-left: 30px; width: 240px; }

/* 开关 */
.switch {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 20px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  flex: none;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .15s;
}
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { transform: translateX(14px); }
html[data-theme="dark"] .switch::after { background: #d9d9d6; }

/* 复选/单选 */
.checkbox,
.radio {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
  vertical-align: -2px;
}

/* ===== 工具栏 ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .spacer { flex: 1; }
.toolbar .select { width: auto; min-width: 120px; }

/* ===== 表格 ===== */
.table-wrap { width: 100%; overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-1);
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover, .table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }
.table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.table .muted { color: var(--muted); }
.table .nowrap { white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }

.table-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.table-foot .spacer { flex: 1; }

.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.pager button:hover:not(:disabled) { background: var(--surface-2); color: var(--text-primary); }
.pager button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ===== 标签 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1;
  background: var(--surface-2);
  color: var(--text-secondary);
  white-space: nowrap;
  vertical-align: 1px;
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tag.good { background: var(--good-bg); color: var(--good-ink); }
.tag.warn { background: var(--warning-bg); color: var(--warning-ink); }
.tag.serious { background: var(--serious-bg); color: var(--serious-ink); }
.tag.critical { background: var(--critical-bg); color: var(--critical-ink); }
.tag.accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag.line { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.tag.sm { height: 19px; font-size: 11px; padding: 0 6px; }

.tag-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ===== 选项卡 ===== */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tab .badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 0 5px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border-radius: 7px;
  gap: 2px;
}
.segmented button {
  height: 26px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.segmented button.on { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); font-weight: 500; }

/* ===== 列表条目 ===== */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 13px; line-height: 1.45; }
.list-item .li-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item .li-side { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }

.alert-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
}
.alert-icon.high { background: var(--critical-bg); color: var(--critical-ink); }
.alert-icon.mid { background: var(--warning-bg); color: var(--warning-ink); }

/* ===== 键值列表 ===== */
.kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 10px 16px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12px; padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; word-break: break-all; }

/* ===== 代码块 ===== */
.code-block {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
}
.code-block .hl { color: var(--text-primary); }
.code-copy { position: absolute; right: 8px; top: 8px; }

/* ===== 空状态 ===== */
.empty {
  padding: 56px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty .empty-title { color: var(--text-secondary); font-size: 14px; margin-bottom: 4px; }

/* ===== 模态框 ===== */
.modal-root { position: fixed; inset: 0; z-index: 100; display: none; }
.modal-root.open { display: block; }
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 11, .42);
  backdrop-filter: blur(2px);
  animation: fade .16s ease;
}
.modal-card {
  position: relative;
  margin: 8vh auto 0;
  width: min(560px, calc(100vw - 32px));
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.1);
}
.modal-card.wide { width: min(760px, calc(100vw - 32px)); }
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.modal-foot .spacer { flex: 1; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ===== Toast ===== */
.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  padding: 11px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  animation: slidein .2s ease;
  pointer-events: auto;
}
.toast.out { animation: slideout .2s ease forwards; }
.toast .t-icon { flex: none; margin-top: 1px; }
.toast.success .t-icon { color: var(--good); }
.toast.error .t-icon { color: var(--critical); }
.toast.info .t-icon { color: var(--accent); }
@keyframes slidein { from { opacity: 0; transform: translateX(12px); } }
@keyframes slideout { to { opacity: 0; transform: translateX(12px); } }

/* ===== 图表 ===== */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  padding: 8px 10px;
  font-size: 12px;
  min-width: 132px;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity .08s;
}
.chart-tip.on { opacity: 1; }
.chart-tip .tt-title { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.chart-tip .tt-row { display: flex; align-items: center; gap: 6px; line-height: 1.7; }
.chart-tip .tt-row .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tip .tt-row .v { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 500; }

.chart-legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .sw { width: 8px; height: 8px; border-radius: 2px; }

.chart-table { margin-top: 12px; border-top: 1px solid var(--border); display: none; }
.chart-table.open { display: block; }
.chart-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.chart-table th, .chart-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.chart-table th { color: var(--muted); font-weight: 500; }

/* ===== 详情页头部 ===== */
.app-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.app-head .app-avatar {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-ink);
  flex: none;
}
.app-head .app-main { flex: 1; min-width: 0; }
.app-head .app-name { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.app-head .app-meta { margin-top: 4px; font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.app-head .app-desc { margin-top: 8px; font-size: 13px; color: var(--text-secondary); max-width: 820px; }
.app-head .app-actions { display: flex; gap: 8px; flex: none; }

/* ===== 向导 ===== */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.wstep {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  padding: 0 14px 0 0;
  white-space: nowrap;
  /* 步骤条为可点击按钮，需清掉浏览器默认样式 */
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s;
}
.wstep .idx {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.wstep .line { width: 34px; height: 1px; background: var(--border-strong); margin-left: 6px; }
.wstep.done { color: var(--text-secondary); }
.wstep.done .idx { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.wstep.active { color: var(--text-primary); font-weight: 500; }
.wstep.active .idx { background: var(--accent); border-color: var(--accent); color: #fff; }
/* 悬停反馈放在 done/active 之后，保证已完成步骤同样有可点击提示 */
.wstep:hover { color: var(--text-primary); }
.wstep:hover .idx { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.wstep.active:hover .idx { background: var(--accent); border-color: var(--accent); color: #fff; }
.wstep:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }
/* 第 3 步：每个端一组渠道单选 */
.wiz-channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.wiz-channel-opt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color .15s, background .15s;
}
.wiz-channel-opt:hover { border-color: var(--border-strong); }
.wiz-channel-opt.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.wiz-channel-name { font-size: 13px; font-weight: 500; }
/* 第 3 步「应用默认渠道」是按类型的下拉，不再用单选框 */
.wiz-channel-type { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.wiz-channel-opt .select { width: 100%; }

.wizard-card { max-width: 840px; }
.wizard-body { padding: 22px 24px; }
.wizard-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.wizard-foot .spacer { flex: 1; }

/* ===== 密钥展示 ===== */
.secret-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}
.secret-box .val { flex: 1; }

.callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid transparent;
}
.callout.warn { background: var(--warning-bg); color: var(--warning-ink); }
.callout.info { background: var(--accent-soft); color: var(--accent-ink); }
.callout.danger { background: var(--critical-bg); color: var(--critical-ink); }
.callout .c-icon { flex: none; margin-top: 1px; }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  background: var(--page);
}
.login-brandside {
  position: relative;
  overflow: hidden;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(150deg, #12192b 0%, #1b2a44 55%, #223a5e 100%);
  color: #fff;
}
.login-brandside::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -180px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(57, 135, 229, .55), transparent 62%);
}
.login-brandside .lb-mark { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.login-brandside .lb-mark .brand-mark { background: rgba(255, 255, 255, .14); }
.login-brandside h1 { font-size: 34px; line-height: 1.25; letter-spacing: -.02em; max-width: 460px; margin: 0; }
.login-brandside p { margin-top: 14px; color: rgba(255, 255, 255, .66); font-size: 14px; max-width: 420px; }
.login-brandside .lb-foot { position: relative; z-index: 2; font-size: 12px; color: rgba(255, 255, 255, .45); }
.login-brandside .lb-stats { position: relative; z-index: 2; display: flex; gap: 32px; margin-top: 40px; }
.login-brandside .lb-stat b { display: block; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.login-brandside .lb-stat span { font-size: 12px; color: rgba(255, 255, 255, .55); }

.login-panel { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(380px, 100%); }
.login-card h2 { font-size: 22px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-top: 6px; margin-bottom: 22px; }

.qr-box {
  width: 208px;
  height: 208px;
  margin: 18px auto 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(25, 1fr);
  grid-template-rows: repeat(25, 1fr);
  gap: 1px;
}
.qr-box i { background: transparent; border-radius: 1px; }
.qr-box i.on { background: #101010; }
.qr-status { text-align: center; font-size: 12px; color: var(--muted); }
.qr-status b { color: var(--text-primary); font-weight: 500; }

.login-methods { display: flex; gap: 4px; margin-bottom: 6px; }
.login-methods button {
  flex: 1;
  height: 32px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.login-methods button.on { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 500; }

/* ===== 对外申请页 ===== */
.apply-page { min-height: 100vh; background: var(--page); padding: 48px 16px 64px; }
.apply-card { width: min(720px, 100%); margin: 0 auto; }
.apply-head { text-align: center; margin-bottom: 24px; }
.apply-head h1 { font-size: 24px; }
.apply-head p { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ===== 杂项 ===== */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.secondary { color: var(--text-secondary); }
.tnum { font-variant-numeric: tabular-nums; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.hr { height: 1px; background: var(--border); border: 0; margin: 16px 0; }
.inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.prototype-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

/* ===== 响应式 ===== */
@media (max-width: 1180px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  :root { --sidebar-w: 64px; }
  .brand-text, .nav-label, .nav-item span.label, .nav-count, .sidebar-foot { display: none; }
  .brand { justify-content: center; padding: 4px 0 18px; }
  .nav-item { justify-content: center; padding: 0; }
  .login-page { grid-template-columns: 1fr; }
  .login-brandside { display: none; }
  .grid-3, .grid-even, .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .content { padding: 16px 14px 64px; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .top-search { display: none; }
  .kv { grid-template-columns: 104px minmax(0, 1fr); }
  .app-head { flex-wrap: wrap; }
}

/* ===== 投产检查清单 ===== */
.check-list { display: flex; flex-direction: column; }
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.check-row:last-child { border-bottom: 0; }
.check-ic {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
}
.check-ic.ok { background: var(--good-bg); color: var(--good-ink); }
.check-ic.no { background: var(--critical-bg); color: var(--critical-ink); }
.check-title { font-size: 13px; line-height: 1.5; }
.check-sub { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ===== 自建应用行 ===== */
.agent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.agent-row.pending { border-style: dashed; }
.agent-row .btn { margin-left: auto; }

/* 第 3 步分组 */
.wiz-group { margin-bottom: 20px; }
.wiz-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.wiz-group-head b { font-size: 13px; }
.wiz-group-head .link-btn { margin-left: auto; }

/* ===== SSO 中转演示 ===== */
.sso-flow { display: flex; flex-direction: column; gap: 10px; }
.sso-step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  overflow: hidden;
  transition: border-color .15s;
}
.sso-step.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sso-step.done { background: var(--surface-1); }
.sso-step.skipped { opacity: .45; }
.sso-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.sso-idx {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 11px; flex: none;
}
.sso-step.active .sso-idx { background: var(--accent); border-color: var(--accent); color: #fff; }
.sso-step.done .sso-idx { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.sso-title { font-size: 13px; font-weight: 500; }
.sso-who { margin-left: auto; font-size: 11px; color: var(--muted); }
.sso-body {
  padding: 0 16px 14px 48px;
  display: flex; flex-direction: column; gap: 6px;
}
.sso-req, .sso-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--surface-2);
  border-radius: 5px;
  padding: 8px 10px;
  word-break: break-all;
  line-height: 1.6;
}
.sso-ok { font-size: 12px; color: var(--good-ink); }
.sso-fail { font-size: 12px; color: var(--critical-ink); font-weight: 500; }

/* ===== 登录页 SSO 入口 ===== */
.sso-entry {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.sso-entry-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.sso-entry-icon {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid; place-items: center;
  flex: none;
}
.sso-entry-title { font-size: 13px; font-weight: 500; }
.sso-entry-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 登录页底部：原型演示切换器 */
.login-demo-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* ===== 环境标识 ===== */
.env-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
}
.env-test    { background: rgba(42,120,214,.12); color: var(--accent-ink); }
.env-staging { background: rgba(250,178,25,.18); color: var(--warning-ink); }
.env-prod    { background: rgba(12,163,12,.12);  color: var(--good-ink); }
html[data-theme="dark"] .env-test    { background: rgba(57,135,229,.22); }
html[data-theme="dark"] .env-staging { background: rgba(250,178,25,.20); }
html[data-theme="dark"] .env-prod    { background: rgba(12,163,12,.20); }

/* 环境注册方式选择 */
.env-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.env-mode-opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.env-mode-opt.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.env-mode-opt b { font-size: 13px; font-weight: 500; }
.env-mode-opt .hint { margin-top: 3px; }

/* ===== 二期标记 ===== */
.phase-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 9px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  vertical-align: 1px;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: help;
  user-select: none;
}
.nav-item .phase-badge {
  margin-left: auto;
  margin-right: 4px;
}
.nav-item .phase-badge + .nav-count { margin-left: 0; }
.page-title .phase-badge {
  font-size: 10px;
  vertical-align: 3px;
}
.phase-note {
  color: var(--muted);
}
