/* =====================================================================
   NexAuth 管理控制台 · 样式表
   视觉方向：Google 简约风 / Material Design 3 灵感
   结构：1 设计令牌  2 基础重置  3 布局骨架  4 按钮  5 表单
        6 卡片与统计  7 徽章  8 表格  9 弹层  10 页面专有  11 响应式
   无外链字体 / 无第三方资源，可离线使用。
   ===================================================================== */

/* ============ 1. 设计令牌 ============ */
:root {
  /* 品牌与语义色（亮色主题） */
  --primary: #1a73e8;
  --primary-hover: #1765cc;
  --primary-soft: #e8f0fe;
  --on-primary: #ffffff;
  --success: #188038;
  --success-soft: #e6f4ea;
  --warning: #f29900;
  --warning-soft: #fef7e0;
  --danger: #d93025;
  --danger-soft: #fce8e6;
  --info-soft: #e8f0fe;

  /* 文本与表面 */
  --text: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --border: #dadce0;
  --border-light: #e8eaed;
  --surface: #ffffff;
  --bg: #f8f9fa;
  --hover: #f1f3f4;
  --overlay: rgba(32, 33, 36, 0.45);

  /* 结构 */
  --shadow-1: 0 1px 2px rgba(60, 64, 67, 0.12);
  --shadow-2: 0 2px 6px rgba(60, 64, 67, 0.16), 0 1px 2px rgba(60, 64, 67, 0.1);
  --shadow-3: 0 12px 32px rgba(60, 64, 67, 0.2), 0 2px 8px rgba(60, 64, 67, 0.12);
  --radius-card: 12px;
  --radius-input: 8px;
  --radius-btn: 8px;
  --radius-pill: 999px;
  --appbar-h: 64px;
  --sidebar-w: 240px;
  --content-max: 1400px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* 深色主题 */
[data-theme="dark"] {
  --primary: #8ab4f8;
  --primary-hover: #aecbfa;
  --primary-soft: #1f3049;
  --on-primary: #202124;
  --success: #81c995;
  --success-soft: #1e3526;
  --warning: #fdd663;
  --warning-soft: #3a3014;
  --danger: #f28b82;
  --danger-soft: #3d1f1d;
  --info-soft: #1f3049;

  --text: #e8eaed;
  --text-secondary: #9aa0a6;
  --text-tertiary: #80868b;
  --border: #3c4043;
  --border-light: #35363a;
  --surface: #292a2d;
  --bg: #202124;
  --hover: #35363a;
  --overlay: rgba(0, 0, 0, 0.6);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-3: 0 16px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* ============ 2. 基础重置 ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body.no-scroll {
  overflow: hidden;
}
h1,
h2,
h3,
h4,
h5 {
  margin: 0;
  font-weight: 500;
  line-height: 1.3;
}
p {
  margin: 0;
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
svg {
  display: block;
  flex: none;
}
img {
  max-width: 100%;
  display: block;
}
code,
kbd,
pre {
  font-family: var(--mono);
}
::selection {
  background: var(--primary-soft);
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
  border: 2px solid var(--surface);
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ============ 3. 通用工具类 ============ */
.hidden {
  display: none !important;
}
.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}
.muted {
  color: var(--text-secondary);
}
.tertiary {
  color: var(--text-tertiary);
}
.small {
  font-size: 12px;
}
.nowrap {
  white-space: nowrap;
}
.text-right {
  text-align: right;
}
.grow {
  flex: 1 1 auto;
  min-width: 0;
}
.flex {
  display: flex;
  align-items: center;
  gap: 8px;
}
.flex-wrap {
  flex-wrap: wrap;
}
.spacer {
  flex: 1 1 auto;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.icon {
  width: 20px;
  height: 20px;
}
.icon-sm {
  width: 16px;
  height: 16px;
}
.icon-lg {
  width: 24px;
  height: 24px;
}
.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 16px 0;
}

/* ============ 4. 启动占位 ============ */
.boot-splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--text-secondary);
}
.boot-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  animation: boot-pulse 1.6s ease-in-out infinite;
}
.boot-text {
  font-size: 13px;
  letter-spacing: 0.5px;
}

/* ============ 5. 布局骨架 ============ */
.appbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: calc(var(--sidebar-w) - 16px);
  padding-right: 8px;
  flex: none;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark svg {
  width: 21px;
  height: 21px;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.brand-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text);
}
.brand-sub {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.appbar-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 6px;
}
.appbar-title {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.appbar-spacer {
  flex: 1 1 auto;
}
.menu-btn {
  display: none;
}
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}
.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.health-pill.is-offline .health-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.icon-btn:active {
  background: var(--border-light);
}
.admin-menu {
  position: relative;
}
.admin-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 8px 0 4px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--text);
  transition: background 0.15s var(--ease);
}
.admin-btn:hover {
  background: var(--hover);
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  flex: none;
}
.admin-name {
  font-size: 13px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 248px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-3);
  z-index: 70;
  display: none;
}
.dropdown.open {
  display: block;
  animation: menu-pop 0.15s var(--ease);
}
.dropdown-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.dropdown-name {
  font-size: 14px;
  font-weight: 500;
}
.dropdown-role {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
}
.dropdown-item:hover {
  background: var(--hover);
}
.dropdown-item.danger {
  color: var(--danger);
}
.dropdown-item .icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}
.dropdown-item.danger .icon {
  color: var(--danger);
}

/* 侧边导航 */
.sidebar {
  position: fixed;
  top: var(--appbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 10px 0 12px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 35;
}
.nav-section {
  padding: 6px 0;
}
.nav-label {
  padding: 8px 24px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.7px;
  color: var(--text-secondary);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: calc(100% - 20px);
  height: 44px;
  margin: 2px 10px;
  padding: 0 14px;
  border: 0;
  border-radius: 22px;
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-item .icon {
  width: 20px;
  height: 20px;
  flex: none;
}
.nav-item:hover {
  background: var(--hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.nav-item.active:hover {
  background: var(--primary-soft);
}
.nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-foot {
  margin-top: auto;
  padding: 18px 20px 4px;
  border-top: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 11.5px;
  line-height: 1.7;
}
.nav-foot strong {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}
.sidebar-scrim {
  position: fixed;
  inset: var(--appbar-h) 0 0 0;
  background: var(--overlay);
  z-index: 34;
  display: none;
}

/* 主内容区 */
.main {
  margin-left: var(--sidebar-w);
  padding-top: var(--appbar-h);
  min-height: 100vh;
}
.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 32px 56px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head-main {
  min-width: 0;
}
.page-title {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.4px;
  line-height: 1.2;
}
.page-sub {
  margin-top: 5px;
  font-size: 14px;
  color: var(--text-secondary);
}
.page-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============ 6. 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease),
    border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.btn .icon {
  width: 18px;
  height: 18px;
}
.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-1);
}
.btn-outline {
  border-color: var(--border);
  background: var(--surface);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.btn-text {
  padding: 0 12px;
  color: var(--primary);
}
.btn-text:hover {
  background: var(--primary-soft);
}
.btn-tonal {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-tonal:hover {
  background: var(--primary-soft);
  box-shadow: var(--shadow-1);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(0.94);
  box-shadow: var(--shadow-1);
}
.btn-danger-outline {
  border-color: var(--border);
  background: var(--surface);
  color: var(--danger);
}
.btn-danger-outline:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
}
.btn-sm .icon {
  width: 16px;
  height: 16px;
}
.btn-icon {
  width: 36px;
  padding: 0;
}
.btn-icon.btn-sm {
  width: 30px;
}
.btn-block {
  width: 100%;
}
.btn.is-loading {
  pointer-events: none;
  opacity: 0.85;
}
.btn.is-loading .btn-label {
  visibility: hidden;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn {
  position: relative;
}
.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--primary);
  font-size: inherit;
  font-weight: 500;
}
.link-btn:hover {
  text-decoration: underline;
}
.link-btn.danger {
  color: var(--danger);
}

/* ============ 7. 表单 ============ */
.input,
.select,
.textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-tertiary);
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--text-tertiary);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--hover);
  color: var(--text-secondary);
  cursor: not-allowed;
}
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}
[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.input.invalid,
.select.invalid,
.textarea.invalid {
  border-color: var(--danger);
}
.input.invalid:focus,
.select.invalid:focus,
.textarea.invalid:focus {
  box-shadow: 0 0 0 1px var(--danger);
}
textarea.input {
  height: auto;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}
.form-grid.cols-1 {
  grid-template-columns: 1fr;
}
.form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.form-field.full {
  grid-column: 1 / -1;
}
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-label .req {
  color: var(--danger);
}
.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}
.form-error {
  font-size: 12px;
  color: var(--danger);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.form-actions.left {
  justify-content: flex-start;
}
.help-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}
.field-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.field-row .input {
  flex: 1 1 auto;
}
.input-group {
  display: flex;
  gap: 8px;
}
.input-group .input {
  flex: 1 1 auto;
  min-width: 0;
}
.input-affix {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

/* 开关 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--border);
  transition: background 0.18s var(--ease);
  flex: none;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
[data-theme="dark"] .switch-track::after {
  background: #e8eaed;
}
.switch input:checked + .switch-track {
  background: var(--primary);
}
.switch input:checked + .switch-track::after {
  transform: translateX(18px);
  background: #ffffff;
}
[data-theme="dark"] .switch input:checked + .switch-track::after {
  background: #202124;
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.switch input:disabled + .switch-track {
  opacity: 0.5;
}
.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.switch-row:last-child {
  border-bottom: 0;
}
.switch-row-main {
  min-width: 0;
}
.switch-row-title {
  font-size: 14px;
}
.switch-row-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 分段控件 */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--hover);
}
.segmented button {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.segmented button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-1);
}

/* ============ 8. 卡片与统计 ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.card + .card {
  margin-top: 20px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 16px;
  font-weight: 500;
}
.card-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}
.card-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body {
  padding: 22px;
}
.card-body.tight {
  padding: 14px 18px;
}
.card-body.flush {
  padding: 0;
}
.card-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 14px;
}
.section-title {
  font-size: 16px;
  font-weight: 500;
}
.section-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 102px;
  padding: 18px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.16s var(--ease), border-color 0.16s var(--ease);
}
.stat-card:hover {
  box-shadow: var(--shadow-2);
}
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--primary-soft);
  color: var(--primary);
}
.stat-icon .icon {
  width: 21px;
  height: 21px;
}
.stat-icon.green {
  background: var(--success-soft);
  color: var(--success);
}
.stat-icon.amber {
  background: var(--warning-soft);
  color: var(--warning);
}
.stat-icon.red {
  background: var(--danger-soft);
  color: var(--danger);
}
.stat-icon.gray {
  background: var(--hover);
  color: var(--text-secondary);
}
.stat-body {
  min-width: 0;
  flex: 1 1 auto;
}
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.stat-foot {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-foot .up {
  color: var(--success);
}

/* 仪表盘网格 */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.dash-grid + .dash-grid {
  margin-top: 20px;
}
.dash-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.dash-col > .card + .card {
  margin-top: 0;
}

/* 图表 */
.chart-wrap {
  padding: 8px 20px 16px;
}
.chart-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  margin-top: 4px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--primary);
}
.legend-dot.green {
  background: var(--success);
}
.legend-dot.amber {
  background: var(--warning);
}
.chart-empty {
  height: 220px;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* 在线环形图 */
.online-panel {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--border-light);
}
.donut {
  position: relative;
  width: 96px;
  height: 96px;
  flex: none;
}
.donut svg {
  width: 96px;
  height: 96px;
  transform: rotate(-90deg);
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}
.donut-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
}
.donut-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.online-meta {
  min-width: 0;
  flex: 1 1 auto;
}
.online-meta .big {
  font-size: 15px;
  font-weight: 500;
}
.online-meta .sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 6px;
  box-shadow: 0 0 0 3px var(--success-soft);
  animation: live-pulse 2s ease-in-out infinite;
  vertical-align: 1px;
}

/* 排行列表 */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 0 4px;
}
.rank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-name small {
  color: var(--text-tertiary);
  margin-left: 6px;
  font-size: 11.5px;
}
.rank-track {
  height: 6px;
  border-radius: 3px;
  background: var(--hover);
  overflow: hidden;
}
.rank-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
}
.rank-bar.green {
  background: var(--success);
}
.rank-value {
  color: var(--text-secondary);
  font-size: 12.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mini-empty {
  padding: 24px 0;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* 概览最近登录 */
.recent-list {
  display: flex;
  flex-direction: column;
}
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border-light);
}
.recent-item:last-child {
  border-bottom: 0;
}
.recent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  flex: none;
}
.recent-main {
  min-width: 0;
  flex: 1 1 auto;
}
.recent-title {
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.recent-title .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-time {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* 代码块 */
.code-card .card-body {
  padding: 0;
}
.code-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}
.code-tab {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.code-tab:hover {
  background: var(--hover);
  color: var(--text);
}
.code-tab.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.code-copy-btn {
  width: 30px;
  height: 30px;
  margin-left: auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.code-copy-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.code-pane {
  padding: 16px 18px;
  overflow-x: auto;
  background: #202124;
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}
[data-theme="dark"] .code-pane {
  background: #1b1c1f;
  border-top: 1px solid var(--border);
}
.code-pane pre {
  margin: 0;
  color: #e8eaed;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre;
}
.code-pane .c-key {
  color: #8ab4f8;
}
.code-pane .c-str {
  color: #81c995;
}
.code-pane .c-com {
  color: #9aa0a6;
}
.code-inline {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--hover);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}
.copy-field {
  display: flex;
  gap: 8px;
  align-items: center;
}
.copy-field .input {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg);
}
.copy-field .btn {
  flex: none;
}

/* ============ 9. 徽章 / Chip ============ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  background: var(--hover);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}
.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.chip-blue {
  background: var(--primary-soft);
  color: var(--primary);
}
.chip-green {
  background: var(--success-soft);
  color: var(--success);
}
.chip-amber {
  background: var(--warning-soft);
  color: var(--warning);
}
.chip-red {
  background: var(--danger-soft);
  color: var(--danger);
}
.chip-gray {
  background: var(--hover);
  color: var(--text-secondary);
}
.chip-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}
.badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  margin-right: 6px;
  vertical-align: 1px;
}
.badge-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.badge-dot.offline {
  background: var(--border);
  box-shadow: none;
}
.status-text {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}
.level-important {
  color: var(--danger);
  font-weight: 500;
}
.level-warning {
  color: var(--warning);
  font-weight: 500;
}

/* ============ 10. 表格 ============ */
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr {
  transition: background 0.1s var(--ease);
}
.table tbody tr:hover td {
  background: var(--hover);
}
.table .cell-main {
  font-weight: 500;
  color: var(--text);
}
.table .cell-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}
.table .cell-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
  white-space: nowrap;
}
.table .num {
  font-variant-numeric: tabular-nums;
}
.table .col-check {
  width: 44px;
}
.table.align-right th:last-child,
.table.align-right td:last-child {
  text-align: right;
}
.table-empty td {
  padding: 0;
}
.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.cell-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--hover);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex: none;
  text-transform: uppercase;
}
.cell-mono {
  font-family: var(--mono);
  font-size: 12.5px;
}
.cell-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cell-copy .copy-btn {
  border: 0;
  background: none;
  padding: 3px;
  border-radius: 5px;
  color: var(--text-tertiary);
  display: inline-flex;
}
.cell-copy .copy-btn:hover {
  background: var(--hover);
  color: var(--text);
}

/* 工具栏 + 筛选 */
.card-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}
.filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-item .input,
.filter-item .select {
  height: 36px;
  width: auto;
  min-width: 132px;
}
.filter-item .input.search {
  min-width: 208px;
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
  background-size: 16px;
}
[data-theme="dark"] .filter-item .input.search {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
}
.filter-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.chip-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.chip-filter {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}
.chip-filter:hover {
  background: var(--hover);
}
.chip-filter.active {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
  font-weight: 500;
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.card-foot .pagination {
  padding: 0;
  border-top: 0;
}
.page-info {
  margin-right: auto;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 17px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.page-btn:hover:not(:disabled):not(.active) {
  background: var(--hover);
  color: var(--text);
}
.page-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.page-btn .icon {
  width: 18px;
  height: 18px;
}
.page-size {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.page-size .select {
  height: 32px;
  width: auto;
  min-width: 76px;
  font-size: 13px;
}

/* ============ 11. 选项卡 ============ */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  position: relative;
  height: 44px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab:hover {
  color: var(--text);
  background: var(--hover);
}
.tab.active {
  color: var(--primary);
}
.tab.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
}
.tab .count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--hover);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab.active .count {
  background: var(--primary-soft);
  color: var(--primary);
}
.tab-panel {
  padding-top: 18px;
}

/* ============ 12. 提示条 ============ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
}
.alert .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: none;
}
.alert-info {
  background: var(--primary-soft);
  color: var(--text);
}
.alert-info .alert-icon,
.alert-info > .icon {
  color: var(--primary);
}
.alert-warn {
  background: var(--warning-soft);
  color: var(--text);
}
.alert-warn > .icon {
  color: var(--warning);
}
.alert-danger {
  background: var(--danger-soft);
  color: var(--text);
}
.alert-danger > .icon {
  color: var(--danger);
}
.alert-success {
  background: var(--success-soft);
  color: var(--text);
}
.alert-success > .icon {
  color: var(--success);
}
.alert a {
  font-weight: 500;
}
.danger-zone {
  border: 1px solid var(--danger);
  border-radius: var(--radius-card);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.danger-zone-main {
  min-width: 0;
  flex: 1 1 auto;
}
.danger-zone-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--danger);
}
.danger-zone-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* KV 展示 */
.kv-list {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 11px 16px;
  font-size: 13.5px;
  align-items: baseline;
}
.kv-key {
  color: var(--text-secondary);
  white-space: nowrap;
}
.kv-val {
  min-width: 0;
  word-break: break-all;
}
.kv-val.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}
.kv-row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
}
.kv-row:last-child {
  border-bottom: 0;
}

/* ============ 13. 弹层：模态框 / 抽屉 / Toast ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--overlay);
  animation: fade-in 0.15s var(--ease);
}
.modal {
  width: min(var(--modal-width, 560px), 100%);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-3);
  animation: dialog-pop 0.2s var(--ease);
  overflow: hidden;
}
.modal.modal-lg {
  --modal-width: 720px;
}
.modal.modal-sm {
  --modal-width: 420px;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 26px 0;
}
.modal-head-main {
  min-width: 0;
  flex: 1 1 auto;
}
.modal-title {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.2px;
}
.modal-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.modal-close {
  width: 32px;
  height: 32px;
  margin: -4px -6px 0 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.modal-close:hover {
  background: var(--hover);
  color: var(--text);
}
.modal-body {
  padding: 20px 26px;
  overflow-y: auto;
}
.modal-body.flush {
  padding: 0;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 6px 26px 22px;
}
.modal-foot.split {
  justify-content: space-between;
}
.modal-foot.start {
  justify-content: flex-start;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  justify-content: flex-end;
  background: var(--overlay);
  animation: fade-in 0.15s var(--ease);
}
.drawer {
  display: flex;
  flex-direction: column;
  width: min(var(--drawer-width, 620px), 100vw);
  height: 100%;
  background: var(--surface);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.22);
  animation: drawer-in 0.24s var(--ease);
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.drawer-head-main {
  min-width: 0;
  flex: 1 1 auto;
}
.drawer-title {
  font-size: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.drawer-sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-secondary);
  word-break: break-all;
}
.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px 24px 32px;
}
.drawer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex: none;
  flex-wrap: wrap;
}
.drawer-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: 0 -24px 20px;
  padding: 0 16px;
  overflow-x: auto;
  flex: none;
}

.toast-root {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 250px;
  max-width: 440px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #323232;
  color: #f1f3f4;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  animation: toast-in 0.22s var(--ease);
  pointer-events: auto;
}
[data-theme="dark"] .toast {
  background: #3c4043;
  border: 1px solid #4a4d51;
}
.toast .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: none;
  color: #fdd663;
}
.toast.success .icon {
  color: #81c995;
}
.toast.error .icon {
  color: #f28b82;
}
.toast.leaving {
  animation: toast-out 0.18s ease forwards;
}

/* ============ 14. 骨架屏 / 空状态 / 错误 / 404 ============ */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--hover);
  border-radius: 6px;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 1.5s infinite;
}
[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}
.sk-line {
  height: 12px;
  margin: 10px 0;
}
.sk-line.w-30 {
  width: 30%;
}
.sk-line.w-50 {
  width: 50%;
}
.sk-line.w-70 {
  width: 70%;
}
.sk-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}
.sk-table {
  padding: 8px 18px;
}
.sk-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.sk-row:last-child {
  border-bottom: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 24px;
  text-align: center;
}
.empty-art {
  width: 132px;
  height: 104px;
  margin-bottom: 14px;
  color: var(--border);
}
[data-theme="dark"] .empty-art {
  color: #4a4d51;
}
.empty-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.empty-desc {
  margin-top: 5px;
  max-width: 360px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.empty-state .btn {
  margin-top: 18px;
}
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 24px;
  text-align: center;
}
.error-code {
  font-size: 15px;
  font-weight: 600;
  color: var(--danger);
  letter-spacing: 1px;
}
.error-state .btn {
  margin-top: 16px;
}
.centered-state {
  display: grid;
  place-items: center;
  min-height: 260px;
}

/* ============ 15. 登录页 ============ */
.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: var(--bg);
}
.login-theme {
  position: absolute;
  top: 18px;
  right: 18px;
}
.login-inner {
  width: 100%;
  max-width: 424px;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.login-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-2);
}
.login-mark svg {
  width: 30px;
  height: 30px;
}
.login-brand-name {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.4px;
  line-height: 1.2;
}
.login-brand-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}
.login-card {
  padding: 30px 32px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
}
.login-title {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.2px;
}
.login-desc {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 22px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-form .btn {
  height: 40px;
  margin-top: 4px;
}
.login-demo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.login-demo code {
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}
.login-demo .btn {
  margin-left: auto;
}
.login-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.8;
}
.login-error {
  display: none;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}
.login-error.show {
  display: flex;
}
.login-error .icon {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  flex: none;
}

/* ============ 16. 页面专有 ============ */
.detail-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 18px;
}
.detail-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 600;
  text-transform: uppercase;
  flex: none;
}
.detail-name {
  font-size: 17px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}
.detail-section {
  margin-bottom: 22px;
}
.detail-section:last-child {
  margin-bottom: 0;
}
.detail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13.5px;
  font-weight: 500;
}
.detail-section-title .muted {
  font-weight: 400;
  font-size: 12px;
}
.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.inline-form .form-field {
  min-width: 130px;
}
.inline-form .btn {
  margin-bottom: 0;
}
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 18px;
}
.log-list {
  display: flex;
  flex-direction: column;
}
.log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.log-item:last-child {
  border-bottom: 0;
}
.log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--success);
  flex: none;
}
.log-dot.fail {
  background: var(--danger);
}
.log-main {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 13px;
}
.log-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  word-break: break-all;
}
.log-time {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.var-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.var-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 34px;
  gap: 8px;
  align-items: center;
}
.var-row .input {
  height: 36px;
}
.var-empty {
  padding: 22px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}
.generated-keys {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.9;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}
.form-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 28px;
  padding: 4px 0;
}
.code-value {
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
}
.table-scroll-hint {
  display: none;
}
.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.status-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.status-box .k {
  font-size: 12px;
  color: var(--text-secondary);
}
.status-box .v {
  font-size: 17px;
  font-weight: 600;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.list-toolbar-gap {
  height: 20px;
}
.toolbar-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.toolbar-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar-line .spacer {
  flex: 1 1 auto;
}
.notice-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  line-height: 1.7;
}
.switch-field {
  display: flex;
  align-items: center;
  min-height: 38px;
}
.settings-section + .settings-section {
  margin-top: 26px;
}
.settings-section-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}
.settings-section-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.site-notice-textarea {
  min-height: 72px;
}

/* ============ 17. 响应式 ============ */
@media (max-width: 1279px) {
  :root {
    --sidebar-w: 72px;
  }
  .brand {
    min-width: 0;
    padding-right: 4px;
  }
  .brand-text,
  .appbar-title,
  .appbar-sep,
  .health-text {
    display: none;
  }
  .nav-label {
    display: none;
  }
  .nav-section {
    padding: 4px 0;
  }
  .nav-section + .nav-section {
    border-top: 1px solid var(--border-light);
    margin-top: 4px;
    padding-top: 8px;
  }
  .nav-item {
    justify-content: center;
    width: calc(100% - 20px);
    padding: 0;
    border-radius: 16px;
    height: 46px;
  }
  .nav-text,
  .nav-badge {
    display: none;
  }
  .nav-foot {
    display: none;
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .content {
    padding: 24px 24px 48px;
  }
  .dash-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .form-grid,
  .form-grid.cols-3 {
    grid-template-columns: 1fr;
  }
  .form-switch-grid {
    grid-template-columns: 1fr;
  }
  .chart-wrap {
    padding: 4px 10px 12px;
  }
  .chart-legend {
    padding: 0 14px;
  }
  .card-head,
  .card-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .card-toolbar {
    padding: 12px 14px;
  }
  .filter-item .input.search {
    min-width: 160px;
  }
}

@media (max-width: 767px) {
  :root {
    --sidebar-w: 0px;
    --appbar-h: 58px;
  }
  .menu-btn {
    display: inline-flex;
  }
  .brand {
    gap: 8px;
  }
  .brand-text {
    display: flex;
  }
  .brand-sub {
    display: none;
  }
  .brand-name {
    font-size: 16px;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }
  .brand-mark svg {
    width: 18px;
    height: 18px;
  }
  .sidebar {
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    box-shadow: var(--shadow-3);
    z-index: 60;
  }
  body.nav-open .sidebar {
    transform: none;
  }
  body.nav-open .sidebar-scrim {
    display: block;
  }
  .nav-label,
  .nav-text {
    display: block;
  }
  .nav-section {
    padding: 6px 0;
  }
  .nav-item {
    justify-content: flex-start;
    gap: 14px;
    width: calc(100% - 20px);
    padding: 0 14px;
    border-radius: 22px;
  }
  .nav-foot {
    display: block;
  }
  .main {
    margin-left: 0;
  }
  .content {
    padding: 18px 16px 44px;
  }
  .page-head {
    margin-bottom: 18px;
  }
  .page-title {
    font-size: 22px;
  }
  .page-sub {
    font-size: 13px;
  }
  .page-actions {
    width: 100%;
    margin-left: 0;
  }
  .page-actions .btn {
    flex: 1 1 auto;
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .stat-card {
    min-height: 92px;
    padding: 14px;
    gap: 10px;
  }
  .stat-icon {
    width: 34px;
    height: 34px;
  }
  .stat-value {
    font-size: 22px;
  }
  .health-pill,
  .admin-name,
  .appbar-sep {
    display: none;
  }
  .admin-btn {
    padding: 0 2px;
  }
  .toolbar-actions {
    width: 100%;
    margin-left: 0;
  }
  .toolbar-actions .btn {
    flex: 1 1 auto;
  }
  .filter-item {
    flex: 1 1 100%;
  }
  .filter-item .input,
  .filter-item .select,
  .filter-item .input.search {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }
  .filters .filter-item .filter-label {
    display: none;
  }
  .pagination {
    padding: 12px;
  }
  .page-info {
    width: 100%;
    margin: 0 0 6px;
  }
  .page-size {
    margin-left: 0;
  }
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }
  .modal {
    max-height: calc(100vh - 24px);
    border-radius: 16px 16px 12px 12px;
  }
  .modal-head {
    padding: 18px 18px 0;
  }
  .modal-body {
    padding: 16px 18px;
  }
  .modal-foot {
    padding: 4px 18px 18px;
  }
  .modal-foot .btn {
    flex: 1 1 auto;
  }
  .drawer {
    width: 100vw;
  }
  .drawer-head {
    padding: 16px 18px;
  }
  .drawer-body {
    padding: 18px 18px 28px;
  }
  .drawer-foot {
    padding: 12px 18px;
  }
  .drawer-foot .btn {
    flex: 1 1 auto;
  }
  .login-card {
    padding: 24px 22px;
  }
  .toast-root {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast {
    max-width: none;
    min-width: 0;
    width: 100%;
  }
  .kv-list,
  .kv-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .kv-row {
    gap: 4px;
  }
  .health-pill {
    display: none;
  }
  .inline-form .form-field {
    min-width: 100%;
  }
  .status-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ 18. 动效 ============ */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes dialog-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes drawer-in {
  from {
    transform: translateX(48px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes menu-pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-out {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes boot-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.82;
  }
}
@keyframes live-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px var(--success-soft);
  }
  50% {
    box-shadow: 0 0 0 5px var(--success-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
