/* ===========================================================================
   设计系统 — 全局变量
   ========================================================================== */
:root {
  --c-bg:        #f8fafc;
  --c-surface:   #ffffff;
  --c-surface-2: #f1f5f9;
  --c-border:    #e2e8f0;
  --c-border-2:  #cbd5e1;
  --c-text:      #0f172a;
  --c-text-2:    #475569;
  --c-text-3:    #94a3b8;

  --c-primary:        #6366f1;
  --c-primary-hover:  #4f46e5;
  --c-primary-light:  #eef2ff;

  --c-success:   #10b981;
  --c-success-light: #d1fae5;
  --c-warning:   #f59e0b;
  --c-warning-light: #fef3c7;
  --c-danger:    #ef4444;
  --c-danger-light:  #fee2e2;
  --c-info:      #3b82f6;
  --c-info-light:    #dbeafe;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.06);
  --shadow-lg: 0 12px 28px rgba(15,23,42,.10);

  --topbar-h: 60px;
  --side-w: 240px;
  --side-collapsed-w: 64px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}

/* ========== Dark theme ========== */
:root[data-theme="dark"] {
  --c-bg:        #0b1120;
  --c-surface:   #111827;
  --c-surface-2: #1f2937;
  --c-border:    #1f2937;
  --c-border-2:  #374151;
  --c-text:      #f1f5f9;
  --c-text-2:    #cbd5e1;
  --c-text-3:    #94a3b8;

  --c-primary:        #818cf8;
  --c-primary-hover:  #a5b4fc;
  --c-primary-light:  rgba(129,140,248,.16);

  --c-success-light: rgba(16,185,129,.15);
  --c-warning-light: rgba(245,158,11,.15);
  --c-danger-light:  rgba(239,68,68,.18);
  --c-info-light:    rgba(59,130,246,.16);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 28px rgba(0,0,0,.45);
}
:root[data-theme="dark"] code { background: var(--c-surface-2); color: var(--c-text-2); }
:root[data-theme="dark"] .tag { border-color: transparent; }
:root[data-theme="dark"] table tbody tr:hover td { background: rgba(255,255,255,.02); }
:root[data-theme="dark"] input::placeholder, :root[data-theme="dark"] textarea::placeholder { color: var(--c-text-3); }
:root[data-theme="dark"] input, :root[data-theme="dark"] textarea, :root[data-theme="dark"] select {
  background: var(--c-surface-2);
  color: var(--c-text);
  border-color: var(--c-border-2);
}
:root[data-theme="dark"] input:focus, :root[data-theme="dark"] textarea:focus, :root[data-theme="dark"] select:focus {
  background: var(--c-surface);
  box-shadow: 0 0 0 3px rgba(129,140,248,.25);
}

/* ===========================================================================
   基础
   ========================================================================== */
*,*::before,*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
/* 锁住浏览器原生控件(select 弹层、scrollbar、date picker 等)跟随我们的 data-theme,而不是 OS 主题 */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  font-family: var(--font-sans);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-hover); }
code { font-family: var(--font-mono); font-size: .92em; background: var(--c-surface-2); padding: 2px 6px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--c-border); margin: 16px 0; }

h1 { margin: 0 0 8px; font-size: 22px; font-weight: 600; color: var(--c-text); letter-spacing: -.01em; }
h2 { margin: 24px 0 12px; font-size: 16px; font-weight: 600; color: var(--c-text); letter-spacing: -.005em; }
h3 { margin: 16px 0 8px; font-size: 14px; font-weight: 600; color: var(--c-text); }
.desc { color: var(--c-text-2); font-size: 13px; margin: -2px 0 20px; }
.muted { color: var(--c-text-3); font-size: 12px; }

/* ===========================================================================
   Topbar
   ========================================================================== */
.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  height: var(--topbar-h);
  padding: 0 24px;
  display: flex; align-items: center; gap: 20px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand {
  font-weight: 700; font-size: 15px; color: var(--c-text);
  letter-spacing: -.01em;
}
.topbar .nav { display: flex; gap: 2px; flex: 1; }
.topbar .nav a {
  color: var(--c-text-2); font-size: 13px; font-weight: 500;
  padding: 7px 12px; border-radius: var(--r-md);
  transition: background .15s, color .15s;
}
.topbar .nav a:hover { background: var(--c-surface-2); color: var(--c-text); }
.topbar .right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--c-text-2); }
.topbar .right > span:first-child { line-height: 1.2; }
.topbar button {
  background: var(--c-surface); border: 1px solid var(--c-border);
  color: var(--c-text-2); font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--r-md);
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.topbar button:hover { background: var(--c-surface-2); border-color: var(--c-border-2); color: var(--c-text); }
.qbadge {
  display: inline-block;
  padding: 4px 10px; border-radius: 999px;
  background: var(--c-primary-light); color: var(--c-primary);
  font-size: 12px; font-weight: 600;
  border: 1px solid #e0e7ff;
}
:root[data-theme="dark"] .qbadge { border-color: var(--c-border-2); }
.tb-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
  overflow: hidden;
  text-decoration: none;
}
.tb-avatar:hover { text-decoration: none; }
.tb-name {
  color: var(--c-text); font-size: 13px; font-weight: 500;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 720px) {
  .tb-name { display: none; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 12px; gap: 8px; height: 56px; }
  .topbar .brand { display: none; }
  .topbar .nav a { padding: 6px 10px; font-size: 13px; }
  .topbar .right > span:first-child { display: none; }
}

/* ===========================================================================
   普通页面容器
   ========================================================================== */
.wrap, .wrap-wide {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.wrap      { max-width: 720px;  margin: 24px auto; }
.wrap-wide { max-width: 1200px; margin: 24px auto; }
@media (max-width: 720px) {
  .wrap, .wrap-wide { margin: 12px; padding: 20px 16px; border-radius: var(--r-lg); }
}

/* ===========================================================================
   表单元素
   ========================================================================== */
label {
  display: block; margin: 16px 0 6px;
  font-size: 13px; font-weight: 500; color: var(--c-text-2);
}
input[type=text], input[type=email], input[type=password],
input[type=url],  input[type=number], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: 14px;
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--c-text-3); }
input:hover, textarea:hover, select:hover { border-color: var(--c-border-2); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
input:disabled, textarea:disabled, select:disabled {
  background: var(--c-surface-2); color: var(--c-text-3); cursor: not-allowed;
}
textarea { min-height: 80px; resize: vertical; }
.row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 540px) {
  .row, .row-3 { grid-template-columns: 1fr; }
}

/* ===========================================================================
   按钮
   ========================================================================== */
button.btn-primary {
  width: 100%;
  padding: 11px 18px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--c-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, transform .05s, box-shadow .12s;
  font-family: inherit;
  letter-spacing: .01em;
  box-shadow: 0 1px 2px rgba(99,102,241,.25);
}
button.btn-primary:hover:not(:disabled) {
  background: var(--c-primary-hover);
  box-shadow: 0 2px 8px rgba(99,102,241,.30);
}
button.btn-primary:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--shadow-sm); }
button.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

button.btn-small, a.btn-small {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  border-radius: var(--r-md);
  font-size: 12.5px; font-weight: 500;
  color: var(--c-text-2);
  cursor: pointer; text-decoration: none;
  transition: all .12s;
  font-family: inherit;
}
button.btn-small:hover, a.btn-small:hover {
  background: var(--c-surface-2);
  border-color: var(--c-border-2);
  color: var(--c-text);
  text-decoration: none;
}
button.btn-small.danger, a.btn-small.danger {
  color: var(--c-danger); border-color: #fecaca; background: #fef2f2;
}
button.btn-small.danger:hover { background: #fee2e2; border-color: #fca5a5; }
button.btn-small.primary, a.btn-small.primary {
  color: var(--c-primary); border-color: #c7d2fe; background: var(--c-primary-light);
}
button.btn-small.primary:hover { background: #e0e7ff; }
button.btn-small:disabled { opacity: .55; cursor: not-allowed; }

/* ===========================================================================
   消息/提示
   ========================================================================== */
.result {
  margin-top: 20px; padding: 14px 16px;
  background: var(--c-info-light); color: var(--c-info);
  border: 1px solid #bfdbfe;
  border-radius: var(--r-md);
  font-size: 13.5px; line-height: 1.7; display: none;
}
.result.show { display: block; }
.result.ok  { background: var(--c-success-light); color: var(--c-success); border-color: #a7f3d0; }
.result.err { background: var(--c-danger-light);  color: var(--c-danger);  border-color: #fecaca; }

.empty {
  color: var(--c-text-3); padding: 56px 24px; text-align: center;
  font-size: 13.5px; background: var(--c-surface);
  border: 1px dashed var(--c-border-2); border-radius: var(--r-md);
}

/* ===========================================================================
   标签 / 状态
   ========================================================================== */
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; height: 20px;
  font-size: 11.5px; font-weight: 500;
  border-radius: 4px;
  background: var(--c-surface-2); color: var(--c-text-2);
  letter-spacing: .02em;
  border: 1px solid var(--c-border);
}
.tag.role-super_admin { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.tag.role-admin       { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.tag.role-agent       { background: var(--c-info-light); color: #1d4ed8; border-color: #bfdbfe; }
.tag.role-user        { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.tag.status-banned    { background: var(--c-danger-light); color: var(--c-danger); border-color: #fecaca; }
.tag.status-active    { background: var(--c-success-light); color: var(--c-success); border-color: #a7f3d0; }
.tag.s-pending,
.tag.s-running        { background: var(--c-warning-light); color: var(--c-warning); border-color: #fde68a; }
.tag.s-approved,
.tag.s-done           { background: var(--c-success-light); color: var(--c-success); border-color: #a7f3d0; }
.tag.s-rejected,
.tag.s-failed         { background: var(--c-danger-light); color: var(--c-danger); border-color: #fecaca; }

/* ===========================================================================
   表格
   ========================================================================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
table th, table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--c-border); }
table thead th {
  font-weight: 500; color: var(--c-text-3); font-size: 11.5px;
  background: var(--c-surface-2); letter-spacing: .04em; text-transform: uppercase;
  position: sticky; top: 0;
}
table tbody tr:last-child td { border-bottom: 0; }
table tbody tr:hover td { background: #fafbfd; }
table td.actions { text-align: right; white-space: nowrap; }
table td.actions button, table td.actions a { margin-left: 4px; }

/* ===========================================================================
   key-value 显示
   ========================================================================== */
.kv {
  display: grid; grid-template-columns: 120px 1fr;
  gap: 10px 16px; font-size: 13.5px;
  padding: 6px 0;
}
.kv > .k { color: var(--c-text-3); font-weight: 500; }
.kv > .v { word-break: break-all; color: var(--c-text); }

/* ===========================================================================
   Modal
   ========================================================================== */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: none; z-index: 100; backdrop-filter: blur(2px);
}
.modal-bg.show { display: block; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 24px;
  min-width: 380px; max-width: 92vw; max-height: 84vh; overflow: auto;
  z-index: 101; display: none;
  box-shadow: var(--shadow-lg);
}
.modal.show { display: block; }
.modal h2 { margin: 0 0 16px; font-size: 16px; }

/* ===========================================================================
   Toolbar (搜索/筛选/操作 同一行)
   ========================================================================== */
.toolbar {
  display: flex; gap: 8px; align-items: center;
  margin: 0 0 16px; flex-wrap: wrap;
}
.toolbar input, .toolbar select { width: auto; flex: 0 0 auto; padding: 7px 12px; font-size: 13px; }
.toolbar input[type=text], .toolbar input[type=email], .toolbar input:not([type]) {
  flex: 1; min-width: 200px;
}

/* ===========================================================================
   Admin Shell — 左导航 + 右内容(全屏,无顶栏)
   ========================================================================== */
.admin-shell {
  display: flex;
  min-height: 100vh;
  background: var(--c-bg);
}
.admin-side {
  width: var(--side-w);
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  flex-shrink: 0;
  position: sticky; top: 0;
  align-self: flex-start;
  height: 100vh;
  display: flex; flex-direction: column;
  transition: width .2s ease;
}
.admin-side .side-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  font-weight: 700; font-size: 15px; color: var(--c-text);
  letter-spacing: -.01em;
  flex-shrink: 0;
}
.admin-side .side-nav {
  flex: 1; overflow-y: auto;
  padding: 12px 0;
}
.admin-side .side-user {
  flex-shrink: 0;
  border-top: 1px solid var(--c-border);
  padding: 12px 16px;
  background: var(--c-surface-2);
}
.admin-side .side-user .ui-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.admin-side .side-user .ui-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.admin-side .side-user .ui-meta {
  flex: 1; min-width: 0; line-height: 1.3;
}
.admin-side .side-user .ui-email {
  font-size: 13px; color: var(--c-text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-side .side-user .ui-sub {
  font-size: 11.5px; color: var(--c-text-3); margin-top: 2px;
}
.admin-side .side-user .ui-actions {
  display: flex; gap: 6px;
}
.admin-side .side-user .ui-actions button,
.admin-side .side-user .ui-actions a {
  flex: 1; padding: 6px 8px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: 12px; color: var(--c-text-2);
  cursor: pointer; text-align: center;
  font-family: inherit; text-decoration: none;
  transition: all .12s;
}
.admin-side .side-user .ui-actions button:hover,
.admin-side .side-user .ui-actions a:hover {
  background: var(--c-surface-2); color: var(--c-text); text-decoration: none;
}

.admin-side.collapsed .side-brand .brand-text { display: none; }
.admin-side.collapsed .side-user .ui-email,
.admin-side.collapsed .side-user .ui-sub,
.admin-side.collapsed .side-user .ui-actions { display: none; }
.admin-side.collapsed .side-user { padding: 12px 8px; }
.admin-side.collapsed .side-user .ui-row { justify-content: center; margin-bottom: 0; }
.admin-side.collapsed { width: var(--side-collapsed-w); }
.admin-side.collapsed .side-title,
.admin-side.collapsed .side-item .label { display: none; }
.admin-side.collapsed .side-item {
  padding: 11px 0; justify-content: center;
}
.admin-side.collapsed .side-item .icon { margin: 0; font-size: 18px; }

.side-title {
  padding: 6px 24px 12px;
  font-size: 11px; color: var(--c-text-3); letter-spacing: .08em;
  text-transform: uppercase; font-weight: 600;
}
.side-item {
  display: flex; align-items: center;
  width: 100%; padding: 9px 24px;
  border: 0; background: none;
  text-align: left; font-size: 13.5px; color: var(--c-text-2);
  cursor: pointer;
  border-left: 3px solid transparent;
  font-family: inherit; font-weight: 500;
  transition: background .12s, color .12s;
}
.side-item:hover { background: var(--c-surface-2); color: var(--c-text); }
.side-item.active {
  color: var(--c-primary); background: var(--c-primary-light);
  border-left-color: var(--c-primary); font-weight: 600;
}
.side-item .icon {
  display: inline-block; width: 20px; margin-right: 10px;
  text-align: center; font-size: 15px; opacity: .85;
}
.admin-side.collapsed .side-item.active { border-left-width: 0; }

.side-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  margin: 0 16px 16px auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-text-2);
  cursor: pointer; font-size: 14px; line-height: 1;
  transition: all .12s;
}
.side-collapse-btn:hover { background: var(--c-surface-2); color: var(--c-text); }
.admin-side.collapsed .side-collapse-btn { margin: 0 auto 16px; }

.admin-main {
  flex: 1; min-width: 0;
  padding: 28px 32px;
}
.admin-main h1 { margin-bottom: 6px; }
.admin-main h1 + .desc { margin-bottom: 24px; }
.admin-main h2:first-child { margin-top: 0; }

.admin-header {
  display: flex; align-items: center; gap: 12px;
  margin: -28px -32px 24px;
  padding: 14px 32px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}
.admin-toggle {
  display: none;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: 6px 12px;
  cursor: pointer; align-items: center; gap: 6px;
  color: var(--c-text-2); font-size: 13px; font-family: inherit;
}
.admin-toggle::before { content: '☰'; font-size: 16px; line-height: 1; }

/* 顶部右上角的用户卡片 */
.user-widget {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font-size: 13px;
}
.user-widget .uw-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
  overflow: hidden;
}
.user-widget .uw-meta {
  display: flex; align-items: center; gap: 6px;
  line-height: 1.2;
}
.user-widget .uw-email {
  color: var(--c-text); font-weight: 500;
  max-width: 180px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-widget .uw-divider {
  width: 1px; height: 20px; background: var(--c-border); margin: 0 4px;
}
.user-widget button, .user-widget a {
  background: transparent; border: 0;
  font-size: 12.5px; padding: 4px 10px; border-radius: var(--r-sm);
  color: var(--c-text-2); cursor: pointer;
  font-family: inherit; text-decoration: none;
  transition: background .12s;
}
.user-widget button:hover, .user-widget a:hover {
  background: var(--c-surface-2); color: var(--c-text);
}
.user-widget button.danger:hover { background: var(--c-danger-light); color: var(--c-danger); }
@media (max-width: 720px) {
  .admin-header { margin: -18px -16px 18px; padding: 10px 16px; }
  .user-widget .uw-email { max-width: 110px; }
  .user-widget .uw-meta .tag { display: none; }
}
.admin-mask {
  display: none; position: fixed; inset: var(--topbar-h) 0 0 0;
  background: rgba(15,23,42,.4); z-index: 49;
}

@media (max-width: 720px) {
  .admin-side {
    position: fixed; top: 56px; bottom: 0; left: 0;
    z-index: 50; height: auto;
    transform: translateX(-100%);
    transition: transform .2s ease-out;
    box-shadow: 4px 0 24px rgba(15,23,42,.15);
  }
  .admin-side.open { transform: translateX(0); }
  .admin-mask.show { display: block; }
  .admin-main { padding: 18px 16px; }
  .admin-toggle { display: inline-flex; }
}

/* ===========================================================================
   Stat Cards (我的页 / 仪表用)
   ========================================================================== */
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin: 16px 0 24px;
}
.stat {
  padding: 16px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  transition: box-shadow .15s;
}
.stat:hover { box-shadow: var(--shadow-md); }
.stat .label { color: var(--c-text-3); font-size: 12px; margin-bottom: 6px; }
.stat .value { font-size: 20px; font-weight: 600; color: var(--c-text); letter-spacing: -.01em; }
.stat .sub   { color: var(--c-text-3); font-size: 12px; margin-top: 4px; }

/* ===========================================================================
   Section (子区分组)
   ========================================================================== */
.section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 18px;
  margin: 16px 0;
}
.section h3 { margin-top: 0; }

/* ===========================================================================
   下载/认证类页面
   ========================================================================== */
/* body.auth-page 让认证类页面垂直居中 */
body.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.auth-wrap {
  max-width: 400px; width: 100%;
  margin: 0;
  padding: 36px 32px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.auth-wrap h1 { text-align: center; margin-bottom: 6px; }
.auth-wrap .desc { text-align: center; margin-bottom: 24px; }
@media (max-width: 540px) {
  .auth-wrap { padding: 24px 20px; }
}

/* ===========================================================================
   Spinner
   ========================================================================== */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
.spinner-lg {
  width: 24px; height: 24px; border-width: 3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================================================================
   Switch (开关)
   ========================================================================== */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; vertical-align: middle; }
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--c-border-2); border-radius: 999px; transition: .2s;
}
.switch .slider::before {
  content: ''; position: absolute; height: 16px; width: 16px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%;
  transition: .2s; box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.switch input:checked + .slider { background: var(--c-primary); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* ===========================================================================
   Settings 卡片
   ========================================================================== */
.settings-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  margin: 16px 0;
}
.settings-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.settings-card header {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.settings-card header h3 { margin: 0 0 2px; font-size: 14px; }
.settings-card header p { margin: 0; font-size: 12px; }
.settings-card .card-icon {
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--c-primary-light); color: var(--c-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.settings-card .card-body { padding: 14px 18px 18px; }
.settings-card label:first-child { margin-top: 0; }

.save-bar {
  position: sticky; bottom: 0;
  margin: 24px -32px -28px;
  padding: 14px 32px;
  background: rgba(248,250,252,.85);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--c-border);
  display: flex; gap: 12px; align-items: center;
}
:root[data-theme="dark"] .save-bar { background: rgba(15,23,42,.85); }

/* ===========================================================================
   全站页脚
   ========================================================================== */
.site-foot {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 48px 24px 20px;
  color: var(--c-text-2);
}
.site-foot .foot-grid {
  max-width: 1100px; margin: 0 auto;
  display: grid; gap: 32px;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
}
.site-foot .foot-brand { font-size: 17px; font-weight: 700; color: var(--c-text); margin-bottom: 8px; }
.site-foot .foot-tagline { font-size: 12.5px; color: var(--c-text-3); margin: 0; }
.site-foot h4 { font-size: 13px; color: var(--c-text); margin: 0 0 12px; font-weight: 600; }
.site-foot a {
  display: block; color: var(--c-text-2); font-size: 12.5px;
  padding: 4px 0; transition: color .12s;
}
.site-foot a:hover { color: var(--c-primary); text-decoration: none; }
.site-foot .foot-bottom {
  max-width: 1100px; margin: 32px auto 0;
  padding-top: 16px; border-top: 1px solid var(--c-border);
  font-size: 12px; color: var(--c-text-3); text-align: center;
}
@media (max-width: 720px) {
  .site-foot .foot-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* ===========================================================================
   浮动客服
   ========================================================================== */
#support-widget {
  position: fixed; bottom: 20px; right: 20px; z-index: 90;
}
.sw-bubble {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  border: 0; cursor: pointer; font-size: 22px;
  box-shadow: 0 6px 20px rgba(99,102,241,.4);
  transition: transform .15s;
}
.sw-bubble:hover { transform: scale(1.08); }
.sw-panel {
  position: absolute; bottom: 64px; right: 0;
  width: 300px; max-width: 90vw;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 16px;
}
.sw-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 12px;
}
.sw-head strong { font-size: 14px; }
.sw-head .sw-hours { color: var(--c-text-3); font-size: 11.5px; margin-top: 2px; }
.sw-head button { background: none; border: 0; color: var(--c-text-3); cursor: pointer; font-size: 16px; padding: 0; }
.sw-msg { font-size: 12.5px; color: var(--c-text-2); margin: 0 0 12px; padding: 10px; background: var(--c-surface-2); border-radius: var(--r-sm); }
.sw-list a {
  display: block; padding: 9px 12px; margin-bottom: 6px;
  background: var(--c-surface-2); border-radius: var(--r-sm);
  color: var(--c-text); font-size: 13px;
  cursor: pointer; text-decoration: none;
}
.sw-list a:hover { background: var(--c-primary-light); color: var(--c-primary); text-decoration: none; }
.sw-list a strong { color: inherit; }
.sw-list .sw-qr {
  padding: 10px; text-align: center; background: var(--c-surface-2); border-radius: var(--r-sm); margin-bottom: 6px;
}
.sw-list .sw-qr img { width: 140px; height: 140px; object-fit: contain; border-radius: var(--r-sm); }

/* ===========================================================================
   兼容老的 .tabs(已不在用)
   ========================================================================== */
.tabs { display: none; }
