/* ============ 设计 Token — 浅色（Eyun Console 风） ============ */
:root {
  color-scheme: light;
  /* 间距 8px 栅格 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  /* 圆角 */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  /* 字号 */
  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 20px;
  /* 控件高度 */
  --h-input: 38px; --h-input-sm: 32px;
  /* 强调色 */
  --brand-0: #3B82F6;
  --brand-1: #2563EB;
  --brand-2: #1D4ED8;
  --ok: #16A34A; --err: #DC2626; --warn: #F59E0B;
  /* 缓动 */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* 浅色主题变量 */
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --surface-3: #F3F4F6;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --text-0: #1F2937;
  --text-1: #374151;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --nav-active-bg: #EFF4FF;
  --nav-active-text: #2563EB;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .12);
  --code-bg: #F8FAFC;
  --code-text: #334155;
}

/* ============ 暗色主题 ============ */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0F1A;
  --surface: #151B2B;
  --surface-2: #1C2435;
  --surface-3: #232C40;
  --border: #2A3447;
  --border-strong: #3A465E;
  --text-0: #E5E9F0;
  --text-1: #C7CEDA;
  --text-2: #8B95A8;
  --text-3: #5E6878;
  --nav-active-bg: rgba(59, 130, 246, .14);
  --nav-active-text: #6BA8FF;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  --code-bg: #0D1422;
  --code-text: #A8B3C7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-0);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 240ms var(--ease-out), color 240ms var(--ease-out);
}
button { font-family: inherit; cursor: pointer; }
a { text-decoration: none; color: inherit; }

/* ============ 顶栏 ============ */
.topbar {
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--s5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: var(--s3); }
.topbar .brand-logo {
  flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
}
.topbar-title { font-weight: 600; font-size: var(--fs-md); color: var(--text-0); }
.topbar-divider { color: var(--text-3); }
.topbar-sub { color: var(--text-2); font-size: var(--fs-sm); }
.topbar-right { display: flex; align-items: center; gap: var(--s2); }
.topbar-search {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px; padding: 0 var(--s3);
  height: 34px; width: 200px;
  transition: box-shadow 160ms var(--ease-out), background 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.topbar-search:hover { border-color: var(--border-strong); }
.topbar-search:focus-within { background: var(--surface); border-color: var(--brand-0); box-shadow: 0 0 0 3px rgba(59, 130, 246, .12); }
.topbar-search svg { flex-shrink: 0; color: var(--text-3); }
.topbar-search input[type="text"] {
  width: auto; height: auto; min-width: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  outline: none; flex: 1; font-size: var(--fs-sm); color: var(--text-0);
}
.topbar-search input::placeholder { color: var(--text-3); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: transparent;
  color: var(--text-2); display: flex; align-items: center; justify-content: center;
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out);
}
.icon-btn:hover { color: var(--text-0); background: var(--surface-3); }
.topbar-sep { width: 1px; height: 20px; flex: 0 0 auto; background: var(--border); }
.topbar-tabs { display: flex; align-items: center; gap: 2px; }
.topbar-tab {
  display: inline-flex; align-items: center;
  min-height: 30px; padding: 0 11px; border-radius: 7px;
  color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  transition: color 140ms var(--ease-out), background 140ms var(--ease-out);
}
.topbar-tab:hover { color: var(--text-0); background: var(--surface-3); }
.topbar-tab.active { color: var(--brand-1); background: var(--nav-active-bg); font-weight: 650; }
.topbar-docs {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 30px; padding: 0 10px; border-radius: 7px;
  color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  transition: color 140ms var(--ease-out), background 140ms var(--ease-out);
}
.topbar-docs svg { opacity: .65; }
.topbar-docs:hover { color: var(--brand-1); background: var(--nav-active-bg); }

/* 用户菜单 */
.user-menu { position: relative; }
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 9px 0 4px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text-1); font-size: var(--fs-sm);
  transition: border-color 140ms var(--ease-out), background 140ms var(--ease-out);
}
.user-chip:hover { border-color: var(--border-strong); background: var(--surface-3); }
.user-avatar {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand-0), var(--brand-2));
}
.user-name { max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-caret { color: var(--text-3); transition: transform 160ms var(--ease-out); }
.user-chip[aria-expanded="true"] .user-caret { transform: rotate(180deg); }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 300;
  display: flex; flex-direction: column; gap: 1px;
  min-width: 176px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.user-dropdown a, .user-dropdown button {
  display: flex; align-items: center; width: 100%; min-height: 32px; padding: 0 10px;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--text-1); font-size: var(--fs-sm); text-align: left;
  transition: background 120ms var(--ease-out), color 120ms var(--ease-out);
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--surface-3); color: var(--text-0); }
.user-dropdown button:hover { color: var(--err); background: rgba(220, 38, 38, .08); }
.user-dropdown-sep { height: 1px; margin: 5px 6px; background: var(--border); }
.who { font-size: var(--fs-sm); color: var(--text-2); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 主题切换图标显示 */
.ico-moon { display: none; }
[data-theme="dark"] .ico-sun { display: none; }
[data-theme="dark"] .ico-moon { display: block; }

/* ============ 三栏布局 ============ */
.app-body {
  display: grid;
  grid-template-columns: 216px 260px minmax(0, 1fr);
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  min-height: 0;
}

/* ============ 左侧导航 ============ */
.sidenav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding: var(--s4) var(--s3);
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3); border-radius: var(--r-sm);
  font-size: var(--fs-base); color: var(--text-2);
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out);
}
.nav-item svg { flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: var(--surface-3); color: var(--text-0); }
.nav-item.active {
  background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-section-title {
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-3);
  margin: var(--s5) var(--s2) var(--s2);
}
.account-mini-list { display: flex; flex-direction: column; gap: 6px; padding: 0 var(--s1); }
.account-mini {
  display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 6px 10px; min-height: 58px;
  padding: var(--s2) var(--s3); border: 1px solid transparent; border-radius: var(--r-md);
  min-width: 0; background: transparent; font-size: var(--fs-sm); color: var(--text-1);
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.account-mini { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.account-mini:hover { background: var(--surface-3); transform: translateX(2px); }
.account-mini.selected { background: var(--nav-active-bg); color: var(--nav-active-text); border-color: rgba(59, 130, 246, .16); }
.account-avatar-wrap { position: relative; flex: 0 0 38px; width: 38px; height: 38px; }
.account-avatar {
  position: relative;
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-radius: 50%; background: linear-gradient(135deg, var(--brand-0), var(--brand-2));
  color: #fff; font-size: var(--fs-md); font-weight: 700;
}
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-online-dot {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px;
  border: 2px solid var(--surface); border-radius: 50%; background: var(--text-3);
}
.account-online-dot.on { background: var(--ok); box-shadow: 0 0 0 2px rgba(22, 163, 74, .14); }
.account-mini-body { min-width: 0; flex: 1; }
.account-mini-line { display: flex; align-items: center; min-width: 0; gap: 4px; }
.account-mini-name, .account-mini-id { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-mini-name, .account-mini-id { min-width: 0; flex: 1; }
.account-mini-name { color: var(--text-0); font-size: var(--fs-sm); font-weight: 650; }
.account-mini-id { margin-top: 2px; color: var(--text-2); font-family: ui-monospace, monospace; font-size: var(--fs-xs); }
.account-actions { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 3px; }
.account-operation { display: inline-flex; align-items: center; justify-content: center; }
.account-operation:empty { display: none; }
.account-mini:not(:has(.account-login-btn)) { grid-template-columns: 38px minmax(0, 1fr) 20px; }
.account-mini:not(:has(.account-login-btn)) .account-actions { grid-column: 3; grid-row: 1; justify-content: flex-end; }
.account-login-btn {
  min-width: 82px; min-height: 28px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--surface); color: var(--brand-1); font-size: 12px; font-weight: 650; white-space: nowrap; cursor: pointer;
  transition: background 140ms var(--ease-out), border-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.account-login-btn:hover:not(:disabled) { border-color: var(--brand-0); background: var(--nav-active-bg); }
.account-login-btn.is-current { border-color: var(--brand-0); background: var(--nav-active-bg); }
.account-login-btn:disabled { color: var(--text-3); background: var(--surface-2); cursor: not-allowed; }
.account-copy-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 20px;
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-3); opacity: 0; cursor: pointer;
  transition: opacity 140ms var(--ease-out), color 140ms var(--ease-out), background 140ms var(--ease-out);
}
.account-mini:hover .account-copy-btn, .account-copy-btn:focus-visible { opacity: 1; }
.account-copy-btn:hover { background: var(--surface); color: var(--brand-1); }
.empty-sm {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: var(--s1) 0; padding: var(--s5) var(--s3);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  font-size: var(--fs-sm); color: var(--text-3); text-align: center; line-height: 1.6;
}
.account-summary {
  margin-top: auto; padding: var(--s4);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.account-summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.account-summary-title { font-size: var(--fs-sm); font-weight: 650; color: var(--text-0); }
.account-summary-meta { margin-top: 3px; font-size: var(--fs-xs); color: var(--text-2); }
.account-summary-meta #accountOnlineCount { color: var(--ok); font-weight: 650; }
.account-summary-pulse {
  width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--text-3);
}
.account-summary-pulse.is-active {
  background: var(--ok); box-shadow: 0 0 0 4px rgba(22, 163, 74, .12);
}
.account-add-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  width: 100%; height: 32px; margin-top: var(--s3);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-1); font-size: var(--fs-sm); font-weight: 550;
  transition: transform 120ms var(--ease-out), border-color 160ms var(--ease-out), background 160ms var(--ease-out), color 160ms var(--ease-out);
}
.account-add-btn:hover { border-color: var(--brand-0); background: var(--nav-active-bg); color: var(--brand-1); }
.account-add-btn:active { transform: scale(.98); }
.account-add-icon { font-size: 18px; font-weight: 400; line-height: 1; margin-top: -1px; }

/* ============ 中间 API 列表 ============ */
.api-list {
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  overflow-y: auto;
  padding: 0 var(--s4) var(--s5);
}
.api-list-head {
  position: sticky; top: 0; z-index: 10;
  margin: 0 calc(-1 * var(--s4)) var(--s5);
  padding: var(--s5) var(--s4) var(--s3); background: var(--surface-2);
  border-bottom: 1px solid var(--border); box-shadow: 0 4px 10px rgba(16, 24, 40, .04);
}
.api-list-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.api-list-head h1 { font-size: 18px; font-weight: 700; color: var(--text-0); }
.api-list-head p { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.api-cat-tools { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--shadow-sm); }
.api-cat-tools button { height: 26px; padding: 0 var(--s2); border: 0; border-radius: 5px; background: transparent; color: var(--text-2); font-size: var(--fs-xs); white-space: nowrap; transition: background 140ms var(--ease-out), color 140ms var(--ease-out); }
.api-cat-tools button:hover { background: var(--nav-active-bg); color: var(--brand-1); }
.api-categories { display: flex; flex-direction: column; gap: var(--s2); }

/* ============ 新手聚光灯引导 ============ */
.tour { position: fixed; inset: 0; z-index: 9000; pointer-events: none; }
.tour-hole {
  position: absolute; border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(16, 24, 40, .62), 0 0 0 2px var(--brand-0) inset;
  transition: left 220ms var(--ease-out), top 220ms var(--ease-out),
              width 220ms var(--ease-out), height 220ms var(--ease-out);
}
.tour-tip {
  position: absolute; width: min(320px, calc(100vw - 24px));
  padding: var(--s4); pointer-events: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  animation: tourTipIn 200ms var(--ease-out);
}
@keyframes tourTipIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tour-tip-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.tour-step { color: var(--brand-1); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .02em; }
.tour-close {
  padding: 2px 6px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-3); font-size: var(--fs-xs);
  transition: color 140ms var(--ease-out), background 140ms var(--ease-out);
}
.tour-close:hover { color: var(--text-1); background: var(--surface-3); }
.tour-title { display: block; margin-top: var(--s2); font-size: var(--fs-md); font-weight: 650; color: var(--text-0); }
.tour-text { margin-top: 5px; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.6; }
.tour-text.err { color: var(--err); }
.tour-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); margin-top: var(--s4); }
.tour-actions .btn-ghost.sm.hidden { display: none; }
/* 手机端「添加微信」悬浮入口 */
.add-wx-fab {
  display: none; position: fixed; right: 16px; bottom: 16px; z-index: 8000;
  align-items: center; gap: 6px; height: 44px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-0), var(--brand-1)); color: #fff;
  font-size: var(--fs-base); font-weight: 600; box-shadow: 0 6px 18px rgba(37, 99, 235, .35);
}
.add-wx-fab span[aria-hidden] { font-size: 20px; line-height: 1; font-weight: 400; }
.account-add-btn.pulse, .add-wx-fab.pulse { animation: addPulse 1.8s var(--ease-out) infinite; border-color: var(--brand-0); }
@keyframes addPulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .35); }
  70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.api-cat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.api-cat-head {
  display: flex; align-items: center; gap: var(--s2);
  width: 100%; padding: var(--s3) var(--s4);
  background: none; border: none; font-size: 14px; font-weight: 600;
  color: var(--text-0); text-align: left;
}
.caret-mark {
  width: 8px; height: 8px; margin: -3px 2px 0 1px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); flex-shrink: 0; color: var(--text-2);
  transition: transform 180ms var(--ease-out);
}
.api-cat.collapsed .caret-mark { transform: rotate(-45deg); }
.api-cat-head .caret { transition: transform 200ms var(--ease-out); color: var(--text-3); }
.api-cat.collapsed .caret { transform: rotate(-90deg); }
.api-cat-body { display: flex; flex-direction: column; padding: 0 var(--s2) var(--s2); }
.api-cat.collapsed .api-cat-body { display: none; }
.api-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: var(--s2) var(--s3); border: none; background: none;
  border-radius: var(--r-sm); text-align: left; width: 100%;
  transition: background 140ms var(--ease-out);
}
.api-item:hover { background: var(--surface-3); }
.api-item.active { background: var(--nav-active-bg); }
.api-item.active .api-name { color: var(--nav-active-text); }
.api-item-row { display: flex; align-items: flex-start; gap: var(--s2); width: 100%; }
.api-name { min-width: 0; font-size: 12px; line-height: 1.45; color: var(--text-0); font-weight: 500; flex: 1; }
.method {
  font-size: 10px; font-weight: 700; font-family: ui-monospace, monospace;
  padding: 1px 5px; border-radius: 3px; flex-shrink: 0; text-align: center;
}
.method.post { background: rgba(37, 99, 235, .12); color: var(--brand-1); }
.method.get { background: rgba(22, 163, 74, .12); color: var(--ok); }
.api-path { font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-3); }

/* ============ 右侧请求面板 ============ */
.panel-col {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0; overflow: hidden; background: var(--bg);
}
.req-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.req-title { display: flex; align-items: center; gap: var(--s3); }
.req-title .method { font-size: var(--fs-xs); }
.req-name { font-weight: 600; font-size: var(--fs-md); color: var(--text-0); }
.req-path { font-family: ui-monospace, monospace; font-size: var(--fs-xs); color: var(--text-2); }
.req-key { font-family: ui-monospace, monospace; font-size: var(--fs-xs); color: var(--brand-1); margin-top: 2px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-actions { display: flex; align-items: center; gap: var(--s2); }
.req-body {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s4);
  padding: var(--s4) var(--s5);
  min-height: 160px;
}
.request-editor-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 320px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.editor-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.editor-toolbar strong { display: block; color: var(--text-1); font-size: var(--fs-sm); font-weight: 650; }
.editor-toolbar span { display: block; margin-top: 3px; font-size: var(--fs-xs); }
.editor-validity { flex: 0 0 auto; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-3) !important; }
.editor-validity.valid { background: rgba(22, 163, 74, .10); color: var(--ok) !important; }
.editor-validity.invalid { background: rgba(220, 38, 38, .10); color: var(--err) !important; }
.parameter-pane { min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.parameter-pane-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.parameter-pane-head strong { display: block; font-size: var(--fs-sm); color: var(--text-1); }
.parameter-pane-head span:not(.parameter-count) { display: block; margin-top: 2px; color: var(--text-3); font-size: var(--fs-xs); }
.parameter-count { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--nav-active-bg); color: var(--brand-1); font-size: var(--fs-xs); font-weight: 650; }
.parameter-list { height: calc(100% - 58px); min-height: 0; overflow-y: auto; }
.parameter-item { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.parameter-item:last-child { border-bottom: 0; }
.parameter-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.parameter-item-head code { color: var(--text-0); font: 600 var(--fs-sm)/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.parameter-type { color: var(--brand-1); font: var(--fs-xs)/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.parameter-required { color: var(--err); font-size: 10px; font-weight: 650; }
.parameter-meta { margin-top: 5px; color: var(--text-2); font-size: var(--fs-xs); line-height: 1.5; overflow-wrap: anywhere; }
.parameter-empty { padding: var(--s5) var(--s4); color: var(--text-3); font-size: var(--fs-xs); line-height: 1.6; }
/* JSON 编辑器 */
.json-editor {
  flex: 1; width: 100%; min-height: 260px; padding: var(--s4);
  border: 0; border-radius: 0;
  background: var(--code-bg); color: var(--code-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-sm); line-height: 1.6;
  resize: none; outline: none;
}
.json-editor:focus { box-shadow: inset 0 0 0 2px var(--brand-0); }

/* ============ 响应工作区 ============ */
.output-stack {
  flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  animation: outputIn 220ms var(--ease-out);
}
.resp-resize-handle {
  height: 6px; flex: 0 0 6px; cursor: row-resize; background: transparent;
  position: relative; touch-action: none; transition: background 140ms var(--ease-out);
}
.resp-resize-handle:hover { background: var(--brand-0); }
.resp-resize-handle::after {
  content: ''; position: absolute; left: 50%; top: 2px; width: 32px; height: 2px;
  border-radius: 2px; background: var(--border-strong); transform: translateX(-50%);
  transition: width 160ms var(--ease-out), background 160ms var(--ease-out);
}
.section-caret {
  width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform 220ms var(--ease-out);
}

/* ============ 响应区 ============ */
.req-resp {
  background: var(--surface); height: var(--response-height, 260px); display: flex; flex-direction: column;
  flex: 0 0 auto; min-height: 54px; overflow: hidden; border-top: 1px solid var(--border);
  transition: height 220ms var(--ease-out);
}
.req-resp.collapsed { height: 54px; }
.req-resp.collapsed .resp-body { opacity: 0; transform: translateY(-5px); pointer-events: none; }
.resp-head {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: 48px; flex: 0 0 48px; padding: 0 var(--s5); border: 0; border-bottom: 1px solid var(--border);
  background: var(--surface); color: var(--text-1); cursor: pointer; text-align: left;
}
.resp-head:hover { background: var(--surface-3); }
.resp-heading { display: inline-flex; align-items: center; gap: var(--s2); min-width: 0; }
.resp-caret { margin-right: var(--s2); transform: rotate(45deg); }
.req-resp.collapsed .resp-caret { transform: rotate(-45deg); }
.resp-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-1); }
.resp-status { font-size: var(--fs-xs); font-family: ui-monospace, monospace; color: var(--text-2); }
.resp-status.ok { color: var(--ok); }
.resp-status.err { color: var(--err); }
.resp-body {
  flex: 1; min-height: 0; overflow: auto; margin: 0; padding: var(--s4) var(--s5);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-sm); line-height: 1.6;
  color: var(--code-text); background: var(--code-bg);
  white-space: pre-wrap; word-break: break-all; opacity: 1; transform: translateY(0);
  transition: opacity 150ms var(--ease-out), transform 220ms var(--ease-out);
}
.resp-placeholder { color: var(--text-3); }

@keyframes outputIn { from { opacity: .82; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============ 表单控件 ============ */
input[type="text"], textarea {
  width: 100%; padding: 0 var(--s4);
  height: var(--h-input);
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-0);
  font-size: var(--fs-base); font-family: inherit;
  outline: none;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background 160ms var(--ease-out);
}
textarea { height: auto; padding: var(--s3) var(--s4); min-height: 84px; line-height: 1.55; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, textarea:focus {
  border-color: var(--brand-0);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

/* ============ 按钮 ============ */
.btn-primary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: var(--h-input); padding: 0 var(--s5);
  border-radius: var(--r-sm); font-size: var(--fs-base); font-weight: 500;
  border: 1px solid transparent;
  transition: transform 120ms var(--ease-out), background 160ms var(--ease-out), box-shadow 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand-0), var(--brand-1));
  color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .3);
}
.btn-primary:hover { background: linear-gradient(135deg, #4F8FF7, var(--brand-2)); }
.btn-primary:active { transform: scale(.97); }
.btn-ghost {
  background: var(--surface); border-color: var(--border); color: var(--text-1);
}
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-3); }
.btn-ghost:active { transform: scale(.97); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-danger:active { transform: scale(.97); }
.btn-primary.full { width: 100%; }
.btn-primary.sm, .btn-ghost.sm, .btn-danger.sm { height: var(--h-input-sm); padding: 0 var(--s3); font-size: var(--fs-sm); }

/* ============ 自定义下拉组件 ============ */
.custom-select { position: relative; width: 100%; }
.select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: var(--h-input);
  padding: 0 var(--s4); border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-0); font-size: var(--fs-base); font-family: inherit;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.select-trigger:hover { border-color: var(--border-strong); }
.custom-select.open .select-trigger { border-color: var(--brand-0); box-shadow: 0 0 0 3px rgba(59, 130, 246, .12); }
.select-label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.select-trigger svg { flex-shrink: 0; margin-left: var(--s2); color: var(--text-3); transition: transform 200ms var(--ease-out); }
.custom-select.open .select-trigger svg { transform: rotate(180deg); }
.select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  z-index: 500;
  padding: var(--s1) 0;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden;
  transform: translateY(-6px) scale(.98);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 0s linear 180ms;
  max-height: 240px; overflow-y: auto;
}
.custom-select.open .select-dropdown {
  opacity: 1; visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out), visibility 0s;
}
.select-option {
  display: flex; align-items: center; width: 100%;
  padding: 8px var(--s4); border: none; background: none;
  color: var(--text-1); font-size: var(--fs-base); font-family: inherit;
  cursor: pointer; text-align: left;
  transition: background 120ms var(--ease-out), color 120ms var(--ease-out);
}
.select-option:hover { background: var(--nav-active-bg); color: var(--nav-active-text); }
.select-empty { padding: 8px var(--s4); color: var(--text-3); font-size: var(--fs-sm); }

/* ============ 状态点 ============ */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.dot.off { background: var(--text-3); }

/* ============ 弹层 ============ */
.modal {
  position: fixed; inset: 0;
  background: rgba(12, 16, 26, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 100px; z-index: 9999;
  opacity: 1; transition: opacity 220ms var(--ease-out);
}
.modal.hidden { display: none !important; }
.modal-card {
  width: 380px; max-height: calc(100vh - 120px); overflow-y: auto;
  padding: var(--s6); position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  transform: scale(.96) translateY(-10px); opacity: 0;
  transition: transform 260ms var(--ease-out), opacity 260ms var(--ease-out);
}
.qr-modal-card { width: 420px; max-width: calc(100vw - 24px); padding: 28px; box-sizing: border-box; }
.account-picker-card { width: 420px; max-width: calc(100vw - 24px); padding: 24px; box-sizing: border-box; }
.mobile-account-list { display: flex; flex-direction: column; gap: 8px; }
.mobile-account-empty { padding: 20px 12px; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-sm); text-align: center; }
.mobile-account-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2);
}
.mobile-account-info { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.mobile-account-info strong, .mobile-account-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-account-info strong { color: var(--text-0); font-size: var(--fs-sm); font-weight: 650; }
.mobile-account-info span { color: var(--text-2); font-family: ui-monospace, monospace; font-size: var(--fs-xs); }
.mobile-account-state { color: var(--text-2); font-size: var(--fs-xs); }
.mobile-account-state.is-online { color: var(--ok); font-weight: 650; }
.mobile-account-operation { grid-column: 2; grid-row: 2; }
.mobile-account-row .account-login-btn { min-width: 90px; min-height: 32px; font-size: var(--fs-xs); }
.modal-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.modal-eyebrow { color: var(--brand-1); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.modal-title-row .modal-title { margin: 4px 0 0; font-size: 22px; }
.modal-subtitle { margin-top: 5px; color: var(--text-2); font-size: var(--fs-sm); }
.modal:not(.hidden) .modal-card { transform: scale(1) translateY(0); opacity: 1; }
.modal-close {
  position: absolute; top: var(--s4); right: var(--s4);
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: none; background: var(--surface-3); color: var(--text-2);
  font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--border); color: var(--text-0); }
.modal-title { font-size: var(--fs-lg); font-weight: 700; color: var(--text-0); margin-bottom: var(--s5); }
.qr-modal-card .field { margin-top: var(--s3); }
.qr-modal-card .field label { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--text-1); font-size: var(--fs-sm); font-weight: 600; }
.qr-modal-card .field label span { color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; }
.qr-modal-card input[type="text"] { height: 40px; }
.qr-modal-card .field label span.required { color: var(--warn); font-weight: 600; }
.field-hint { margin-top: 5px; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.5; }
.field-hint.err { color: var(--err); }
.qr-modal-card input[aria-invalid="true"] { border-color: var(--err); }
.proxy-helper { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s3); padding: var(--s3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.proxy-helper-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.proxy-helper-copy strong { color: var(--text-1); font-size: var(--fs-xs); font-weight: 650; }
.proxy-helper-copy span { color: var(--text-3); font-size: 10px; line-height: 1.4; }
.proxy-downloads { display: flex; flex: 0 0 auto; gap: 6px; }
.proxy-downloads a { display: inline-flex; align-items: center; min-height: 28px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--brand-1); font-size: 11px; white-space: nowrap; }
.proxy-downloads a:hover { border-color: var(--brand-0); background: var(--nav-active-bg); }
.modal-actions { margin-top: var(--s5); display: flex; align-items: center; gap: var(--s2); }
.modal-actions .btn-ghost { flex: 0 0 auto; white-space: nowrap; }
.modal-actions .btn-primary.full { width: auto; flex: 1 1 auto; min-width: 0; }
.qr-box {
  margin-top: var(--s5); min-height: 156px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3);
  padding: var(--s3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
}
.qr-box img { width: 140px; height: 140px; border-radius: var(--r-sm); background: #fff; }
.qr-status { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); text-align: center; }
.qr-status-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--nav-active-bg); color: var(--brand-1); font-size: 22px; line-height: 1; }
.qr-status-icon.is-loading { border: 3px solid var(--border-strong); border-top-color: var(--brand-1); background: transparent; font-size: 0; animation: qrSpin 900ms linear infinite; }
.qr-status-icon.is-error { background: rgba(220, 38, 38, .1); color: var(--err); font-size: 16px; font-weight: 700; }
.qr-status-icon.is-done { background: rgba(22, 163, 74, .12); color: var(--ok); font-size: 18px; font-weight: 700; }
@keyframes qrSpin { to { transform: rotate(360deg); } }
.qr-progress { display: flex; align-items: center; gap: 8px; margin-top: var(--s5); }
.qr-progress-step { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.qr-progress-step span { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--text-2); font-size: 11px; font-weight: 700; }
.qr-progress-step strong { font-weight: 600; }
.qr-progress-step.current { color: var(--brand-1); }
.qr-progress-step.current span { border-color: var(--brand-0); background: var(--nav-active-bg); color: var(--brand-1); }
.qr-progress-step.done { color: var(--ok); }
.qr-progress-step.done span { border-color: var(--ok); background: rgba(22, 163, 74, .10); color: var(--ok); }
.qr-progress-line { height: 1px; flex: 1; min-width: 20px; background: var(--border-strong); }
.qr-guide { margin-top: var(--s4); padding: var(--s3) var(--s4); border-left: 3px solid var(--brand-0); background: var(--nav-active-bg); border-radius: var(--r-sm); }
.qr-guide strong { display: block; color: var(--text-0); font-size: var(--fs-sm); line-height: 1.45; }
.qr-guide p { margin-top: 4px; color: var(--text-1); font-size: var(--fs-xs); line-height: 1.6; }
.qr-modal-card .modal-actions { margin-top: var(--s4); }

/* ============ Toast ============ */
.toast-host {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 10000; display: flex; flex-direction: column; gap: var(--s2); align-items: center;
}
.toast {
  padding: var(--s3) var(--s5); border-radius: var(--r-sm);
  background: var(--text-0); color: var(--surface);
  font-size: var(--fs-sm); box-shadow: var(--shadow-md);
  animation: toastIn 260ms var(--ease-out);
}
.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--err); color: #fff; }
.toast.out { animation: toastOut 200ms var(--ease-in-out) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-8px); } }

/* ============ 响应动画 ============ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.req-form:not([hidden]) { animation: fadeIn 240ms var(--ease-out); }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
  .app-body { grid-template-columns: 240px minmax(0, 1fr); }
  .sidenav { display: none; }
  .topbar-search { width: 150px; }
  .topbar-docs { padding: 0 7px; }
  .user-name { max-width: 88px; }
}
@media (max-width: 860px) {
  .app-body { grid-template-columns: minmax(0, 1fr); }
  .sidenav { display: none; }
  .api-list { border-right: none; border-bottom: 1px solid var(--border); }
  .modal-card { width: 92vw; max-width: 380px; }
  .req-body { grid-template-columns: minmax(0, 1fr) 220px; }
  .topbar { padding: 0 var(--s3); gap: var(--s2); }
  .topbar-sub, .topbar-divider, .topbar-tabs { display: none; }
  .add-wx-fab { display: inline-flex; }
  .topbar-search { width: 130px; }
  .user-name { max-width: 72px; }
}

@media (max-width: 640px) {
  .req-body { grid-template-columns: 1fr; overflow-y: auto; }
  .parameter-pane { max-height: 220px; }
  .parameter-list { height: 160px; }
  /* 窄屏顶栏：标题可省略号收缩、文档入口收进用户菜单、搜索框可伸缩，避免横向溢出 */
  .topbar-left { flex: 0 1 auto; min-width: 0; }
  .topbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
  .topbar-docs { display: none; }
  .topbar-search { width: auto; flex: 1 1 80px; min-width: 72px; }
  .user-name { max-width: 64px; }
}

/* ============ 减少动效 ============ */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============ 登录页（index.html） ============ */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(59, 130, 246, .10), transparent 55%),
    radial-gradient(800px 480px at 85% 85%, rgba(29, 78, 216, .08), transparent 55%),
    var(--bg);
}
.auth-wrap {
  width: 400px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; align-items: center;
}
.brand { text-align: center; margin-bottom: var(--s6); }
.auth-page .brand-logo {
  width: 52px; height: 52px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  box-shadow: var(--shadow-md); margin-bottom: var(--s3);
}
.brand h1 { font-size: 22px; font-weight: 700; color: var(--text-0); }
.brand-sub { margin-top: 6px; color: var(--text-2); font-size: var(--fs-sm); }
.auth-card {
  width: 100%; padding: var(--s8);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.auth-tabs {
  display: flex; gap: var(--s2); margin-bottom: var(--s6);
  background: var(--surface-3); padding: 4px; border-radius: var(--r-sm);
}
.auth-tabs .tab {
  flex: 1; height: 36px; border-radius: 6px; border: none; background: transparent;
  color: var(--text-2); font-size: var(--fs-base); font-weight: 500;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.auth-tabs .tab.active { background: var(--surface); color: var(--text-0); box-shadow: var(--shadow-sm); font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: var(--s4); width: 100%; }
.auth-form .field { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.auth-form .field label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-1); }
.auth-form input {
  width: 100%; height: 42px; padding: 0 var(--s4);
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-0); font-size: var(--fs-base);
  outline: none; transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.auth-form input:focus { border-color: var(--brand-0); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.auth-form .btn-primary { height: 42px; width: 100%; margin-top: var(--s2); font-size: var(--fs-base); }
.input-action-row { display: flex; align-items: center; gap: var(--s2); }
.input-action-row input { min-width: 0; flex: 1; }
.code-btn { height: 42px; padding: 0 var(--s3); white-space: nowrap; }
.hidden { display: none !important; }
.gw-status {
  margin-top: var(--s6); display: flex; align-items: center; gap: var(--s2);
  color: var(--text-2); font-size: var(--fs-sm);
}
.gw-status .dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
#toast:empty { display: none; }
.auth-page > #toast {
  position: fixed; top: 24px; left: 50%; z-index: 1000;
  width: max-content; max-width: min(360px, calc(100vw - 32px));
  margin: 0; padding: 10px 16px;
  border-radius: 10px; text-align: center; line-height: 1.45;
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
}
.auth-page > #toast:not(:empty) { animation: toastIn 220ms var(--ease-out); }

/* ============ 账号工作区 / 实时消息 ============ */
body:not([data-view="console"]) .add-wx-fab { display: none; }
.workspace-account { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.workspace-account-main { min-width: 0; }
.workspace-eyebrow { display: block; margin-bottom: 5px; color: var(--text-3); font-size: 11px; }
.workspace-account-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.workspace-account-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; line-height: 1.5; color: var(--text-0); }
.workspace-account-status { flex-shrink: 0; color: var(--text-2); background: var(--surface-3); padding: 3px 8px; border-radius: 6px; font-size: 11px; }
.workspace-account-status.is-online { color: var(--ok); background: rgba(22, 163, 74, .09); }
.workspace-key-line { display: flex; align-items: center; gap: 4px; margin-top: 3px; min-width: 0; }
.workspace-key-line code { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); overflow-wrap: anywhere; }
.workspace-key-line .icon-btn { width: 26px; height: 26px; flex: 0 0 auto; }
.workspace-binding { flex-shrink: 0; display: grid; grid-template-columns: auto auto; column-gap: 16px; row-gap: 5px; align-items: center; }
.workspace-binding > span { color: var(--text-3); font-size: 11px; }
.workspace-binding time { font-size: 12px; color: var(--text-1); font-variant-numeric: tabular-nums; grid-row: 2; }
.workspace-select-account { grid-column: 2; grid-row: 1 / 3; height: 32px; padding: 0 10px; font-size: 12px; }
.workspace-expiry { grid-column: 1; grid-row: 3; display: flex; gap: 8px; align-items: center; font-size: 11px; }
.workspace-expiry span { color: var(--text-3); }
.workspace-expiry strong { color: var(--text-1); font-weight: 500; }
.workspace-expiry .is-expired { color: var(--err); }
.extend-key-value { display: block; margin: 10px 0 18px; overflow-wrap: anywhere; color: var(--text-1); }
#extendKeyForm .field { display: flex; flex-direction: column; gap: 8px; }
#extendKeyDays { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-0); font: inherit; }
.extend-key-preview { padding: 12px; margin: 14px 0; border-radius: 8px; background: var(--surface-2); font-size: 13px; color: var(--text-1); font-variant-numeric: tabular-nums; }
.customer-key-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.customer-key-expiry { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-3); }
.customer-key-expiry strong { color: var(--text-1); font-size: 12px; font-weight: 500; white-space: nowrap; }
.customer-key-actions { display: flex; gap: 12px; }
.customer-key-actions button:disabled { color: var(--text-3); cursor: not-allowed; }
.customer-key-expiry.is-expired strong, .license-expiry.is-expired strong { color: var(--err); }
.license-expiry { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; font-size: 12px; color: var(--text-2); }
.license-expiry strong { color: var(--text-1); font-weight: 500; }
.workspace-tabs { flex-shrink: 0; display: flex; align-items: center; gap: 20px; height: 47px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.workspace-tabs > button { align-self: stretch; display: inline-flex; align-items: center; gap: 6px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-2); font-size: 13px; padding: 0 2px; white-space: nowrap; }
.workspace-tabs > button.active { color: var(--brand-1); border-bottom-color: var(--brand-1); font-weight: 600; }
.workspace-tab-label { color: var(--text-3); font-size: 10px; font-weight: 400; }
.workspace-tabs > .workspace-catalog-toggle { display: inline-flex; margin-left: auto; font-size: 12px; }
.request-workspace { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow-y: auto; }
.request-workspace .req-head { flex-shrink: 0; gap: 12px; padding: 12px 20px; }
.request-workspace .req-title { min-width: 0; }
.request-workspace .req-title > div { min-width: 0; }
.request-workspace .req-name { font-size: 14px; }
.request-workspace .req-path { overflow-wrap: anywhere; }
.request-workspace .req-actions { flex-shrink: 0; }
.request-workspace .req-actions button { height: 32px; padding: 0 12px; font-size: 12px; }
.request-workspace .req-body { min-height: 180px; grid-template-columns: minmax(0, 1fr) 230px; padding: 16px 20px; gap: 12px; overflow: hidden; }
.request-workspace .request-editor-pane { min-height: 0; }
.request-workspace .json-editor { min-height: 100px; height: 100%; border: 0; border-radius: 0; resize: none; padding: 12px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.request-workspace .output-stack { margin: 0 20px 16px; animation: none; }
.request-workspace .req-resp { height: var(--response-height, 200px); border-top: 0; }
.request-workspace .req-resp.collapsed { height: 54px; }
.request-workspace.parameters-hidden .req-body { grid-template-columns: minmax(0, 1fr); }
.request-workspace.parameters-hidden .parameter-pane { display: none; }
.api-list-head { padding-top: 16px; margin-bottom: 16px; box-shadow: none; }
.api-list-head-row { flex-direction: column; gap: 10px; }
.api-list-head h1 { font-size: 15px; }
.api-list-head p { font-size: 12px; }
.api-cat-head { padding: 12px; }
.catalog-hidden { grid-template-columns: 216px minmax(0, 1fr); }
.catalog-hidden .api-list { display: none; }
.message-workspace { flex: 1 1 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 20px; }
.stream-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-shrink: 0; }
.stream-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stream-title h2 { font-size: 16px; line-height: 1.5; color: var(--text-0); }
.method.ws { color: var(--brand-1); background: var(--nav-active-bg); }
.stream-status { font-size: 11px; color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.stream-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.stream-status[data-state="connected"] { color: var(--ok); }
.stream-status[data-state="connected"]::before { background: var(--ok); }
.stream-status[data-state="connecting"] { color: var(--brand-1); }
.stream-status[data-state="connecting"]::before { background: var(--brand-1); }
.stream-status[data-state="error"] { color: var(--err); }
.stream-status[data-state="error"]::before { background: var(--err); }
.stream-heading p { margin-top: 6px; color: var(--text-2); font-size: 12px; line-height: 1.6; }
.stream-heading > button { flex-shrink: 0; height: 36px; padding: 0 16px; }
.stream-heading > button.is-connected { background: var(--surface); color: var(--text-1); box-shadow: none; border-color: var(--border); }
.stream-subscription-note { margin: 14px 0; color: var(--text-3); font-size: 11px; line-height: 1.6; flex-shrink: 0; }
.stream-example { flex-shrink: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.stream-example > summary { padding: 10px 14px; cursor: pointer; font-size: 12px; color: var(--text-1); }
.stream-example > summary span { margin-left: 8px; color: var(--text-3); font-size: 11px; }
.stream-example > p { padding: 0 14px 10px; color: var(--text-2); font-size: 12px; line-height: 1.6; }
.stream-example-address { display: flex; align-items: center; gap: 12px; padding: 0 14px 12px; }
.stream-example-address code { min-width: 0; flex: 1; overflow-wrap: anywhere; color: var(--text-1); font-size: 12px; }
.stream-example-address button { flex-shrink: 0; }
.stream-example pre, .stream-message pre { font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--code-text); background: var(--code-bg); white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 14px; max-height: 280px; overflow: auto; }
.stream-example-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; font-size: 11px; color: var(--text-3); }
.stream-example-footer button { flex-shrink: 0; }
.stream-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 10px; font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.stream-toolbar > div { display: flex; gap: 6px; flex-shrink: 0; }
.stream-toolbar button { height: 30px; padding: 0 10px; font-size: 12px; }
.stream-toolbar button[aria-pressed="true"] { background: var(--nav-active-bg); color: var(--brand-1); }
.stream-messages { flex: 1 0 auto; min-height: 200px; display: flex; flex-direction: column; gap: 10px; }
.stream-empty { flex: 1; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 24px; color: var(--text-2); }
.stream-empty-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-3); color: var(--text-3); font-size: 22px; margin-bottom: 12px; }
.stream-empty strong { font-size: 14px; color: var(--text-1); font-weight: 500; }
.stream-empty p { margin-top: 6px; font-size: 12px; line-height: 1.6; }
.stream-message { flex-shrink: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 12px 14px; min-width: 0; }
.stream-message-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stream-message-type { color: var(--brand-1); background: var(--nav-active-bg); padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.stream-message-head time { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.stream-message-route { margin-top: 8px; color: var(--text-3); font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.stream-message-preview { margin-top: 5px; font-size: 13px; line-height: 1.6; color: var(--text-0); overflow-wrap: anywhere; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.stream-message-details { margin-top: 10px; }
.stream-message-details summary { cursor: pointer; font-size: 11px; color: var(--text-2); }
.stream-message-details pre { margin-top: 10px; border: 1px solid var(--border); border-radius: 6px; }
.stream-message-details button { margin-top: 8px; }
.stream-footer { flex-shrink: 0; margin-top: 12px; font-size: 11px; color: var(--text-3); line-height: 1.6; }
@media (max-width: 1100px) {
  .catalog-hidden { grid-template-columns: minmax(0, 1fr); }
  .workspace-account { gap: 12px; }
  .workspace-binding { column-gap: 10px; }
}
@media (max-width: 860px) {
  .api-list { display: none; }
  .catalog-open .api-list { display: block; position: fixed; top: 220px; left: 12px; right: 12px; bottom: 20px; z-index: 100; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); }
  .workspace-tabs > .workspace-catalog-toggle { display: inline-flex; }
  .api-list-head-row { flex-direction: row; }
}
@media (max-width: 640px) {
  .workspace-account { padding: 12px; flex-wrap: wrap; gap: 10px; }
  .workspace-account-main { width: 100%; }
  .workspace-account-title strong { font-size: 15px; }
  .workspace-binding { display: flex; flex-wrap: wrap; gap: 4px 8px; width: 100%; }
  .workspace-binding > span { font-size: 10px; }
  .workspace-binding time { font-size: 11px; }
  .workspace-select-account { margin-left: auto; height: 28px; font-size: 11px; padding: 0 8px; }
  .workspace-tabs { padding: 0 12px; gap: 16px; }
  .workspace-tab-label { display: none; }
  .request-workspace .req-head { padding: 12px; flex-wrap: wrap; }
  .request-workspace .req-title { width: 100%; }
  .request-workspace .req-actions { margin-left: auto; }
  .request-workspace .req-body { padding: 12px; min-height: 180px; grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .request-workspace .request-editor-pane { min-height: 180px; }
  .request-workspace .parameter-pane { min-height: 180px; max-height: 240px; }
  .request-workspace .output-stack { margin: 0 12px 12px; }
  .request-workspace .req-resp { height: var(--response-height, 160px); }
  .request-workspace .req-resp.collapsed { height: 54px; }
  .message-workspace { padding: 16px 12px; }
  .stream-heading { gap: 8px; }
  .stream-title { gap: 6px; }
  .stream-title h2 { font-size: 15px; }
  .stream-heading > button { height: 32px; font-size: 12px; padding: 0 10px; }
  .stream-example > summary span { display: none; }
  .stream-example-footer { flex-wrap: wrap; }
  .stream-subscription-note { margin: 12px 0; }
  .stream-message { padding: 10px 12px; }
}

/* ============ 管理后台 ============ */
.admin-main { max-width: 1100px; width: 100%; margin: 0 auto; padding: var(--s8) var(--s5) 48px; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); margin-bottom: var(--s5); }
.eyebrow { color: var(--brand-1); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.admin-head h1 { margin-top: 5px; font-size: 24px; line-height: 1.2; }
.admin-head p { margin-top: 6px; color: var(--text-2); font-size: var(--fs-sm); }
.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.admin-stat { display: flex; align-items: baseline; gap: var(--s2); padding: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.admin-stat strong { font-size: 22px; line-height: 1; }
.admin-stat span { color: var(--text-2); font-size: var(--fs-sm); }
.admin-customers { display: flex; flex-direction: column; gap: var(--s3); }
.list-pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }
.list-pagination label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.list-pagination select { height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text-0); font: inherit; }
.list-pagination nav { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--s2); }
.pagination-count { margin-right: var(--s2); color: var(--text-3); font-size: var(--fs-xs); }
.pagination-button { min-width: 34px; height: 32px; padding: 0 var(--s3); font-size: var(--fs-xs); }
.pagination-button[aria-current="page"] { pointer-events: none; }
.pagination-button:disabled { cursor: not-allowed; opacity: .45; }
.customer-card { padding: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.customer-card.is-disabled { opacity: .72; }
.customer-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.customer-email { font-weight: 650; color: var(--text-0); overflow-wrap: anywhere; }
.customer-meta { margin-top: 4px; color: var(--text-3); font-size: var(--fs-xs); }
.customer-invitation { margin-top: 5px; color: var(--text-3); font-size: var(--fs-xs); }
.customer-invitation code { color: var(--text-1); font-size: inherit; }
.customer-credentials { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; margin-top: 10px; }
.customer-credential-label { color: var(--text-3); font-size: var(--fs-xs); }
.customer-password-view { display: inline-flex; align-items: center; min-width: 150px; height: 30px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; }
.customer-password-value { min-width: 0; width: 122px; height: 28px; padding: 0 9px; border: 0; outline: 0; background: transparent; color: var(--text-1); font: 12px ui-monospace, monospace; }
.customer-password-value:focus { box-shadow: none; }
.customer-password-reveal { display: grid; place-items: center; width: 30px; height: 28px; border: 0; border-left: 1px solid var(--border); background: transparent; color: var(--text-3); }
.customer-password-reveal:hover:not(:disabled) { background: var(--nav-active-bg); color: var(--brand-1); }
.customer-password-reveal:disabled { cursor: not-allowed; opacity: .45; }
.password-eye-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.customer-credential-hint { color: var(--text-3); font-size: 11px; }
.customer-status { flex: 0 0 auto; padding: 3px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 650; }
.customer-status.on { color: var(--ok); background: rgba(22, 163, 74, .11); }
.customer-status.off { color: var(--err); background: rgba(220, 38, 38, .10); }
.customer-keys { margin-top: var(--s4); border-top: 1px solid var(--border); }
.customer-key-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, .4fr) auto; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.customer-key-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, monospace; font-size: var(--fs-sm); }
.customer-key-note, .customer-no-key { color: var(--text-3); font-size: var(--fs-xs); }
.customer-card-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.customer-card-actions button { height: 30px; padding: 0 var(--s3); font-size: var(--fs-xs); }
.text-btn { border: 0; background: transparent; color: var(--brand-1); font-size: var(--fs-xs); }
.text-btn:hover { color: var(--brand-2); }
.btn-danger { border: 1px solid rgba(220, 38, 38, .2); border-radius: var(--r-sm); background: transparent; color: var(--err); }
.btn-danger:hover { background: rgba(220, 38, 38, .08); }
.admin-loading, .admin-empty { padding: var(--s8); color: var(--text-3); text-align: center; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--r-md); }

/* ============ 邀请码 ============ */
.invite-panel { margin-bottom: var(--s5); padding: var(--s5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.invite-panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); }
.invite-panel-head h2 { font-size: var(--fs-lg); }
.invite-panel-head p { margin-top: 4px; color: var(--text-2); font-size: var(--fs-sm); }
.invite-create { display: flex; gap: var(--s2); }
.invite-create input { width: 68px; height: 36px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text-0); font: inherit; text-align: center; }
.invite-create .btn-primary { height: 36px; padding: 0 var(--s3); font-size: var(--fs-sm); }
.invite-tools { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: center; gap: var(--s3); margin-top: var(--s4); }
.list-search { width: 100%; min-width: 220px; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text-0); font: inherit; font-size: var(--fs-xs); }
.list-search::placeholder { color: var(--text-3); }
.customer-list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin: var(--s5) 0 var(--s3); }
.customer-list-head h2 { font-size: var(--fs-lg); }
.customer-list-head p { margin-top: 4px; color: var(--text-2); font-size: var(--fs-sm); }
.customer-list-head .list-search { width: min(420px, 100%); }
.invite-filters { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); background: var(--surface-3); }
.invite-filters button { min-height: 29px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font: 500 var(--fs-xs)/1 inherit; }
.invite-filters button span { margin-left: 3px; color: var(--text-3); }
.invite-filters button.active { background: var(--surface); color: var(--text-0); box-shadow: var(--shadow-sm); }
.invite-filters button.active span { color: var(--brand-1); }
.invite-bulk { display: flex; align-items: center; gap: 6px; }
.invite-bulk > span { color: var(--text-2); font-size: var(--fs-xs); white-space: nowrap; }
.invite-bulk button { height: 29px; padding: 0 8px; font-size: var(--fs-xs); }
.invite-list { display: flex; flex-direction: column; margin-top: var(--s4); border-top: 1px solid var(--border); }
.invite-list-head { display: flex; align-items: center; justify-content: space-between; min-height: 38px; color: var(--text-3); font-size: var(--fs-xs); }
.invite-row { display: grid; grid-template-columns: 22px minmax(150px, 1.2fr) 70px minmax(160px, 1fr) auto auto; align-items: center; gap: var(--s3); min-height: 45px; border-top: 1px solid var(--border); }
.invite-row.is-muted { opacity: .7; }
.invite-check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-xs); cursor: pointer; }
.invite-check input { width: 14px; height: 14px; accent-color: var(--brand-1); cursor: pointer; }
.invite-check input:disabled { cursor: not-allowed; }
.invite-code { color: var(--text-0); font: 600 var(--fs-sm)/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }
.invite-status { width: max-content; padding: 3px 7px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 650; }
.invite-status.ready { color: var(--ok); background: rgba(22, 163, 74, .11); }
.invite-status.used { color: var(--brand-1); background: var(--nav-active-bg); }
.invite-status.disabled { color: var(--text-3); background: var(--surface-3); }
.invite-user { min-width: 0; overflow: hidden; color: var(--text-3); font-size: var(--fs-xs); text-overflow: ellipsis; white-space: nowrap; }

/* ============ Key 管理 ============ */
.keys-main { max-width: 1040px; width: 100%; margin: 0 auto; padding: var(--s8) var(--s5) 48px; }
.keys-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); margin-bottom: var(--s5); }
.keys-head h1 { margin-top: 5px; font-size: 24px; line-height: 1.2; }
.keys-head p { margin-top: 6px; color: var(--text-2); font-size: var(--fs-sm); }
.keys-head-actions { display: flex; align-items: center; justify-content: flex-end; flex: 0 0 auto; gap: var(--s2); }
.keys-head-actions .btn-primary, .keys-head-actions .btn-ghost { min-height: 38px; padding: 0 var(--s4); white-space: nowrap; }
.keys-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.license-card { min-width: 0; padding: var(--s5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), transform 160ms var(--ease-out); }
.license-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.license-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.license-label { color: var(--text-3); font-size: var(--fs-xs); }
.license-value { display: block; max-width: 100%; margin-top: 7px; overflow: hidden; color: var(--text-0); font: 600 var(--fs-sm)/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.license-status { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 6px; padding: 4px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 650; }
.license-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.license-status.on { color: var(--ok); background: rgba(22, 163, 74, .11); }
.license-status.off { color: var(--text-3); background: var(--surface-3); }
.license-meta { display: flex; justify-content: space-between; gap: var(--s3); margin-top: var(--s5); padding-top: var(--s3); border-top: 1px solid var(--border); color: var(--text-3); font-size: var(--fs-xs); }
.license-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.license-actions { display: flex; gap: var(--s2); margin-top: var(--s4); }
.license-actions button, .license-actions a { min-height: 32px; padding: 0 var(--s3); font-size: var(--fs-xs); }
.license-use { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.keys-list > .admin-empty, .keys-list > .admin-loading { grid-column: 1 / -1; }

/* ============ 个人中心 ============ */
.profile-main { max-width: 920px; width: 100%; margin: 0 auto; padding: var(--s8) var(--s5) 48px; }
#viewAi { max-width: 1180px; }
.ai-doc { max-width: 900px; margin: 0 auto; }
.ai-doc-intro { margin-bottom: 28px; }
.ai-doc-eyebrow { margin-bottom: 10px; color: var(--brand-1); font-size: 12px; font-weight: 650; letter-spacing: .08em; }
.ai-doc-intro h1 { margin-bottom: 10px; font-size: 30px; letter-spacing: -.03em; line-height: 1.3; }
.ai-doc-intro > p { color: var(--text-2); line-height: 1.8; }
.ai-doc-notice { display:flex; align-items:flex-start; gap:10px; margin-top:20px; padding:14px 16px; border-left:3px solid var(--brand-0); border-radius:0 8px 8px 0; background:var(--nav-active-bg); color:var(--text-1); line-height:1.7; font-size:13px; }
.ai-doc-notice .ai-status-dot { margin-top:6px; }
.ai-doc-notice p { margin-top:2px; color:var(--text-2); }
.ai-doc-section { scroll-margin-top:88px; padding:26px 28px; margin-bottom:18px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.ai-doc-section h2 { margin-bottom:18px; font-size:21px; letter-spacing:-.02em; }
.ai-doc-section h2 span { margin-right:10px; color:var(--text-3); font-size:13px; font-weight:500; }
.ai-doc-section h3 { margin:22px 0 9px; font-size:15px; }
.ai-doc-section p, .ai-doc-section li { color:var(--text-1); line-height:1.9; }
.ai-doc-section ul, .ai-doc-steps { padding-left:22px; }
.ai-doc-steps { display:grid; gap:10px; margin:0; }
.ai-doc-steps li b { display:block; }
.ai-doc-steps li p { margin-top:2px; color:var(--text-2); }
.ai-doc-section code { overflow-wrap:anywhere; color:var(--brand-1); }
.ai-doc-section pre { overflow-x:auto; margin:12px 0 0; padding:15px 16px; border-radius:8px; background:#111827; color:#e5e7eb; line-height:1.7; }
.ai-doc-section pre code { color:inherit; white-space:pre; }
.ai-doc-muted { margin-top:14px; color:var(--text-2) !important; font-size:13px; }
.ai-address-line { display:flex; align-items:center; gap:12px; margin-top:14px; }
.ai-address-line code { flex:1; min-width:0; overflow:auto; padding:12px 14px; border:1px solid var(--border); border-radius:8px; background:var(--surface-2); font:600 13px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace; white-space:nowrap; }
.ai-address-line .btn-primary { flex:0 0 auto; }
.ai-doc-section .list-row { border-top:1px solid var(--border); }
.ai-mcp-url-row { display:flex; align-items:center; gap:10px; margin:14px 0 18px; }
.ai-mcp-url-row code { flex:1; min-width:0; padding:13px 14px; overflow-wrap:anywhere; border:1px solid var(--border); border-radius:8px; background:var(--surface-2); }
.ai-token-create { display:flex; align-items:end; flex-wrap:wrap; gap:12px; padding-top:16px; border-top:1px solid var(--border); }
.ai-token-create label:first-child { flex:1 1 220px; display:grid; gap:6px; color:var(--text-2); font-size:13px; }
.ai-token-create input[type="text"] { width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:7px; background:var(--surface); color:var(--text-1); }
.ai-scope-check { display:flex; align-items:center; gap:6px; white-space:nowrap; color:var(--text-2); font-size:13px; }
.ai-token-result { display:grid; gap:10px; margin-top:16px; padding:16px; border:1px solid #b8ddc8; border-radius:8px; background:#f1fbf5; }
.ai-token-result code { display:block; padding:10px; overflow-wrap:anywhere; border-radius:6px; background:#fff; color:var(--text-1); }
.ai-token-result p { margin:0; color:var(--text-2); font-size:13px; }
.ai-token-result > div { display:flex; gap:8px; flex-wrap:wrap; }
.ai-copy-ai-btn { margin-top:12px; }
.ai-copy-ai-btn:disabled { opacity:.5; cursor:not-allowed; }
.ai-token-list { display:grid; gap:10px; }
.ai-token-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 0; border-top:1px solid var(--border); }
.ai-token-main { display:grid; gap:4px; min-width:0; }
.ai-token-main code { overflow-wrap:anywhere; color:var(--brand-1); }
.ai-token-main small { color:var(--text-2); }
.ai-token-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; }
.ai-token-revoked { color:var(--text-3); font-size:13px; }
.ai-token-row.is-revoked { opacity:.65; }
.ai-prompt-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.ai-prompt-list button { padding:13px 14px; text-align:left; border:1px solid var(--border); border-radius:8px; background:var(--surface-2); color:var(--text-1); cursor:pointer; }
.ai-prompt-list button:hover { border-color:var(--brand-0); color:var(--brand-1); }
.ai-page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; }
.ai-page-heading h1 { margin-top:6px; font-size:32px; letter-spacing:-.02em; }
.ai-page-heading p { max-width:680px; margin-top:8px; color:var(--text-2); font-size:15px; }
.eyebrow { color:var(--brand-1); font-size:11px; font-weight:700; letter-spacing:.12em; }
.ai-status-banner { display:flex; align-items:center; gap:12px; margin:24px 0 14px; padding:14px 16px; border:1px solid #dbe5f5; border-radius:12px; background:#f7faff; }
.ai-status-banner.is-ready { border-color:#b9e5ca; background:#f3fbf6; }
.ai-status-banner.is-off { border-color:#f1d3ad; background:#fffaf2; }
.ai-status-dot { width:9px; height:9px; flex:0 0 auto; border-radius:50%; background:#f59e0b; box-shadow:0 0 0 4px rgba(245,158,11,.14); }
.is-ready .ai-status-dot { background:#16a34a; box-shadow:0 0 0 4px rgba(22,163,74,.12); }
.ai-status-banner strong { font-size:14px; }
.ai-status-banner p { margin-top:2px; color:var(--text-2); font-size:12px; }
.ai-url-card { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; padding:22px; border:1px solid #cfe0fb; border-radius:14px; background:linear-gradient(135deg,#f7faff,#eef5ff); box-shadow:0 8px 22px rgba(38,86,150,.07); }
.ai-url-card h2 { margin-top:6px; font-size:20px; }
.ai-url-card p { max-width:650px; margin-top:6px; color:var(--text-2); font-size:13px; }
.ai-url-value { display:block; margin-top:16px; padding:12px 14px; overflow:auto; border:1px solid #d7e3f5; border-radius:8px; background:#fff; color:#173a70; font:600 13px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace; white-space:nowrap; }
.ai-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:14px; }
.ai-steps ol { display:grid; gap:13px; margin:2px 0 0; padding:0; list-style:none; counter-reset:steps; }
.ai-steps li { position:relative; display:block; min-height:42px; padding-left:38px; counter-increment:steps; }
.ai-steps li::before { content:counter(steps); position:absolute; top:0; left:0; display:grid; place-items:center; width:24px; height:24px; border-radius:50%; background:var(--nav-active-bg); color:var(--brand-1); font-weight:700; font-size:12px; }
.ai-steps li b { display:block; font-size:14px; }
.ai-steps li span { display:block; margin-top:2px; color:var(--text-2); font-size:12px; }
.scope-row { display:flex; align-items:flex-start; gap:10px; padding:11px 0; border-top:1px solid var(--border); }
.scope-icon { display:grid; place-items:center; width:28px; height:28px; flex:0 0 auto; border-radius:8px; background:var(--nav-active-bg); color:var(--brand-1); font-size:11px; font-weight:700; }
.scope-row b { display:block; font-size:13px; }
.scope-row small { display:block; margin-top:3px; color:var(--text-2); font-size:11px; line-height:1.4; }
.scope-row.muted { opacity:.72; }
.ai-connections, .ai-client-help { margin-top:14px; }
.client-command { display:flex; align-items:flex-start; gap:20px; padding:12px 0; border-top:1px solid var(--border); font-size:13px; }
.client-command b { width:70px; flex:0 0 auto; }
.client-command code, .client-command span { color:var(--text-2); font:12px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace; }
.profile-intro h1 { margin-top: 5px; font-size: 24px; line-height: 1.2; }
.profile-intro p { margin-top: 6px; color: var(--text-2); font-size: var(--fs-sm); }
.profile-layout { display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr); gap: var(--s4); margin-top: var(--s6); }
.profile-card { padding: var(--s5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.profile-account-card { display: flex; align-items: flex-start; gap: var(--s3); }
.profile-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: var(--nav-active-bg); color: var(--brand-1); font-size: 20px; font-weight: 650; }
.profile-label { color: var(--text-2); font-size: var(--fs-xs); }
.profile-email { margin-top: 3px; color: var(--text-0); font-size: var(--fs-sm); font-weight: 650; overflow-wrap: anywhere; }
.profile-role { margin-top: 5px; color: var(--text-3); font-size: var(--fs-xs); }
.profile-card-head h2 { font-size: var(--fs-lg); }
.profile-card-head p { margin-top: 4px; color: var(--text-2); font-size: var(--fs-sm); }
.profile-form { display: flex; flex-direction: column; gap: var(--s4); margin-top: var(--s5); }
.profile-form .field { display: flex; flex-direction: column; gap: 6px; }
.profile-form label { color: var(--text-1); font-size: var(--fs-sm); font-weight: 550; }
.profile-form input { width: 100%; height: 40px; padding: 0 var(--s3); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text-0); font: inherit; outline: none; }
.profile-form input:focus { border-color: var(--brand-0); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.profile-submit { width: 100%; height: 40px; margin-top: var(--s1); }

@media (max-width: 640px) {
  .modal { padding-top: 20px; padding-bottom: 20px; }
  .modal-card { max-height: calc(100vh - 40px); }
  .qr-modal-card { padding: 22px 18px; }
  .account-picker-card { padding: 22px 18px; }
  .qr-progress { gap: 5px; }
  .qr-progress-step { gap: 4px; font-size: 11px; }
  .qr-progress-step strong { overflow-wrap: anywhere; }
  .proxy-helper { align-items: stretch; flex-direction: column; }
  .proxy-downloads a { flex: 1; justify-content: center; }
  .admin-main { padding: var(--s5) var(--s3) 32px; }
  .admin-head { align-items: flex-start; flex-direction: column; }
  .admin-head .btn-ghost { align-self: stretch; }
  .invite-panel-head { align-items: stretch; flex-direction: column; }
  .invite-create .btn-primary { flex: 1; }
  .invite-tools { display: flex; align-items: stretch; flex-direction: column; }
  .customer-list-head { align-items: stretch; flex-direction: column; }
  .customer-list-head .list-search { width: 100%; }
  .invite-filters { width: 100%; overflow-x: auto; }
  .invite-filters button { flex: 0 0 auto; }
  .invite-bulk { justify-content: flex-end; }
  .invite-row { grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: var(--s2); padding: var(--s3) 0; }
  .invite-code { grid-column: 2; }
  .invite-status { grid-column: 3; grid-row: 1; }
  .invite-user { grid-column: 2 / -1; grid-row: 2; }
  .invite-copy { grid-column: 3; grid-row: 3; }
  .invite-toggle { grid-column: 4; grid-row: 3; }
  .admin-stats { gap: var(--s2); }
  .admin-stat { display: block; padding: var(--s3); }
  .admin-stat strong { display: block; margin-bottom: 3px; }
  .customer-key-row { grid-template-columns: minmax(0, 1fr) auto; }
  .customer-key-expiry { grid-column: 1; grid-row: 2; }
  .customer-key-actions { grid-column: 2; grid-row: 1 / span 2; }
  .profile-main { padding: var(--s5) var(--s3) 32px; }
  .ai-page-heading { align-items:stretch; flex-direction:column; }
  .ai-page-heading .btn-ghost { align-self:flex-start; }
  .ai-url-card { align-items:stretch; flex-direction:column; padding:16px; }
  .ai-url-card .btn-primary { width:100%; }
  .ai-grid { grid-template-columns:1fr; }
  .client-command { display:block; }
  .client-command b { display:block; margin-bottom:5px; }
  .ai-doc { width:100%; }
  .ai-doc-intro h1 { font-size:26px; }
  .ai-doc-section { padding:20px 16px; }
  .ai-mcp-url-row { align-items:stretch; flex-direction:column; }
  .ai-token-row { align-items:flex-start; flex-direction:column; }
  .ai-token-actions { justify-content:flex-start; }
  .ai-prompt-list { grid-template-columns:1fr; }
  .ai-address-line { align-items:stretch; flex-direction:column; }
  .ai-address-line .btn-primary { width:100%; }
  .profile-layout { grid-template-columns: 1fr; margin-top: var(--s5); }
  .keys-main { padding: var(--s5) var(--s3) 32px; }
  .keys-head { align-items: stretch; flex-direction: column; gap: var(--s4); }
  .keys-head-actions { align-items: stretch; flex-direction: column; }
  .keys-head-actions .btn-primary, .keys-head-actions .btn-ghost { width: 100%; justify-content: center; }
  .keys-list { grid-template-columns: 1fr; }
}

/* 管理员两栏列表：固定等高，分页与搜索保持可见。 */
.admin-issue-panel { padding: var(--s5); margin-bottom: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.admin-issue-panel h2 { font-size: var(--fs-lg); }
.admin-issue-panel p { margin: 6px 0 16px; color: var(--text-2); font-size: var(--fs-sm); }
.admin-issue-form { display: grid; grid-template-columns: 1fr 1fr 110px auto; align-items: end; gap: 12px; }
.admin-issue-form label { display: grid; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); min-width: 0; }
.admin-issue-form input { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 10px; background: var(--surface); color: var(--text-0); font: inherit; }
.admin-issue-form button { min-height: 38px; }
.issue-key-result { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; font-size: var(--fs-sm); }
.issue-key-result code { user-select: all; overflow-wrap: anywhere; }
.admin-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); align-items: stretch; }
.admin-columns > .invite-panel, .customer-panel { height: clamp(560px, 70vh, 820px); min-width: 0; display: flex; flex-direction: column; padding: var(--s4); margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.admin-columns .invite-panel-head, .admin-columns .customer-list-head { flex-wrap: wrap; gap: 12px; margin: 0; }
.admin-columns .customer-list-head .list-search { width: 100%; }
.admin-columns .invite-tools { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.admin-columns .invite-filters { width: max-content; max-width: 100%; flex-wrap: wrap; }
.admin-columns .invite-bulk { flex-wrap: wrap; }
.admin-columns .list-search { min-width: 0; }
.admin-columns .invite-list, .admin-columns .admin-customers { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; margin-top: 16px; }
.admin-columns .admin-customers { display: flex; flex-direction: column; gap: 12px; }
.admin-columns .customer-card { flex-shrink: 0; box-shadow: none; padding: 16px; }
.admin-columns .customer-card-actions, .admin-columns .customer-credentials { flex-wrap: wrap; }
.admin-columns .invite-row { grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: 8px; padding: 12px 0; flex-shrink: 0; }
.admin-columns .invite-row .invite-status { grid-column: 2; grid-row: 2; }
.admin-columns .invite-row .invite-user { grid-column: 2 / -1; white-space: normal; }
.admin-columns .list-pagination { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 10px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }
.admin-columns .list-pagination nav { flex-wrap: wrap; }
@media (max-width: 1000px) {
  .admin-columns { grid-template-columns: minmax(0, 1fr); }
  .admin-columns > .invite-panel, .customer-panel { height: 640px; max-height: 80vh; min-height: 460px; }
  .admin-issue-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .admin-issue-form { grid-template-columns: minmax(0, 1fr); }
  .admin-columns > .invite-panel, .customer-panel { padding: 14px; }
}
.admin-main { max-width: 1440px; }
.admin-columns .customer-key-value { min-width: 0; overflow-wrap: anywhere; }
.admin-columns .customer-email { overflow-wrap: anywhere; }

/* 管理员测试领取与使用回访 */
.customer-trial-followup { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-size: 12px; color: var(--text-2); }
.customer-trial-followup strong { flex-basis: 100%; color: var(--text-0); font-size: 13px; }
.customer-trial-followup.is-used strong { color: #16834b; }
.customer-followup-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 0 12px; font-size: 12px; color: var(--text-2); }
.customer-followup-filter select { max-width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text-0); }

/* 管理后台主次分区：客户账号作为默认主工作区，低频工具单独收纳。 */
.admin-section-tabs { display: flex; gap: 10px; margin: 0 0 18px; padding: 5px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.admin-section-tab { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 190px; padding: 11px 16px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); text-align: left; cursor: pointer; transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.admin-section-tab strong { color: inherit; font-size: 14px; }
.admin-section-tab span { color: var(--text-3); font-size: 11px; }
.admin-section-tab.active { background: var(--surface); color: var(--brand-1); box-shadow: var(--shadow-sm); }
.admin-section-tab.active span { color: var(--text-2); }
.admin-section-panel { min-width: 0; animation: admin-panel-in 180ms var(--ease-out); }
@keyframes admin-panel-in { from { opacity: .4; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.admin-customers-panel > .customer-panel { min-width: 0; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.admin-tools-panel { padding: 22px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.admin-tools-intro { display: flex; justify-content: space-between; margin-bottom: 18px; }
.admin-tools-intro h2 { margin-top: 5px; font-size: 18px; }
.admin-tools-intro p { margin-top: 5px; color: var(--text-2); font-size: var(--fs-sm); }
.admin-tools-panel .admin-issue-panel { margin: 0 0 16px; }
.admin-tools-columns { display: block; }
.admin-tools-columns .invite-panel { margin: 0; }
.customer-followup-filter { align-items: center; gap: 10px; margin-top: 16px; padding: 14px 0 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.customer-followup-filter > label { color: var(--text-1); font-size: 12px; font-weight: 600; white-space: nowrap; }
.filter-select { position: relative; width: min(290px, 100%); }
.filter-select-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text-0); font: 500 13px/1 inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow-sm); }
.filter-select-button:hover, .filter-select-button:focus-visible { border-color: var(--brand-0); box-shadow: 0 0 0 3px rgba(59, 130, 246, .12); outline: none; }
.filter-select-button svg { width: 12px; height: 7px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; transition: transform 150ms ease; }
.filter-select-button[aria-expanded="true"] svg { transform: rotate(180deg); }
.filter-select-menu { position: absolute; z-index: 15; top: calc(100% + 8px); left: 0; width: 100%; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); }
.filter-select-menu button { display: block; width: 100%; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-1); font: 11px/1.25 inherit; text-align: left; cursor: pointer; }
.filter-select-menu button:hover, .filter-select-menu button:focus-visible, .filter-select-menu button.active { background: var(--nav-active-bg); color: var(--brand-1); outline: none; }
.filter-select-menu button.active::after { float: right; content: '✓'; font-weight: 700; }
.customer-followup-filter > span { color: var(--text-3); font-size: 11px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 640px) {
  .admin-section-tabs { margin-bottom: 14px; }
  .admin-section-tab { min-width: 0; flex: 1; padding: 10px 11px; }
  .admin-section-tab span { font-size: 10px; }
  .admin-customers-panel > .customer-panel, .admin-tools-panel { padding: 14px; }
  .customer-followup-filter { align-items: stretch; flex-direction: column; gap: 7px; }
  .filter-select { width: 100%; }
  .customer-followup-filter > span { margin-top: 2px; }
}

/* ============ 客户账号管理 · 视觉重构 ============ */
body:has(.admin-main:not(.hidden)) { background: #f5f7fb; }
.admin-main { max-width: 1320px; padding: 48px 34px 72px; }
.admin-head { align-items: center; margin-bottom: 26px; }
.admin-head .eyebrow { color: #5873a5; font-size: 11px; letter-spacing: .16em; }
.admin-head h1 { margin-top: 8px; color: #172033; font-size: clamp(28px, 3vw, 36px); letter-spacing: -.035em; }
.admin-head p { max-width: 620px; margin-top: 9px; color: #77839a; font-size: 13px; }
.admin-head .btn-ghost { height: 40px; padding: 0 17px; border: 1px solid #dce2ec; border-radius: 10px; background: #fff; color: #34425a; box-shadow: 0 2px 8px rgba(27, 42, 68, .05); font-size: 12px; font-weight: 650; }
.admin-head .btn-ghost:hover { border-color: #a9b9d3; background: #fdfefe; box-shadow: 0 5px 14px rgba(27, 42, 68, .08); }
.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-bottom: 26px; padding: 5px; border: 1px solid #e0e6f0; border-radius: 18px; background: #fff; box-shadow: 0 5px 20px rgba(27, 42, 68, .04); }
.admin-stat { position: relative; min-height: 80px; padding: 17px 22px; border: 0; border-radius: 13px; background: transparent; }
.admin-stat:not(:last-child)::after { position: absolute; top: 19px; right: 0; width: 1px; height: 42px; background: #e8edf4; content: ''; }
.admin-stat strong { display: block; color: #172033; font-size: 27px; font-weight: 750; letter-spacing: -.04em; line-height: 1; }
.admin-stat span { display: block; margin-top: 8px; color: #7a879b; font-size: 12px; }
.admin-section-tabs { display: flex; align-items: center; gap: 7px; margin: 0 0 20px; padding: 4px; border: 1px solid #dfe6f0; border-radius: 14px; background: #edf1f7; }
.admin-section-tab { min-width: 208px; min-height: 54px; padding: 9px 16px; border: 0; border-radius: 10px; color: #708098; }
.admin-section-tab strong { font-size: 13px; font-weight: 700; }
.admin-section-tab span { margin-top: 4px; color: #9aa6b8; font-size: 11px; }
.admin-section-tab.active { background: #172033; color: #fff; box-shadow: 0 5px 12px rgba(23, 32, 51, .16); }
.admin-section-tab.active span { color: #aebbd0; }
.admin-section-tab:not(.active):hover { background: rgba(255,255,255,.72); color: #33425b; }
.admin-customers-panel > .customer-panel { padding: 0; border: 0; background: transparent; box-shadow: none; }
.customer-list-head { align-items: center; margin: 0 0 12px; padding: 21px 23px; border: 1px solid #e0e6f0; border-radius: 16px; background: #fff; box-shadow: 0 4px 16px rgba(27, 42, 68, .035); }
.customer-list-head h2 { color: #1b2639; font-size: 19px; letter-spacing: -.02em; }
.customer-list-head p { margin-top: 6px; color: #8490a3; font-size: 12px; }
.customer-list-head .list-search { width: min(380px, 42%); min-width: 230px; height: 40px; border-color: #dce3ed; border-radius: 10px; background: #fbfcfe; color: #27344b; font-size: 12px; }
.customer-list-head .list-search:focus { border-color: #7f9fd0; background: #fff; box-shadow: 0 0 0 3px rgba(73, 117, 182, .11); outline: 0; }
.customer-followup-filter { align-items: center; margin: 0 0 18px; padding: 12px 15px; border: 1px solid #e0e6f0; border-radius: 12px; background: #f9fbfd; }
.customer-followup-filter > label { color: #64738a; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.filter-select { width: 250px; }
.filter-select-button { min-height: 38px; border-color: #d8e0eb; border-radius: 9px; background: #fff; box-shadow: 0 2px 6px rgba(27, 42, 68, .035); color: #26344b; font-size: 12px; }
.customer-followup-filter > span { margin-left: auto; color: #9aa6b8; font-size: 11px; }
.admin-customers { gap: 14px; }
.customer-card { overflow: hidden; padding: 0; border: 1px solid #dfe5ee; border-radius: 17px; background: #fff; box-shadow: 0 5px 18px rgba(27, 42, 68, .055); }
.customer-card:hover { border-color: #c8d4e5; box-shadow: 0 9px 25px rgba(27, 42, 68, .09); }
.customer-card.is-disabled { opacity: .72; }
.customer-card-head { align-items: flex-start; padding: 20px 22px 16px; background: linear-gradient(110deg, #fff 0%, #fbfcff 100%); }
.customer-email { color: #172238; font-size: 16px; font-weight: 750; letter-spacing: -.015em; }
.customer-meta { margin-top: 7px; color: #8793a6; font-size: 11px; }
.customer-invitation { display: inline-flex; align-items: center; gap: 5px; margin-top: 11px; padding: 5px 8px; border-radius: 7px; background: #f1f5fa; color: #8996aa; font-size: 11px; }
.customer-invitation code { color: #52627b; font-size: 11px; font-weight: 650; }
.customer-status { padding: 5px 10px; font-size: 11px; }
.customer-credentials { margin-top: 16px; padding-top: 13px; border-top: 1px solid #edf1f5; }
.customer-credential-label { color: #8793a6; font-size: 11px; }
.customer-password-view { min-width: 172px; height: 32px; border-color: #dfe5ee; border-radius: 8px; background: #f8fafc; }
.customer-password-value { width: 140px; height: 30px; color: #43536d; font-size: 11px; }
.customer-password-reveal { height: 30px; width: 32px; border-left-color: #e1e7ef; }
.customer-credential-hint { color: #a2acbb; font-size: 10px; }
.customer-trial-followup { display: flex; align-items: center; gap: 8px 18px; margin: 0 22px 1px; padding: 12px 14px; border: 1px solid #e3e8f0; border-radius: 10px; background: #f7f9fc; color: #8290a3; font-size: 11px; }
.customer-trial-followup strong { flex-basis: auto; color: #53627b; font-size: 12px; }
.customer-trial-followup.is-used { border-color: #d4eadc; background: #f3fbf5; }
.customer-trial-followup.is-used strong { color: #178047; }
.customer-keys { margin: 16px 22px 0; border-top: 1px solid #e7ecf2; }
.customer-key-row { grid-template-columns: minmax(0, 1fr) minmax(150px, .34fr) auto; gap: 17px; padding: 14px 0; border-bottom-color: #edf1f5; }
.customer-key-value { color: #263650; font-size: 12px; font-weight: 650; }
.customer-key-note { margin-top: 5px; display: block; color: #9aa6b6; font-size: 10px; }
.customer-key-expiry { display: flex; flex-direction: column; gap: 5px; }
.customer-key-expiry span { color: #a0aaba; font-size: 10px; }
.customer-key-expiry strong { color: #52617a; font-size: 11px; font-weight: 650; }
.customer-key-expiry.is-expired strong { color: #dc4b4b; }
.customer-key-actions { display: flex; gap: 4px; }
.customer-key-actions .text-btn { min-height: 27px; padding: 0 8px; border-radius: 6px; font-size: 11px; }
.customer-key-actions .text-btn:hover { background: #edf4ff; }
.customer-card-actions { margin: 0; padding: 14px 22px 17px; border-top: 1px solid #edf1f5; background: #fbfcfe; }
.customer-card-actions button { height: 32px; padding: 0 13px; border-radius: 8px; font-size: 11px; }
.customer-card-actions .btn-primary { box-shadow: 0 3px 8px rgba(37, 99, 235, .16); }
.customer-card-actions .btn-danger { border-color: #f2cccc; }
.admin-tools-panel { border-color: #e0e6f0; border-radius: 17px; background: #f9fbfd; }
.admin-tools-intro { padding-bottom: 17px; border-bottom: 1px solid #e5eaf1; }
.admin-tools-intro h2 { color: #1b2639; font-size: 20px; }
.admin-tools-intro p { color: #8490a3; }
.admin-tools-panel .admin-issue-panel, .admin-tools-panel .invite-panel { border-color: #dfe6ef; border-radius: 14px; box-shadow: 0 4px 14px rgba(27, 42, 68, .035); }
.list-pagination { margin-top: 16px; padding: 0 3px; }
.list-pagination select { height: 34px; border-color: #d7e0eb; border-radius: 8px; background: #fff; }

@media (max-width: 720px) {
  .admin-main { padding: 30px 14px 48px; }
  .admin-head { align-items: flex-start; margin-bottom: 20px; }
  .admin-head h1 { font-size: 28px; }
  .admin-head .btn-ghost { align-self: flex-start; }
  .admin-stats { border-radius: 14px; }
  .admin-stat { min-height: 68px; padding: 14px 11px; }
  .admin-stat strong { font-size: 21px; }
  .admin-stat span { margin-top: 6px; font-size: 10px; }
  .admin-stat:not(:last-child)::after { top: 15px; height: 38px; }
  .admin-section-tabs { margin-bottom: 14px; }
  .admin-section-tab { min-width: 0; min-height: 52px; padding: 9px 10px; }
  .admin-section-tab strong { font-size: 12px; }
  .admin-section-tab span { font-size: 10px; }
  .customer-list-head { align-items: stretch; gap: 14px; padding: 17px; }
  .customer-list-head .list-search { width: 100%; min-width: 0; }
  .customer-followup-filter { align-items: stretch; gap: 8px; padding: 13px; }
  .filter-select { width: 100%; }
  .customer-followup-filter > span { margin-left: 0; }
  .customer-card-head { padding: 17px 16px 14px; }
  .customer-email { font-size: 15px; }
  .customer-trial-followup { align-items: flex-start; flex-direction: column; gap: 5px; margin: 0 16px 1px; }
  .customer-trial-followup strong { flex-basis: auto; }
  .customer-keys { margin-right: 16px; margin-left: 16px; }
  .customer-key-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 13px 0; }
  .customer-key-expiry { grid-column: 1; grid-row: 2; }
  .customer-key-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .customer-card-actions { padding: 13px 16px 15px; }
  .customer-card-actions button { flex: 1 1 auto; padding: 0 8px; }
}

/* 客户摘要列表与详情抽屉 */
.customer-row { display: grid; grid-template-columns: minmax(260px, 1.2fr) minmax(210px, .95fr) minmax(150px, .65fr) auto; align-items: center; gap: 22px; min-height: 92px; padding: 16px 20px; border: 1px solid #dfe5ee; border-radius: 15px; background: #fff; box-shadow: 0 4px 14px rgba(27, 42, 68, .04); cursor: pointer; transition: border-color 150ms ease-out, box-shadow 150ms ease-out, transform 150ms ease-out; }
.customer-row:hover, .customer-row:focus-visible { border-color: #b9c9df; box-shadow: 0 8px 22px rgba(27, 42, 68, .08); outline: none; transform: translateY(-1px); }
.customer-row.is-disabled { opacity: .7; }
.customer-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; background: #eaf1ff; color: #3466ba; font-size: 16px; font-weight: 750; }
.row-identity { display: flex; flex-direction: column; min-width: 0; gap: 6px; }
.row-identity strong { overflow: hidden; color: #1c2940; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.row-identity span, .row-followup small, .row-key-summary small { color: #96a2b2; font-size: 11px; }
.row-followup { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; }
.followup-badge { display: inline-flex; align-items: center; width: max-content; max-width: 100%; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.followup-badge.success { background: #e8f7ed; color: #168147; }
.followup-badge.pending { background: #fff5db; color: #a66b00; }
.followup-badge.warning { background: #fff0e8; color: #b25e35; }
.followup-badge.neutral { background: #eff2f6; color: #75839a; }
.row-key-summary { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row-key-summary strong { color: #293950; font-size: 20px; line-height: 1; }
.row-key-summary span { color: #697890; font-size: 11px; }
.row-key-summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; align-items: flex-end; flex-direction: column; gap: 9px; }
.row-actions .customer-status { order: 0; }
.row-actions .customer-open { height: 31px; padding: 0 11px; border-color: #d9e1ec; border-radius: 8px; background: #fff; color: #3d5e91; font-size: 11px; }
.row-actions .customer-open span { margin-left: 4px; transition: transform 150ms ease-out; }
.customer-row:hover .customer-open span { transform: translateX(2px); }
.customer-drawer { position: fixed; z-index: 100; inset: 0; display: flex; justify-content: flex-end; }
.drawer-open { overflow: hidden; }
.customer-drawer-backdrop { position: absolute; inset: 0; background: rgba(16, 26, 44, .34); backdrop-filter: blur(2px); }
.customer-drawer-panel { position: relative; display: flex; flex-direction: column; width: min(520px, 100%); height: 100%; background: #f8fafd; box-shadow: -18px 0 45px rgba(18, 30, 52, .16); animation: drawer-in 220ms cubic-bezier(.23,1,.32,1); }
@keyframes drawer-in { from { opacity: .8; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.customer-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 28px 28px 21px; border-bottom: 1px solid #e1e7f0; background: #fff; }
.customer-drawer-head h2 { margin-top: 7px; overflow-wrap: anywhere; color: #172238; font-size: 22px; letter-spacing: -.025em; }
.customer-drawer-head p { margin-top: 6px; color: #8a97a9; font-size: 11px; }
.drawer-close { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid #dce3ed; border-radius: 10px; background: #fff; color: #77869b; font-size: 23px; line-height: 1; cursor: pointer; }
.drawer-close:hover { background: #f1f5fa; color: #263854; }
.customer-drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 30px; }
.drawer-profile { display: flex; align-items: center; gap: 12px; padding: 17px; border: 1px solid #dfe6ef; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(27, 42, 68, .035); }
.drawer-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 13px; background: #eaf1ff; color: #3466ba; font-size: 18px; font-weight: 750; }
.drawer-profile-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 4px; }
.drawer-profile-copy strong { overflow-wrap: anywhere; color: #1c2940; font-size: 14px; }
.drawer-profile-copy span { color: #8a97aa; font-size: 11px; }
.customer-drawer-body > .customer-trial-followup { margin: 14px 0 0; }
.drawer-section { margin-top: 14px; padding: 17px; border: 1px solid #dfe6ef; border-radius: 14px; background: #fff; }
.drawer-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.drawer-section-title strong { color: #28364c; font-size: 13px; }
.drawer-section-title strong em { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; padding: 0 5px; border-radius: 10px; background: #edf3ff; color: #3766b2; font-size: 10px; font-style: normal; }
.drawer-section-title span { color: #9aa6b6; font-size: 10px; }
.drawer-section .customer-credentials { margin-top: 0; padding-top: 0; border-top: 0; }
.drawer-key-section .customer-keys { margin: 0; }
.drawer-actions { margin-top: 14px; padding: 14px 0 0; border-top: 1px solid #e2e8f0; background: transparent; }

@media (max-width: 900px) {
  .customer-row { grid-template-columns: minmax(220px, 1.3fr) minmax(170px, 1fr) auto; gap: 14px; }
  .row-key-summary { display: none; }
}
@media (max-width: 640px) {
  .admin-main { padding-top: 24px; }
  .admin-head p, .admin-section-tab span, .customer-list-head p, .customer-followup-filter > span { display: none; }
  .admin-head { gap: 12px; margin-bottom: 16px; }
  .admin-head h1 { font-size: 26px; }
  .admin-head .btn-ghost { height: 36px; }
  .admin-stats { margin-bottom: 16px; }
  .admin-stat { min-height: 58px; padding: 12px 9px; }
  .admin-stat strong { font-size: 19px; }
  .admin-stat span { margin-top: 4px; font-size: 9px; }
  .admin-stat:not(:last-child)::after { top: 11px; height: 34px; }
  .customer-row { grid-template-columns: minmax(0, 1fr) auto; min-height: 86px; padding: 14px; gap: 12px; }
  .row-followup { grid-column: 1; grid-row: 2; }
  .row-actions { grid-column: 2; grid-row: 1 / span 2; }
  .row-actions .customer-open { white-space: nowrap; }
  .customer-drawer-head { padding: 22px 18px 17px; }
  .customer-drawer-body { padding: 14px 12px 24px; }
  .drawer-section, .drawer-profile { padding: 14px; }
  .drawer-section-title { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .customer-row, .customer-row .customer-open span, .customer-drawer-panel, .admin-section-panel { transition: none; animation: none; }
}

/* 客户列表在模块内部滚动，避免卡片突破外层容器。 */
.admin-customers-panel > .customer-panel {
  display: flex;
  flex-direction: column;
  height: clamp(520px, calc(100vh - 300px), 760px);
  max-height: calc(100vh - 300px);
  min-height: 0;
  overflow: hidden;
}
.admin-customers-panel .customer-list-head,
.admin-customers-panel .customer-followup-filter,
.admin-customers-panel .list-pagination { flex: 0 0 auto; }
.admin-customers-panel .admin-customers {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 430px);
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 4px 4px 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.admin-customers-panel .customer-card { flex: 0 0 auto; }
.admin-customers-panel .list-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  margin-top: 12px;
  border-top: 1px solid #e8edf4;
}

@media (max-width: 720px) {
  .admin-customers-panel > .customer-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .admin-customers-panel .admin-customers {
    overflow: visible;
    padding-right: 0;
  }
}

/* 紧凑账号工作区：统计、搜索和筛选共享一行，客户卡片使用双列网格。 */
.admin-head-actions { display: flex; align-items: center; gap: 12px; }
.admin-head-actions .admin-stats {
  width: auto;
  margin: 0;
  padding: 3px;
  border-radius: 11px;
  box-shadow: 0 2px 8px rgba(27, 42, 68, .035);
}
.admin-head-actions .admin-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-height: 38px;
  padding: 8px 12px;
}
.admin-head-actions .admin-stat strong { font-size: 17px; letter-spacing: -.03em; }
.admin-head-actions .admin-stat span { margin: 0; font-size: 10px; white-space: nowrap; }
.admin-head-actions .admin-stat:not(:last-child)::after { top: 8px; height: 22px; }
.customer-list-head { gap: 18px; }
.customer-list-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; margin-left: auto; }
.customer-list-controls > .list-search { width: 260px; min-width: 160px; }
.customer-list-controls .customer-followup-filter { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; border: 0; background: transparent; white-space: nowrap; }
.customer-list-controls .customer-followup-filter > label { color: #7d8ba0; font-size: 10px; font-weight: 650; }
.customer-list-controls .customer-followup-filter > span { display: none; }
.customer-list-controls .filter-select { width: 158px; }
.customer-list-controls .filter-select-button { min-height: 40px; font-size: 11px; }
.admin-customers-panel .admin-customers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 10px; }
.admin-customers-panel .customer-row { grid-template-columns: minmax(150px, 1.05fr) minmax(116px, .75fr) minmax(70px, .55fr) auto; gap: 11px; min-height: 76px; padding: 11px 13px; border-radius: 12px; }
.admin-customers-panel .row-avatar { display: none; }
.admin-customers-panel .customer-row-main { gap: 0; }
.admin-customers-panel .row-identity { gap: 3px; }
.admin-customers-panel .row-identity strong { font-size: 13px; }
.admin-customers-panel .row-identity span, .admin-customers-panel .row-followup small, .admin-customers-panel .row-key-summary small { font-size: 10px; }
.admin-customers-panel .row-followup { gap: 4px; }
.admin-customers-panel .followup-badge { padding: 4px 7px; font-size: 10px; }
.admin-customers-panel .row-key-summary { gap: 3px; }
.admin-customers-panel .row-key-summary strong { font-size: 17px; }
.admin-customers-panel .row-key-summary span { font-size: 10px; }
.admin-customers-panel .row-key-summary small { overflow: visible; white-space: normal; line-height: 1.25; overflow-wrap: anywhere; }
.admin-customers-panel .row-actions { gap: 5px; }
.admin-customers-panel .row-actions .customer-status { padding: 4px 8px; font-size: 10px; }
.admin-customers-panel .row-actions .customer-open { height: 27px; padding: 0 8px; font-size: 10px; }
.filter-select-menu { width: max-content; min-width: 100%; max-width: min(280px, calc(100vw - 28px)); }
.filter-select-menu button { min-width: 100%; padding-right: 24px; font-size: 10px; white-space: nowrap; }
.admin-main { --account-list-panel-height: max(620px, calc(100vh - 250px)); }
.admin-customers-panel > .customer-panel { height: var(--account-list-panel-height); max-height: none; }
.admin-customers-panel .admin-customers { flex: 1 1 auto; max-height: none; padding-right: 0; scrollbar-gutter: auto; }

@media (max-width: 900px) {
  .customer-list-controls > .list-search { width: 220px; }
  .customer-list-controls .filter-select { width: 145px; }
}

@media (max-width: 640px) {
  .admin-head-actions { width: 100%; justify-content: space-between; }
  .admin-head-actions .admin-stats { flex: 1; }
  .admin-head-actions .admin-stat { padding: 7px 8px; }
  .admin-head-actions .admin-stat strong { font-size: 15px; }
  .admin-head-actions .admin-stat span { font-size: 9px; }
  .customer-list-head { align-items: stretch; gap: 10px; padding: 15px; }
  .customer-list-controls { align-items: stretch; flex-direction: column; gap: 8px; margin-left: 0; }
  .customer-list-controls > .list-search { width: 100%; }
  .customer-list-controls .customer-followup-filter { justify-content: space-between; }
  .customer-list-controls .filter-select { flex: 1; width: auto; }
  .admin-customers-panel .admin-customers { grid-template-columns: 1fr; }
  .admin-customers-panel > .customer-panel { height: auto; }
}

@media (max-width: 720px) {
  .admin-customers-panel > .customer-panel { height: auto; }
}

/* 客户回访工作区：分区采用紧凑单行标签，信息列表在可用高度内滚动。 */
.admin-section-tabs { gap: 4px; padding: 4px; margin-bottom: 16px; }
.admin-section-tab { flex-direction: row; align-items: center; justify-content: center; gap: 7px; min-width: 120px; min-height: 40px; padding: 8px 16px; white-space: nowrap; }
.admin-section-tab .admin-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; margin: 0; padding: 0 6px; border-radius: 6px; background: #dfe6ef; color: #61728c; font-size: 11px; line-height: 1; font-weight: 650; }
.admin-section-tab.active .admin-tab-count { background: rgba(255, 255, 255, .14); color: #fff; }
.admin-section-tab:focus-visible { outline: 2px solid #7f9fd0; outline-offset: 2px; }
.admin-main:has(.admin-followups-panel:not(.hidden)) { display: flex; flex-direction: column; height: calc(100vh - 56px); height: calc(100dvh - 56px); min-height: 0; padding-bottom: 0; }
.admin-main:has(.admin-followups-panel:not(.hidden)) > .admin-head,
.admin-main:has(.admin-followups-panel:not(.hidden)) > .admin-section-tabs { flex: 0 0 auto; }
.admin-followups-panel { flex: 1 1 auto; min-height: 0; }
.followup-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; border: 1px solid #dfe5ee; border-radius: 14px 14px 0 0; background: #fff; box-shadow: 0 3px 14px rgba(27, 42, 68, .035); }
.followup-list-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px 0; }
.followup-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.followup-heading h2 { color: #1b2639; font-size: 17px; letter-spacing: -.015em; }
.followup-heading > span { color: #7d8b9f; font-size: 11px; }
.followup-list-head > button { min-height: 32px; padding: 0 11px; border-color: #dce3ed; border-radius: 8px; font-size: 12px; }
.followup-toolbar { position: relative; z-index: 3; display: flex; flex: 0 0 auto; align-items: center; flex-wrap: wrap; gap: 10px 18px; padding: 14px 18px 16px; }
.followup-toolbar > .list-search { flex: 1 1 240px; width: auto; min-width: 200px; height: 36px; border-color: #dce3ed; border-radius: 8px; background: #fbfcfe; font-size: 12px; }
.followup-toolbar > .list-search:focus { border-color: #7f9fd0; background: #fff; box-shadow: 0 0 0 3px rgba(73, 117, 182, .11); outline: none; }
.followup-filter { display: flex; align-items: center; gap: 8px; min-width: 0; }
.followup-filter > label { color: #75849b; font-size: 11px; white-space: nowrap; }
.followup-filter .filter-select { width: 174px; }
.followup-filter .filter-select-button { min-height: 36px; padding: 0 10px; font-size: 11px; }
.followup-filter .filter-select-button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.followup-filter .filter-select-button > svg { flex: 0 0 auto; margin-left: 8px; }
#followupStatusFilterControl { width: 104px; }
.followup-feedback { flex: 0 0 auto; padding: 0 18px 12px; color: #8996aa; font-size: 11px; line-height: 1.5; }
.followup-feedback.err { color: #d65353; }
.followup-feedback.ok { color: #168147; }
.followup-list-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; border-top: 1px solid #e6ebf2; }
.followup-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; color: #42526b; font-size: 12px; line-height: 1.5; }
.followup-table th { position: sticky; z-index: 1; top: 0; padding: 11px 14px; border-bottom: 1px solid #e1e7f0; background: #f6f8fb; color: #78869c; font-size: 11px; font-weight: 600; text-align: left; white-space: nowrap; }
.followup-table th:nth-child(1) { width: 19%; }
.followup-table th:nth-child(2) { width: 20%; }
.followup-table th:nth-child(3) { width: 18%; }
.followup-table th:nth-child(4) { width: 12%; }
.followup-table th:nth-child(5) { width: 19%; }
.followup-table th:nth-child(6) { width: 12%; }
.followup-table td { vertical-align: top; padding: 13px 14px; border-bottom: 1px solid #edf1f5; overflow-wrap: anywhere; }
.followup-row:hover td { background: #fafcfe; }
.followup-identity > strong, .followup-identity > a, .followup-identity > button { color: #23334d; font-size: 12px; font-weight: 650; }
.followup-identity > .followup-open { width: 100%; padding: 0; text-align: left; }
.followup-identity > span, .followup-identity > small, .followup-login > small, .followup-keys > small { display: block; margin-top: 4px; color: #8995a7; font-size: 11px; line-height: 1.45; }
.followup-identity code { font-size: 11px; }
.followup-key-item { display: flex; flex-direction: column; gap: 2px; margin-bottom: 7px; }
.followup-key-item:last-child { margin-bottom: 0; }
.followup-key-item > code, .followup-key-item > strong { max-width: 100%; color: #354763; font: 600 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; white-space: normal; }
.followup-key-expiry { color: #8a97aa; font-size: 11px; }
.followup-key-expiry.is-expired { color: #d65353; }
.followup-login .followup-badge { padding: 4px 7px; font-size: 11px; white-space: normal; }
.followup-online-state { display: block; margin-top: 5px; color: #8a97aa; font-size: 11px; }
.followup-online-state::before { display: inline-block; width: 5px; height: 5px; margin: 0 5px 1px 0; border-radius: 50%; background: currentColor; content: ''; }
.followup-online-state[data-state="online"] { color: #168147; }
.followup-online-state[data-state="unknown"] { color: #a67a20; }
.followup-qq > strong, .followup-qq > code { display: block; color: #304662; font: 600 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.followup-qq .followup-copy-qq { display: inline-flex; min-height: 22px; margin: 1px 0 6px; padding: 0; color: #7184a1; font-size: 11px; }
.followup-qq > div { display: flex; flex-wrap: wrap; gap: 5px; }
.followup-chat, .followup-web-chat { display: inline-flex; align-items: center; justify-content: center; gap: 4px; max-width: 100%; min-height: 28px; padding: 0 8px; border-radius: 7px; font-size: 11px; line-height: 1.3; text-decoration: none; white-space: nowrap; }
.followup-web-chat { color: #7184a1; border-color: #dfe5ee; }
.followup-note-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; width: 100%; padding: 0; overflow: hidden; color: #5a6a83; line-height: 1.55; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.followup-note > small, .followup-note > time { display: block; margin-top: 5px; color: #98a3b4; font-size: 11px; }
.followup-actions > div { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 5px; }
.followup-actions button, .followup-actions a { max-width: 100%; min-height: 27px; padding: 0 7px; border-radius: 7px; font-size: 11px; line-height: 1.3; white-space: normal; }
.followup-actions > button, .followup-actions > a { display: inline-flex; align-items: center; justify-content: center; margin: 0 3px 5px 0; }
.followup-actions .followup-open { padding: 0 2px; }
.followup-status-badge { display: inline-flex; align-items: center; width: max-content; max-width: 100%; min-height: 22px; padding: 3px 7px; border-radius: 6px; background: #fff5db; color: #a66b00; font-size: 11px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.followup-status-badge.completed, .followup-status-badge[data-status="completed"] { background: #eff2f6; color: #76839a; }
.followup-status-badge.pending, .followup-status-badge[data-status="pending"] { background: #fff5db; color: #a66b00; }
.followup-table .followup-empty-row td, .followup-table tbody > tr > td[colspan] { padding: 0; border-bottom: 0; }
.followup-table .admin-empty, .followup-table .admin-loading { padding: 48px 18px; border: 0; border-radius: 0; background: transparent; font-size: 12px; line-height: 1.6; }
.followup-pagination,
.admin-customers-panel .followup-pagination { flex: 0 0 auto; margin: 0; padding: 12px 18px; border: 1px solid #e6ebf2; border-radius: 0 0 14px 14px; background: #fff; }
.followup-panel > .followup-pagination { border-width: 1px 0 0; border-radius: 0; }
.admin-customers-panel .followup-pagination { min-width: 0; max-width: 100%; border-radius: 14px; }
.admin-customers-panel .followup-pagination nav { min-width: 0; max-width: 100%; }
.followup-pagination select { font-size: 12px; }

/* 两个桌面列表使用同一个高度，分页固定在各自面板底部。 */
@media (min-width: 901px) {
  .admin-main:has(.admin-followups-panel:not(.hidden)) { height: auto; min-height: calc(100dvh - 56px); }
  .admin-followups-panel { flex: 0 0 auto; }
  .followup-panel { height: var(--account-list-panel-height); border-radius: 14px; }
}

/* 详情抽屉中的回访字段与保存状态。 */
.drawer-followup-section { border-color: #d6e2f2; background: #fcfdff; }
.drawer-online-status { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 10px; margin-top: 9px; color: #8a97aa; font-size: 11px; }
.drawer-online-status .followup-online-state { display: inline-flex; align-items: center; margin: 0; }
.drawer-followup-section .drawer-section-title { align-items: center; flex-direction: row; flex-wrap: wrap; }
#customerFollowupForm { display: grid; gap: 12px; }
.followup-form-label { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: #65758e; font-size: 12px; }
.followup-form-label input, .followup-form-label textarea { display: block; width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid #dce4ef; border-radius: 8px; background: #fff; color: #263650; font-family: inherit; font-size: 13px; line-height: 1.45; outline: none; }
.followup-form-label input { min-height: 37px; }
.followup-form-label textarea { min-height: 82px; max-height: 220px; resize: vertical; }
.followup-form-label input::placeholder, .followup-form-label textarea::placeholder { color: #9ba7b8; }
.followup-form-label input:focus, .followup-form-label textarea:focus { border-color: #7f9fd0; box-shadow: 0 0 0 3px rgba(73, 117, 182, .11); }
.followup-form-label input:disabled, .followup-form-label textarea:disabled { background: #f4f7fb; color: #8290a4; }
.followup-form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.followup-form-actions button { min-height: 32px; padding: 0 11px; border-radius: 8px; font-size: 12px; }
#customerFollowupSaveHint { color: #8996aa; font-size: 11px; line-height: 1.5; }
#customerFollowupSaveHint.err { color: #d65353; }
#customerFollowupSaveHint.ok { color: #168147; }

@media (max-width: 1100px) {
  .followup-toolbar { gap: 10px; }
  .followup-toolbar > .list-search { flex-basis: 220px; }
  .followup-filter .filter-select { width: 162px; }
  .followup-table th, .followup-table td { padding-right: 10px; padding-left: 10px; }
}

@media (max-width: 900px) {
  .followup-toolbar > .list-search { flex-basis: 100%; }
  .followup-table, .followup-table tbody { display: block; }
  .followup-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .followup-table tbody { padding: 12px; }
  .followup-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 18px; margin-bottom: 10px; padding: 14px; border: 1px solid #e0e6ef; border-radius: 10px; background: #fff; }
  .followup-row:last-child { margin-bottom: 0; }
  .followup-table .followup-row td { display: block; min-width: 0; padding: 0; border: 0; background: transparent; }
  .followup-table .followup-identity { grid-column: 1 / -1; padding-bottom: 9px; border-bottom: 1px solid #edf1f5; }
  .followup-table .followup-identity > strong, .followup-table .followup-identity > a, .followup-table .followup-identity > button { font-size: 13px; }
  .followup-table .followup-note, .followup-table .followup-actions { grid-column: 1 / -1; }
  .followup-row td:not(.followup-identity):not(.followup-actions)::before { display: block; margin-bottom: 5px; color: #97a3b4; font-size: 11px; }
  .followup-row .followup-keys::before { content: '授权 Key / 到期'; }
  .followup-row .followup-login::before { content: '微信情况'; }
  .followup-row .followup-qq::before { content: 'QQ'; }
  .followup-row .followup-note::before { content: '备注'; }
  .followup-table .followup-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid #edf1f5; }
  .followup-actions > button, .followup-actions > a { margin: 0; }
  .followup-table .followup-empty-row, .followup-table tbody > tr:has(td[colspan]) { display: block; }
  .followup-table .followup-empty-row td, .followup-table tbody > tr > td[colspan] { display: block; width: 100%; }
}

@media (max-width: 640px) {
  .admin-section-tabs { gap: 3px; }
  .admin-section-tab { flex: 1 1 0; min-width: 0; min-height: 38px; gap: 5px; padding: 8px 7px; }
  .admin-section-tab strong { font-size: 12px; }
  .admin-section-tab .admin-tab-count { display: inline-flex; min-width: 18px; height: 18px; padding: 0 4px; font-size: 10px; }
  .followup-panel { border-radius: 12px 12px 0 0; }
  .followup-list-head { padding: 14px 13px 0; }
  .followup-heading { gap: 7px; }
  .followup-heading h2 { font-size: 15px; }
  .followup-toolbar { gap: 9px 12px; padding: 12px 13px 14px; }
  .followup-feedback { padding-right: 13px; padding-left: 13px; }
  .followup-toolbar > .list-search { min-width: 0; height: 38px; font-size: 16px; }
  .followup-filter { flex: 1 1 150px; gap: 6px; }
  .followup-filter > label { font-size: 11px; }
  .followup-filter .filter-select { flex: 1 1 auto; width: auto; min-width: 0; }
  #followupStatusFilterControl { width: auto; }
  .followup-filter .filter-select-button { min-height: 36px; font-size: 11px; }
  .followup-filter .filter-select-menu { right: 0; left: auto; }
  .followup-table tbody { padding: 10px; }
  .followup-row { gap: 11px 12px; padding: 12px; }
  .followup-table .followup-keys { grid-column: 1 / -1; }
  .followup-qq > div { gap: 5px; }
  .followup-pagination, .admin-customers-panel .followup-pagination { gap: 8px; padding: 11px 13px; }
  .followup-pagination nav { justify-content: flex-start; }
  .followup-pagination .pagination-button { min-width: 30px; height: 30px; padding: 0 8px; }
  .followup-form-label input, .followup-form-label textarea { font-size: 16px; }
  .followup-form-actions button { flex: 1 1 auto; min-height: 36px; }
}

/* 回访列表将状态与操作收拢到同一基线，减少每行占用。 */
.copy-text { display: inline; max-width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.copy-text:hover { color: var(--brand-1); }
.copy-text:focus-visible { outline: 2px solid #7f9fd0; outline-offset: 3px; border-radius: 3px; }
.followup-identity-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.followup-identity-name .followup-open { min-width: 0; padding: 0; color: #23334d; font-size: 12px; font-weight: 650; text-align: left; overflow-wrap: anywhere; }
.followup-identity-name .followup-status-badge { flex: 0 0 auto; min-height: 20px; padding: 2px 6px; font-size: 10px; }
.followup-state-line { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; min-height: 20px; }
.followup-state-line .followup-online-state { display: inline-flex; align-items: center; margin: 0; white-space: nowrap; }
.followup-state-line .followup-badge { padding: 2px 6px; line-height: 16px; white-space: nowrap; }
.followup-key-item .copy-text code { color: #354763; font: 600 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.followup-qq .followup-copy-qq { display: inline; min-height: 0; margin: 0; padding: 0; color: #304662; font: 600 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.followup-qq .copy-hint { display: block; margin-top: 3px; color: #8995a7; font-size: 10px; }
.followup-table th:nth-child(4) { width: 9%; }
.followup-table th:nth-child(6) { width: 15%; }
.followup-table td { padding-top: 11px; padding-bottom: 11px; }
.followup-actions > button { width: auto; height: 26px; min-height: 26px; padding: 0 7px; margin: 0 4px 4px 0; font-size: 10px; line-height: 1; white-space: nowrap; box-shadow: none; }
.followup-actions .followup-detail-action { padding: 0 7px; }
#customerDrawerTrial .customer-trial-followup { width: 100%; margin: 0; }
.drawer-profile + #customerDrawerTrial { margin-top: 12px; }
@media (max-width: 900px) {
  .followup-table .followup-actions { gap: 5px; }
  .followup-actions > button { margin: 0; }
}

.invitation-template-panel { margin: 14px 0; padding: 12px 14px; border: 1px solid #e0e6f0; border-radius: 10px; background: #f9fbfd; font-size: 12px; }
.invitation-template-panel summary { cursor: pointer; color: #354763; }
.invitation-template-panel summary span { margin-left: 8px; color: #8995a7; font-size: 11px; }
.invitation-template-content { display: grid; gap: 10px; margin-top: 14px; }
.invitation-template-content textarea { width: 100%; padding: 10px 12px; border: 1px solid #dce3ed; border-radius: 8px; background: #fff; font: inherit; line-height: 1.6; resize: vertical; }
.invitation-template-actions { display: flex; gap: 8px; }
.invitation-template-content p { margin: 0; color: #8290a3; font-size: 11px; }
.invitation-template-content pre { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.6; }
@media (max-width: 640px) { .invitation-template-content textarea { font-size: 16px; } }

.contact-admin-card { width: min(440px, calc(100vw - 32px)); }
.contact-admin-card .modal-title { padding-right: 24px; font-size: 20px; }
.contact-admin-qq { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.contact-admin-qq span { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 12px; }
.contact-admin-qq strong { font: 600 24px/1.3 ui-monospace, monospace; user-select: text; -webkit-user-select: text; }
.contact-admin-qq button { flex: 0 0 auto; white-space: nowrap; }
.contact-admin-feedback { min-height: 40px; margin-top: 14px; color: var(--text-2); font-size: 12px; line-height: 1.6; }

.followup-tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.followup-tag-chip { display: inline-flex; align-items: center; max-width: 100%; min-height: 20px; padding: 2px 7px; overflow: hidden; border: 1px solid #d6e2ef; border-radius: 5px; background: #f1f6fb; color: #49627e; font-size: 10px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.followup-tag-more, .followup-no-tags { color: #8995a7; font-size: 10px; line-height: 20px; }
.followup-tag-editor { display: flex; flex-wrap: wrap; gap: 6px; }
.followup-tag-option { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 8px; border: 1px solid #dce4ef; border-radius: 6px; background: #fff; color: #50627b; font-size: 11px; cursor: pointer; }
.followup-tag-option:has(input:checked) { border-color: #9db8da; background: #f1f6fb; color: #315982; }
.followup-tag-option input { width: 13px; height: 13px; margin: 0; accent-color: #426f9f; }
.followup-tag-create-form { display: flex; gap: 8px; margin: 14px 0; }
.followup-tag-create-form input { flex: 1 1 auto; min-width: 0; min-height: 38px; padding: 0 10px; border: 1px solid #dce4ef; border-radius: 7px; font: inherit; font-size: 13px; }
.followup-tag-create-form button { flex: 0 0 auto; min-height: 38px; padding: 0 12px; font-size: 12px; }
.followup-tags-card { width: min(520px, calc(100vw - 32px)); }
.followup-tags-list { display: grid; gap: 6px; max-height: min(50vh, 420px); overflow: auto; }
.followup-tag-manage-row { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 9px; border: 1px solid #e4e9f0; border-radius: 7px; background: #fff; }
.followup-tag-manage-row > .followup-tag-chip { flex: 0 1 auto; }
.followup-tag-manage-row > small { flex: 1 1 auto; color: #8995a7; font-size: 11px; }
.followup-tag-manage-row > button { flex: 0 0 auto; min-height: 28px; padding: 0 7px; font-size: 11px; }
.followup-tags-empty { margin: 0; padding: 18px 10px; color: #8995a7; font-size: 12px; text-align: center; }
.customer-followup-badge { flex: 0 0 auto; margin-left: 7px; vertical-align: 1px; }
.admin-customers-panel .row-identity-title .followup-status-badge[data-status="pending"] { background: #fff5db; color: #a66b00; }
.admin-customers-panel .row-identity-title .followup-status-badge[data-status="completed"] { background: #eff2f6; color: #76839a; }
.row-identity-title { display: flex; align-items: center; gap: 0; min-width: 0; }
.row-identity-title strong { min-width: 0; }
@media (max-width: 640px) {
  .followup-tag-create-form input { font-size: 16px; }
  .followup-tag-manage-row { flex-wrap: wrap; }
  .followup-tag-manage-row > small { flex: 1 1 100%; order: 2; }
  .followup-tag-manage-row > button { margin-left: auto; }
}

/* Shared brand asset keeps its own rounded silhouette in both themes. */
.brand-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
