/* 运营后台浅色主题（按 Figma「03 后台管理」重设计稿）：页面底浅灰、白色卡片、深色侧栏、品牌蓝。 */
:root {
  /* ===== Figma 设计令牌（变量名与 Figma code syntax 一致，三端共用） ===== */
  /* 背景 */
  --color-bg-page: #f0f2f5;
  --color-bg-surface: #ffffff;
  --color-bg-subtle: #f7f8fa;
  --color-bg-hover: #f0f2f5;
  --color-bg-brand: #2f6bff;
  --color-bg-brand-soft: #eef3ff;
  --color-bg-danger: #ef4444;
  --color-bg-danger-soft: #fee2e2;
  --color-bg-success-soft: #dcfce7;
  --color-bg-warning-soft: #ffedd5;
  --color-bg-bubble-mine: #dcebff;
  --color-bg-bubble-theirs: #ffffff;
  --color-bg-sidebar: #0b1220;
  /* 文字 */
  --color-text-primary: #111827;
  --color-text-secondary: #6b7280;
  --color-text-tertiary: #9ca3af;
  --color-text-inverse: #ffffff;
  --color-text-brand: #2f6bff;
  --color-text-danger: #dc2626;
  --color-text-success: #15803d;
  --color-text-warning: #ea580c;
  --color-text-on-sidebar: #d1d5db;
  /* 边框 / 图标 / 状态 */
  --color-border-default: #e5e7eb;
  --color-border-strong: #d1d5db;
  --color-icon-default: #6b7280;
  --color-icon-brand: #2f6bff;
  --color-status-danger: #ef4444;
  --color-status-online: #16a34a;
  --color-status-warning: #f97316;
  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;
  /* 间距（4/8 栅格） */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --spacing-2xl: 24px;
  --spacing-3xl: 32px;
  /* 阴影 */
  --shadow-card: 0 1px 3px rgba(15, 23, 41, 0.06), 0 4px 12px rgba(15, 23, 41, 0.04);
  --shadow-pop: 0 8px 12px rgba(15, 23, 41, 0.12), 0 2px 4px rgba(15, 23, 41, 0.06);
  /* 字体：稿子用 Noto Sans SC，实现映射 PingFang SC */
  --font-family-base: 'PingFang SC', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Microsoft YaHei', sans-serif;

  /* ===== 旧变量：全部改为引用上面的令牌，既有样式无需逐条改名 ===== */
  --bg: var(--color-bg-page);
  --bg2: var(--color-bg-subtle);
  --panel: var(--color-bg-surface);
  --panel-strong: var(--color-bg-surface);
  --ink: var(--color-text-primary);
  --muted: var(--color-text-secondary);
  --line: var(--color-border-default);
  --line-strong: var(--color-border-strong);
  --brand: var(--color-bg-brand);
  --brand2: #4f82ff;
  --brand-dark: #1f56e0;
  --brand-soft: var(--color-bg-brand-soft);
  --danger: var(--color-bg-danger);
  --danger-soft: var(--color-bg-danger-soft);
  --warn: var(--color-status-warning);
  --warn-soft: var(--color-bg-warning-soft);
  --good: var(--color-status-online);
  --good-soft: var(--color-bg-success-soft);
  --shadow: var(--shadow-card);
  --radius: var(--radius-md);
  --sidebar-bg: var(--color-bg-sidebar);
  --sidebar-ink: var(--color-text-on-sidebar);
  --sidebar-active: var(--color-bg-brand);
  --topbar-height: 56px;
  /* 分页组件使用的别名变量 */
  --text: var(--ink);
  --text-muted: var(--muted);
  --surface-hover: var(--color-bg-hover);
  --border: var(--line);
  --accent: var(--brand);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-family-base);
  font-size: 14px;
  line-height: 22px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
code { font-size: 12.5px; }

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--sidebar-bg);
  color: white;
  height: 100vh;
  overflow-y: auto;
  padding: 16px 12px;
  position: sticky;
  top: 0;
}
/* 侧栏可滚动但隐藏滚动条（按稿，避免深色侧栏右侧露出灰色滚动条） */
.sidebar { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar::-webkit-scrollbar { display: none; height: 0; width: 0; }
/* 品牌区：32px 圆角 Logo + 产品名（14/500）+「管理后台」小字（11/500，70% 透明） */
.brand {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  padding: 4px 8px;
}
.brand span, .login-mark {
  align-items: center;
  background: var(--color-bg-brand);
  border-radius: var(--radius-md);
  color: var(--color-text-inverse);
  display: inline-flex;
  font-weight: 500;
  height: 32px;
  justify-content: center;
  width: 32px;
}
.brand-logo {
  background: rgba(255,255,255,0.96);
  border-radius: var(--radius-md);
  display: block;
  flex: 0 0 auto;
  height: 32px;
  object-fit: cover;
  width: 32px;
}
.brand-text {
  display: grid;
  min-width: 0;
}
.brand strong {
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand small {
  color: var(--color-text-on-sidebar);
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
  opacity: .7;
}
.logo-mark {
  background: rgba(255,255,255,0.96);
  object-fit: cover;
}

.mobile-topbar { display: none; }
.mobile-brand {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}
.mobile-brand strong {
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-menu { position: relative; }
.mobile-menu[open] {
  z-index: 1200;
}
.mobile-menu summary {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  list-style: none;
  min-height: 40px;
  min-width: 40px;
  padding: 0;
}
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu summary span {
  background: var(--ink);
  border-radius: 999px;
  display: block;
  height: 2px;
  width: 18px;
}
.mobile-menu-sheet {
  background: var(--sidebar-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  color: white;
  margin-top: 10px;
  padding: 14px;
  position: absolute;
  right: 0;
  top: 100%;
  width: min(320px, calc(100vw - 24px));
  z-index: 50;
}
.mobile-menu[open] .mobile-menu-sheet {
  -webkit-overflow-scrolling: touch;
  max-height: calc(100dvh - 82px);
  overscroll-behavior: contain;
  overflow-y: auto;
  z-index: 1201;
}
.mobile-menu-head { margin-bottom: 12px; }
.mobile-menu-actions { margin-top: 14px; }
.mobile-menu-actions form { margin: 0; }
.mobile-menu-actions button { width: 100%; }
.mobile-nav { margin-top: 8px; }
.mobile-nav a { color: var(--sidebar-ink); }

/* 语言选择：顶栏 / 登录页为浅色；侧栏（移动端抽屉）为深色 */
.language-form {
  margin: 0;
}
.language-form label {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr);
  letter-spacing: 0;
  text-transform: none;
}
.language-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.language-form select {
  appearance: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) calc(50% - 2px),
    calc(100% - 10px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: none;
  color: var(--ink);
  margin: 0;
  min-height: 32px;
  padding: 4px 30px 4px 10px;
  width: auto;
}
.language-form option { color: var(--ink); }
.language-form--sidebar {
  margin-bottom: 14px;
}
.language-form--sidebar label {
  grid-template-columns: 1fr;
}
.language-form--sidebar label span { color: var(--sidebar-ink); }
.language-form--sidebar select {
  background-color: rgba(255, 255, 255, 0.06);
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.72) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72) 50%, transparent 50%);
  border-color: rgba(255, 255, 255, 0.16);
  color: white;
  min-height: 38px;
  width: 100%;
}
.language-form--login {
  margin: 0;
}
.language-form--login label {
  grid-template-columns: 1fr;
  justify-items: end;
}
.language-form--login label span {
  display: none;
}
.language-form--login select {
  min-width: 130px;
}
.language-form--topbar label span { display: none; }
.language-form--topbar label { grid-template-columns: 1fr; }

/* 侧栏导航：分组小标题 + 图标 + 当前项蓝色高亮条 */
.nav {
  display: grid;
  gap: 2px;
}
.nav-group { display: grid; gap: 2px; }
.nav-group + .nav-group { margin-top: 12px; }
.nav-group-title {
  color: var(--color-text-on-sidebar);
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
  opacity: .55;
  padding: 8px 12px 4px;
}
.nav a {
  align-items: center;
  border-radius: var(--radius-md);
  color: var(--sidebar-ink);
  display: flex;
  font-size: 14px;
  font-weight: 400;
  gap: 10px;
  line-height: 22px;
  min-height: 34px;
  padding: 6px 12px;
  transition: background-color .15s ease, color .15s ease;
}
.nav a svg {
  color: inherit;
  flex: 0 0 auto;
  height: 18px;
  opacity: .9;
  width: 18px;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}
.nav a.active {
  background: var(--sidebar-active);
  color: white;
}
.nav a.active svg { opacity: 1; }

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.content-body {
  padding: 20px 24px 32px;
}

/* 桌面顶栏：页面标题 + 语言选择 + 退出登录 */
.topbar {
  align-items: center;
  background: var(--color-bg-surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}
.topbar-title strong {
  font-size: 18px;
  font-weight: 500;
  line-height: 26px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
}
.topbar-actions form { margin: 0; }
/* 管理员：24px 首字头像 + 用户名 */
.topbar-admin {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
}
.topbar-actions button {
  min-height: 36px;
  padding: 4px 12px;
}

/* 首字头像：圆角 30%，浅蓝底、品牌蓝字 */
.avatar {
  align-items: center;
  background: var(--color-bg-brand-soft);
  border-radius: 30%;
  color: var(--color-text-brand);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  height: 32px;
  justify-content: center;
  line-height: 1;
  width: 32px;
}
.avatar-xs { height: 24px; width: 24px; }
.avatar-lg { font-size: 16px; height: 48px; width: 48px; }
.avatar-xl { font-size: 22px; font-weight: 700; height: 64px; width: 64px; }
.avatar-square { border-radius: var(--radius-md); }

.hero {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  margin: 0 0 2px;
}
.hero p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
  max-width: 820px;
}
.hero-actions, .actions, .row-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}
.live-grid .metric-card {
  background: var(--panel);
}
.metric-card, .panel, .glass {
  background: var(--panel);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.metric-card {
  min-height: 0;
  padding: 20px;
}

/* 仪表盘指标卡（按稿）：标签 13 + 右侧 32px 图标底、数值 28/700、下方一行 12px 说明 */
.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}
.stat-card {
  background: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 20px;
}
.stat-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.stat-label {
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 18px;
}
.stat-icon {
  align-items: center;
  background: var(--color-bg-brand-soft);
  border-radius: var(--radius-sm);
  color: var(--color-icon-brand);
  display: inline-flex;
  flex: 0 0 auto;
  height: 32px;
  justify-content: center;
  width: 32px;
}
.stat-icon svg { height: 18px; width: 18px; }
.stat-icon.success { background: var(--color-bg-success-soft); color: var(--color-text-success); }
.stat-icon.warning { background: var(--color-bg-warning-soft); color: var(--color-text-warning); }
.stat-icon.danger { background: var(--color-bg-danger-soft); color: var(--color-text-danger); }
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 36px;
  overflow-wrap: anywhere;
}
.stat-delta {
  align-items: center;
  color: var(--color-text-tertiary);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 6px;
  line-height: 16px;
}
.stat-delta strong {
  color: var(--color-text-success);
  font-weight: 500;
}
.stat-delta strong.warning { color: var(--color-text-warning); }
.stat-delta strong.danger { color: var(--color-text-danger); }
.stat-delta strong.neutral { color: var(--color-text-secondary); }

/* 仪表盘第二行：左侧趋势图卡（自适应）+ 右侧 360px 列表卡 */
.dash-main-grid {
  align-items: stretch;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 360px;
  margin-bottom: 16px;
}
.chart-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 0;
  padding: 20px;
}
.chart-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}
.chart-head h2 {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  margin: 0;
}
.chart-head p {
  color: var(--color-text-tertiary);
  font-size: 12px;
  line-height: 16px;
  margin: 2px 0 0;
}
.chart-legend {
  align-items: center;
  color: var(--color-text-secondary);
  display: flex;
  flex: 0 0 auto;
  font-size: 12px;
  gap: 16px;
}
.chart-legend i {
  background: var(--color-bg-brand);
  border-radius: var(--radius-full);
  display: inline-block;
  height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
  width: 10px;
}
.chart-range {
  align-items: center;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  display: inline-flex;
  font-size: 12px;
  gap: 4px;
  height: 28px;
  padding: 0 8px 0 10px;
}
.chart-svg {
  display: block;
  height: auto;
  min-height: 220px;
  width: 100%;
}
.chart-svg text {
  fill: var(--color-text-tertiary);
  font-family: var(--font-family-base);
  font-size: 12px;
}
.chart-svg .chart-grid { stroke: var(--color-border-default); stroke-width: 1; }
.chart-svg .chart-area { fill: var(--color-bg-brand-soft); }
.chart-svg .chart-line { fill: none; stroke: var(--color-bg-brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .chart-dot { fill: var(--color-bg-surface); stroke: var(--color-bg-brand); stroke-width: 2; }
.chart-svg .chart-bar { fill: var(--color-bg-brand); }
.chart-svg .chart-bar-label { fill: var(--color-text-secondary); }
.chart-svg .chart-empty-title { fill: var(--color-text-secondary); font-size: 14px; }
.chart-svg .chart-empty-note { fill: var(--color-text-tertiary); }
.side-card { margin-bottom: 0; }
.side-card .panel-head { border-bottom: 0; padding-bottom: 4px; }
.side-card .panel-head a {
  color: var(--color-text-brand);
  font-size: 13px;
  font-weight: 400;
}
.side-card table { min-width: 0; }
.side-card th { display: none; }
.side-card td { padding: 12px 20px; }
.metric-combo {
  display: grid;
  gap: 10px;
}
.metric-combo-item + .metric-combo-item {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.metric-value {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.15;
  margin-top: 6px;
}
.metric-triplet {
  display: grid;
  gap: 10px;
}
.metric-triplet-labels,
.metric-triplet-values {
  column-gap: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.metric-triplet-labels span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-transform: none;
}
.metric-triplet-values strong {
  display: block;
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.15;
}
.metric-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  margin-top: 6px;
}

.user-metric-grid {
  gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.user-metric-grid .metric-card {
  min-height: 0;
  padding: 10px 12px;
}

.user-metric-grid .metric-label {
  font-size: 11px;
  letter-spacing: 0;
}

.user-metric-grid .metric-value {
  font-size: clamp(16px, 1.7vw, 22px);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.user-metric-grid .metric-note {
  font-size: 11px;
  line-height: 1.3;
  margin-top: 4px;
}

.dash-grid, .detail-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.user-primary-grid {
  align-items: start;
  grid-template-columns: 1fr;
}

/* 详情页两列：主列自适应 + 侧列 400px（用户详情侧列在右，群组详情设置列在左） */
.detail-cols {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 400px;
}
.detail-cols--aside-left {
  grid-template-columns: 400px minmax(0, 1fr);
}
.detail-col {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.detail-col > .panel, .detail-col > .metric-grid { margin-bottom: 0; }
.detail-col .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* 面包屑：上级链接品牌蓝 + 箭头 + 当前名称 */
.breadcrumb {
  align-items: center;
  color: var(--color-text-secondary);
  display: flex;
  font-size: 13px;
  gap: 6px;
  line-height: 18px;
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--color-text-brand); }
.breadcrumb svg { color: var(--color-text-tertiary); height: 14px; width: 14px; }
.breadcrumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 实体头卡（用户 / 群组详情顶部）：大头像 + 名称与标签 + 一行摘要 + 右侧操作按钮 */
.entity-header {
  align-items: center;
  background: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 20px;
}
.entity-header-info {
  display: grid;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
}
.entity-header-name {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.entity-header-name h1 {
  font-size: 22px;
  font-weight: 700;
  line-height: 30px;
  margin: 0;
  overflow-wrap: anywhere;
}
.entity-header-name .pill { margin: 0; }
.entity-header-meta {
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 18px;
  overflow-wrap: anywhere;
}
.entity-header-meta code { font-size: 12px; }
.entity-header-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.entity-header-actions form { margin: 0; }

/* 开关（按稿 44×26）：复用 checkbox，纯 CSS 外观 */
.switch-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 6px 0;
}
.switch-row .switch-text {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}
.switch-row .switch-text strong {
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
}
.switch-row .switch-text small {
  color: var(--color-text-tertiary);
  font-size: 12px;
  line-height: 16px;
}
.switch-row input[type="checkbox"] {
  appearance: none;
  background: var(--color-border-strong);
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  flex: 0 0 auto;
  height: 26px;
  margin: 0;
  min-height: 0;
  padding: 0;
  position: relative;
  transition: background-color .15s ease;
  width: 44px;
}
.switch-row input[type="checkbox"]::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(15, 23, 41, 0.2);
  content: '';
  height: 22px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform .15s ease;
  width: 22px;
}
.switch-row input[type="checkbox"]:checked { background: var(--color-bg-brand); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(18px); }
.switch-row input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.24); }
.form-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 8px;
}
.form-foot form { margin: 0; }

.user-modal-grid {
  gap: 8px;
  grid-template-columns: 1fr;
  padding: 0 20px 20px;
}

.modal-card-button {
  min-width: 0;
}

/* 详情页入口卡：白底列表项，标题 + 右侧灰色计数 + 箭头，点击打开弹窗 */
.modal-card-trigger {
  align-items: center;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: none;
  color: var(--ink);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 14px;
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease;
  width: 100%;
}
.modal-card-trigger:hover {
  background: var(--color-bg-subtle);
  border-color: var(--color-border-strong);
}
.modal-card-trigger span {
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
  min-width: 0;
}
.modal-card-trigger strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-card-trigger::after {
  border-color: var(--color-text-tertiary);
  border-style: solid;
  border-width: 0 1.5px 1.5px 0;
  content: '';
  flex: 0 0 auto;
  height: 6px;
  transform: rotate(-45deg);
  width: 6px;
}
.panel {
  margin-bottom: 16px;
  min-width: 0;
  overflow: hidden;
}
.panel-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 14px 20px;
}
.panel-head h2 {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  margin: 0;
}
.panel h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 16px 8px;
}
.empty {
  color: var(--muted);
  font-weight: 400;
  padding: 24px 16px;
  text-align: center;
}
.subtle {
  color: var(--muted);
  font-weight: 400;
}

.toolbar {
  align-items: center;
  background: var(--panel);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
}
.toolbar label {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 400;
  gap: 8px;
  white-space: nowrap;
}
.toolbar label:first-child { flex: 1 1 260px; }
.toolbar label:first-child input { min-width: 0; width: 100%; }
.toolbar label input, .toolbar label select { width: auto; }
.toolbar select,
.toolbar input {
  min-height: 36px;
}
.toolbar button { min-height: 36px; }
.toolbar select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 32px;
}
label {
  color: var(--ink);
  display: grid;
  font-size: 13px;
  font-weight: 500;
  gap: 6px;
  letter-spacing: 0;
  text-transform: none;
}
.check {
  align-items: center;
  display: flex;
  gap: 8px;
  letter-spacing: 0;
  text-transform: none;
}
.check input { width: auto; }
input, select, textarea {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--ink);
  min-height: 40px;
  outline: none;
  padding: 8px 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}
input[type="checkbox"], input[type="radio"] { min-height: 0; }
input::placeholder, textarea::placeholder { color: var(--color-text-tertiary); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.16);
}
.inline-form, .stack {
  display: grid;
  gap: 12px;
  padding: 20px;
}
.inline-form {
  align-items: end;
  grid-template-columns: minmax(0, 1fr) auto;
}

.kv {
  align-items: center;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}

.kv span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
}

dialog.admin-modal {
  background: transparent;
  border: 0;
  color: var(--ink);
  max-width: min(460px, calc(100vw - 28px));
  padding: 0;
  width: 100%;
}

dialog.admin-modal-wide {
  max-width: min(1120px, calc(100vw - 28px));
}

dialog.admin-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.admin-modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  display: grid;
  gap: 14px;
  padding: 18px;
}

.admin-modal-wide .admin-modal-card {
  max-height: min(82vh, 820px);
}

.admin-modal-head {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}
.admin-modal-head h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-modal-head .actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.admin-modal-body {
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 14px;
  max-height: calc(min(82vh, 820px) - 82px);
  overflow: auto;
  overscroll-behavior: contain;
}

/* 管理员新增 / 编辑弹窗：基本信息两列，权限为“栏目 × 无权限 / 只读 / 可编辑”单选矩阵 */
.admin-user-modal {
  max-width: min(640px, calc(100vw - 28px));
}
.admin-user-modal .admin-modal-card {
  max-height: min(90dvh, 920px);
}
.admin-user-modal .admin-modal-body {
  max-height: calc(min(90dvh, 920px) - 140px);
}
.admin-modal-foot {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-top: 14px;
}
.admin-modal-foot .actions { gap: 8px; }
.admin-form-grid {
  align-items: end;
  display: grid;
  gap: 12px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.admin-form-active { min-height: 40px; }
.permission-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  /* 弹窗内容区是限高的 grid：overflow:hidden 会让这一块被压到可用高度并裁掉下面的栏目，
     这里固定按内容高度排，超出部分交给弹窗内容区自己滚动 */
  min-height: max-content;
  overflow: hidden;
}
.permission-block-head {
  align-items: center;
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  padding: 10px 14px;
}
.permission-quick { display: flex; flex-wrap: wrap; gap: 6px; }
table.permission-matrix {
  min-width: 0;
  table-layout: fixed;
}
.permission-matrix th,
.permission-matrix td {
  padding: 8px 14px;
  text-align: center;
}
.permission-matrix thead th {
  background: var(--color-bg-surface);
  height: 36px;
}
.permission-matrix thead th:first-child,
.permission-matrix tbody th {
  text-align: left;
  width: 46%;
}
.permission-matrix tbody th {
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  height: auto;
  line-height: 20px;
  white-space: normal;
}
.permission-matrix tbody tr:hover td,
.permission-matrix tbody tr:hover th { background: var(--color-bg-hover); }
.permission-hint {
  color: var(--color-text-tertiary);
  display: block;
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  margin-top: 2px;
}
.permission-choice {
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  padding: 4px;
}
.permission-choice input {
  accent-color: var(--brand);
  cursor: pointer;
  height: 16px;
  margin: 0;
  width: 16px;
}
/* 管理员列表：权限按“可编辑 / 只读”两行汇总 */
.permission-summary { display: grid; gap: 6px; }
.permission-summary-line {
  align-items: baseline;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr);
  line-height: 20px;
}
.permission-summary-line .pill { white-space: nowrap; }
.permission-name { white-space: nowrap; }
.admin-user-cell { display: grid; gap: 4px; }
.admin-status-cell { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-users-table .nowrap { white-space: nowrap; }
@media (max-width: 640px) {
  .admin-form-grid { grid-template-columns: 1fr; }
}

.subdomain-edit-modal {
  max-width: min(620px, calc(100vw - 28px));
}

.subdomain-edit-modal .admin-modal-card {
  max-height: min(88dvh, 900px);
}

.subdomain-edit-body {
  max-height: calc(min(88dvh, 900px) - 72px);
}

.subdomain-edit-form .stack {
  padding: 2px;
}

.subdomain-danger-zone {
  align-items: center;
  background: var(--danger-soft);
  border: 1px solid #ffccc7;
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.subdomain-danger-zone p {
  line-height: 1.4;
  margin: 5px 0 0;
}

.danger-note {
  background: var(--danger-soft);
  border: 1px solid #ffccc7;
  border-radius: 8px;
  color: #a8071a;
  line-height: 1.5;
  margin: 0;
  padding: 12px;
}

.suspension-device-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  max-height: 260px;
  overflow: auto;
}

.suspension-device-choice {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 11px 12px;
}

.suspension-device-choice + .suspension-device-choice {
  border-top: 1px solid var(--line);
}

.suspension-device-choice small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.admin-tabs {
  display: grid;
  gap: 12px;
}

.admin-tab-list {
  background: var(--panel);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.admin-tab-label {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
}

.admin-tab-label:hover {
  border-color: var(--brand2);
  color: var(--brand);
}

.admin-tab-label.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.admin-tab-input {
  display: none;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-input:checked + .admin-tab-panel {
  display: grid;
  gap: 12px;
}

/* 按钮：主按钮蓝色实心，次按钮白底描边，危险按钮红色 */
.btn, button {
  appearance: none;
  background: var(--color-bg-brand);
  border: 1px solid var(--color-bg-brand);
  border-radius: var(--radius-md);
  color: var(--color-text-inverse);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 500;
  justify-content: center;
  align-items: center;
  line-height: 22px;
  min-height: 36px;
  padding: 6px 16px;
  text-align: center;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover, button:hover {
  background: var(--brand2);
  border-color: var(--brand2);
}
.btn.secondary, button.secondary {
  background: var(--color-bg-surface);
  border-color: var(--color-border-default);
  color: var(--color-text-primary);
}
.btn.secondary:hover, button.secondary:hover {
  background: var(--color-bg-surface);
  border-color: var(--brand);
  color: var(--brand);
}
.btn.danger, button.danger {
  background: var(--color-bg-danger);
  border-color: var(--color-bg-danger);
  color: #fff;
}
.btn.danger:hover, button.danger:hover {
  background: #f05252;
  border-color: #f05252;
}
button.small, .btn.small {
  font-size: 12px;
  line-height: 16px;
  min-height: 28px;
  padding: 4px 12px;
}

button.modal-card-trigger {
  display: flex;
  min-height: 48px;
  text-align: left;
}

button.modal-close {
  align-items: center;
  border-radius: 6px;
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
  min-height: 30px;
  min-width: 30px;
  padding: 4px 8px;
}

/* 表格：白底、浅灰表头、行悬停 */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap:has(.row-menu[open]) {
  overflow: visible;
}
.mobile-only {
  display: none;
}
.users-period-cell {
  min-width: 190px;
  white-space: normal;
}
.users-period-cell .users-stat-part {
  display: inline-flex;
  gap: 3px;
  white-space: nowrap;
}
table {
  background: var(--color-bg-surface);
  border-collapse: collapse;
  min-width: 920px;
  width: 100%;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
}
th {
  background: var(--color-bg-subtle);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  height: 44px;
  letter-spacing: 0;
  line-height: 16px;
  text-transform: none;
  white-space: nowrap;
}
td { font-size: 14px; line-height: 22px; }
td, th {
  overflow-wrap: anywhere;
}
tbody tr:hover td { background: var(--color-bg-hover); }
tbody tr:last-child td { border-bottom: 0; }
.link-button {
  background: transparent;
  border: 0;
  color: var(--brand);
  cursor: pointer;
  min-height: 0;
  padding: 0;
  text-align: left;
}
.link-button:hover { background: transparent; color: var(--brand2); }
.link-primary {
  color: var(--brand);
  font-weight: 500;
  white-space: nowrap;
}
.link-primary:hover { color: var(--brand2); }

.entity-link {
  display: grid;
  gap: 2px;
}
.entity-link strong { color: var(--brand); font-weight: 500; }
.entity-link:hover strong { color: var(--brand2); }
.entity-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

/* 状态徽标：圆角、彩色浅底 */
/* Tag：无边框、圆角 6、12/500；tone = brand / success / danger / warning / neutral */
.pill {
  background: var(--color-bg-brand-soft);
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text-brand);
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  margin: 2px;
  padding: 2px 8px;
  white-space: nowrap;
}
.pill.good { background: var(--color-bg-success-soft); color: var(--color-text-success); }
.pill.danger { background: var(--color-bg-danger-soft); color: var(--color-text-danger); }
.pill.warn { background: var(--color-bg-warning-soft); color: var(--color-text-warning); }
.pill.voice { background: #e0f7f4; color: #0f766e; }
.pill.video { background: #ede9fe; color: #5b21b6; }
.pill.soft { background: var(--color-bg-subtle); color: var(--color-text-secondary); }
.privacy-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 行内「更多…」下拉菜单（纯 CSS，details/summary） */
.row-menu {
  display: inline-block;
  position: relative;
}
.row-menu > summary {
  align-items: center;
  color: var(--brand);
  cursor: pointer;
  display: inline-flex;
  font-weight: 500;
  gap: 4px;
  list-style: none;
  user-select: none;
  white-space: nowrap;
}
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary::after {
  border-color: currentColor;
  border-style: solid;
  border-width: 0 1.5px 1.5px 0;
  content: '';
  display: inline-block;
  height: 5px;
  margin-top: -3px;
  transform: rotate(45deg);
  width: 5px;
}
.row-menu > summary:hover { color: var(--brand2); }
.row-menu-list {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  display: grid;
  gap: 2px;
  min-width: 240px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
}
.row-menu-list form { margin: 0; }
.row-menu-item,
.row-menu-list form button.row-menu-item {
  align-items: flex-start;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  font-weight: 400;
  gap: 2px;
  justify-content: stretch;
  line-height: 1.35;
  min-height: 0;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}
.row-menu-item strong {
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
}
.row-menu-item span {
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}
.row-menu-item:hover,
.row-menu-list form button.row-menu-item:hover {
  background: var(--color-bg-hover);
  border-color: transparent;
  color: var(--ink);
}
.row-menu-item.danger strong { color: var(--danger); }
.row-menu-list form button.row-menu-item.danger { background: transparent; }
.row-menu-list form button.row-menu-item.danger:hover { background: var(--danger-soft); }
.row-menu-divider {
  border-top: 1px solid var(--line);
  margin: 4px 0;
}
.link-danger { color: var(--color-text-danger); }
.users-actions-cell { white-space: nowrap; }
.row-actions-compact { flex-wrap: nowrap; gap: 12px; }

/* 键值行（按稿）：标签 140px 次要色、值主文字色、行高 36 */
.info-list {
  display: grid;
  gap: 2px;
  padding: 12px 20px 16px;
}
.info-row {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: 140px minmax(0, 1fr);
  min-height: 36px;
}
.info-row span:first-child {
  color: var(--muted);
  font-weight: 400;
}
.info-row strong { font-weight: 400; overflow-wrap: anywhere; }

.json {
  background: #f6f8fa;
  border-top: 1px solid var(--line);
  color: #1f2329;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  max-height: 520px;
  overflow: auto;
  padding: 16px;
}
.bars {
  display: grid;
  gap: 12px;
  padding: 16px;
}
.bar-row {
  display: grid;
  gap: 7px;
}
.bar-row div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}
.bar-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.bar-row i {
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  border-radius: 999px;
  display: block;
  height: 8px;
}
.load-cell {
  display: grid;
  gap: 7px;
  min-width: 120px;
}
.load-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.load-cell i {
  background: #eef0f3;
  border-radius: 999px;
  display: block;
  height: 8px;
  overflow: hidden;
}
.load-cell b {
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  display: block;
  height: 100%;
}
.call-cards {
  display: grid;
  gap: 10px;
  padding: 16px;
}
.call-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 12px;
}
.call-card strong { overflow-wrap: anywhere; }
.call-card span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.admin-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.admin-details summary {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-weight: 500;
  list-style: none;
  padding: 6px 12px;
}
.admin-details summary:hover { border-color: var(--brand); color: var(--brand); }
.admin-details summary::-webkit-details-marker { display: none; }
.admin-details form { margin-top: 12px; padding: 0; }

.check-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.check-row input {
  inline-size: auto;
}

/* 登录页（按稿）：页面底浅灰 + 两个装饰圆，居中 440px 白卡（圆角 20、内边距 40/40/32） */
.login {
  background: var(--color-bg-page);
  display: grid;
  min-height: 100vh;
  overflow: hidden;
  padding: 24px;
  place-items: center;
  position: relative;
}
.login-deco {
  background: var(--color-bg-brand-soft);
  border-radius: 50%;
  pointer-events: none;
  position: absolute;
}
.login-deco-1 { height: 520px; left: -200px; opacity: .9; top: -220px; width: 520px; }
.login-deco-2 { background: var(--color-bg-bubble-mine); height: 260px; left: 120px; opacity: .6; top: 80px; width: 260px; }
.login-shell {
  background: var(--color-bg-surface);
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 24px;
  max-width: 440px;
  padding: 40px 40px 32px;
  position: relative;
  width: min(440px, 100%);
  z-index: 1;
}
.login-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 0;
}
.login-brand .brand-logo {
  height: 44px;
  width: 44px;
}
.login-brand-text { display: grid; gap: 2px; min-width: 0; }
.login-brand-text strong {
  color: var(--color-text-primary);
  font-size: 22px;
  font-weight: 700;
  line-height: 30px;
}
.login-brand-text small {
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 18px;
}
/* 语言选择在卡片内作为第一组字段 */
.language-form--login label {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr;
  justify-items: stretch;
}
.language-form--login label span {
  color: var(--color-text-primary);
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}
.language-form--login select {
  background-color: var(--color-bg-surface);
  border-color: var(--color-border-default);
  border-radius: var(--radius-md);
  min-height: 40px;
  min-width: 0;
  padding: 8px 32px 8px 12px;
  width: 100%;
}
.login-card {
  background: transparent;
  display: grid;
  gap: 16px;
  max-width: none;
  padding: 0;
  width: 100%;
}
.login-card label {
  font-size: 14px;
  font-weight: 500;
  gap: 6px;
  line-height: 22px;
}
.login-card input {
  background: var(--color-bg-subtle);
  min-height: 40px;
}
.login-card input:focus { background: var(--color-bg-surface); }
.login-card button {
  font-size: 16px;
  line-height: 24px;
  margin-top: 8px;
  min-height: 44px;
  padding: 10px 20px;
}
.login-card .subtle {
  font-size: 13px;
  line-height: 18px;
  margin: 0;
}
.login-card-top h2 {
  font-size: 18px;
  font-weight: 500;
  line-height: 26px;
  margin: 0;
}
.eyebrow {
  color: var(--color-text-secondary);
  display: inline-flex;
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
}
.login-hint {
  align-items: center;
  color: var(--color-text-tertiary);
  display: flex;
  font-size: 12px;
  gap: 6px;
  justify-content: center;
  line-height: 16px;
  margin: 0;
}
.login-hint svg { height: 14px; width: 14px; }
.login-footer {
  bottom: 24px;
  color: var(--color-text-tertiary);
  font-size: 12px;
  left: 0;
  line-height: 16px;
  margin: 0;
  position: absolute;
  right: 0;
  text-align: center;
}
.notice {
  background: var(--color-bg-danger-soft);
  border: 0;
  border-radius: var(--radius-md);
  color: var(--color-text-danger);
  font-weight: 400;
  margin-bottom: 16px;
  padding: 10px 12px;
}
.login-card .notice, .stack .notice { margin-bottom: 0; }
.notice.success {
  background: var(--color-bg-success-soft);
  color: var(--color-text-success);
}
.copy-box {
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  padding: 12px;
}
.copy-box code {
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}
.compact-form {
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.permissions-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ops-note {
  background: var(--brand-soft);
  border: 1px solid #91caff;
  border-radius: 6px;
  color: var(--brand-dark);
  font-weight: 400;
  margin-bottom: 14px;
  padding: 12px 16px;
}

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid, .detail-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-main-grid, .detail-cols, .detail-cols--aside-left { grid-template-columns: 1fr; }
}

tbody tr.support-row-unread td {
  background: var(--warn-soft);
}
tbody tr.support-row-unread:hover td {
  background: #ffefd1;
}
.support-ticket-row {
  cursor: pointer;
}
.support-unread-badge {
  min-width: 34px;
  text-align: center;
}
.support-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}
.support-tabs a {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  font-weight: 500;
  gap: 8px;
  padding: 6px 12px;
}
.support-tabs a:hover { border-color: var(--brand); color: var(--brand); }
.support-tabs a.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}
.support-tabs span {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  font-size: 12px;
  min-width: 24px;
  padding: 1px 7px;
  text-align: center;
}
.support-detail-grid {
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.6fr);
}
.support-chat {
  display: grid;
  gap: 14px;
  max-height: min(68vh, 760px);
  overflow-y: auto;
  padding: 4px;
}
.support-message {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  max-width: min(760px, 92%);
  padding: 12px;
}
.support-message-user {
  background: #fafafa;
  justify-self: start;
}
.support-message-admin {
  background: var(--brand-soft);
  border-color: #91caff;
  justify-self: end;
}
.support-message-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 8px;
  justify-content: space-between;
}
.support-message-meta strong {
  color: var(--ink);
}
.support-message-text {
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}
.support-media-image,
.support-media-video {
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: block;
  max-height: 420px;
  max-width: 100%;
  object-fit: contain;
}
.support-media-link,
.support-file {
  display: block;
}
.support-file {
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.support-file span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}
.support-reply-form textarea {
  min-height: 130px;
}
.support-message-edit {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.support-message-edit summary {
  cursor: pointer;
  list-style: none;
  width: fit-content;
}
.support-message-edit summary::-webkit-details-marker {
  display: none;
}
.support-message-edit form {
  margin-top: 10px;
}
.support-message-edit textarea {
  min-height: 110px;
  width: 100%;
}

@media (max-width: 760px) {
  html:has(.mobile-menu[open]),
  body:has(.mobile-menu[open]) {
    overflow: hidden;
  }
  .mobile-topbar {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    left: 0;
    padding: 10px 12px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1200;
  }
  .mobile-topbar:has(.mobile-menu[open]) {
    align-items: flex-start;
    bottom: 0;
    display: block;
    min-height: 100dvh;
  }
  .mobile-topbar:has(.mobile-menu[open]) .mobile-brand {
    display: inline-flex;
    max-width: calc(100% - 58px);
  }
  .mobile-topbar:has(.mobile-menu[open]) .mobile-menu {
    position: absolute;
    right: 12px;
    top: 10px;
  }
  .mobile-menu[open] .mobile-menu-sheet {
    bottom: 12px;
    left: 12px;
    max-height: none;
    position: fixed;
    right: 12px;
    top: 64px;
    width: auto;
  }
  .mobile-menu-sheet .brand strong { color: #fff; }
  .shell {
    display: block;
    padding-top: 61px;
  }
  .sidebar { display: none; }
  .topbar { display: none; }
  .content-body { padding: 12px; }
  .brand { margin-bottom: 10px; }
  .brand strong { font-size: 16px; }
  .language-form--sidebar label {
    grid-template-columns: 1fr;
  }
  .hero {
    display: none;
  }
  .metric-grid { gap: 10px; grid-template-columns: 1fr; }
  .user-metric-grid {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .user-modal-grid {
    gap: 8px;
    grid-template-columns: 1fr;
    padding: 0 12px 12px;
  }
  .toolbar label { flex: 1 1 100%; }
  .toolbar label input, .toolbar label select { flex: 1 1 auto; width: auto; }
  .inline-form { grid-template-columns: 1fr; }
  .permissions-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 0; }
  .user-metric-grid .metric-card {
    min-height: 0;
    padding: 9px 10px;
  }
  .metric-value { font-size: 24px; overflow-wrap: anywhere; }
  .user-metric-grid .metric-value { font-size: 20px; }
  .metric-note { font-size: 11px; }
  .modal-card-trigger {
    gap: 5px;
    min-height: 58px;
    padding: 9px 10px;
  }
  .modal-card-trigger span {
    font-size: 12px;
    line-height: 1.15;
  }
  .modal-card-trigger strong {
    font-size: 10px;
    line-height: 1.15;
    white-space: normal;
  }
  .admin-modal-card {
    gap: 10px;
    padding: 12px;
  }
  dialog.subdomain-edit-modal {
    max-height: calc(100dvh - 18px);
    max-width: calc(100vw - 18px);
  }
  .subdomain-edit-modal .admin-modal-card {
    max-height: calc(100dvh - 18px);
  }
  .subdomain-edit-body {
    max-height: calc(100dvh - 86px);
  }
  .subdomain-danger-zone {
    align-items: stretch;
    grid-template-columns: 1fr;
  }
  .subdomain-danger-zone form,
  .subdomain-danger-zone button,
  .subdomain-edit-form button {
    width: 100%;
  }
  .admin-modal-head {
    align-items: start;
    gap: 8px;
  }
  .admin-modal-head h3 {
    font-size: 16px;
    line-height: 1.2;
  }
  .admin-modal-head .actions {
    display: flex;
    gap: 6px;
  }
  .admin-modal-head .actions > :not(.modal-close) {
    order: 2;
    width: 100%;
  }
  .admin-modal-head .modal-close {
    justify-self: end;
    order: 1;
  }
  dialog.admin-modal-wide {
    max-width: calc(100vw - 18px);
  }
  .metric-triplet-labels,
  .metric-triplet-values {
    column-gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .metric-triplet-labels span,
  .metric-triplet-values strong {
    text-align: left;
  }
  .panel-head {
    align-items: flex-start;
    display: grid;
  }
  .info-row { grid-template-columns: 1fr; }
  .row-actions { display: grid; }
  .row-actions form, .row-actions button { width: 100%; }
  .row-actions-compact { display: flex; }
  .row-actions-compact form, .row-actions-compact button { width: auto; }
  .row-menu-list { left: 0; right: auto; }
  .row-menu-list form button.row-menu-item { width: 100%; }
  .admin-modal-body .table-wrap {
    background: transparent;
    overflow: visible;
  }
  .admin-modal-body table {
    min-width: 0;
    width: 100%;
  }
  .admin-modal-body thead {
    display: none;
  }
  .admin-modal-body tbody,
  .admin-modal-body tr,
  .admin-modal-body td {
    display: block;
    width: 100%;
  }
  .admin-modal-body tr {
    background: #fafafa;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 8px;
  }
  .admin-modal-body td {
    background: transparent !important;
    border: 0;
    padding: 7px 6px;
    white-space: normal;
    word-break: break-word;
  }
  .admin-modal-body td + td {
    border-top: 1px solid var(--line);
  }
  .admin-modal-body td::before {
    color: var(--muted);
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    margin-bottom: 3px;
    text-transform: none;
  }
  .admin-modal-body td:not([data-label])::before {
    content: '';
    display: none;
  }
  body > .shell table {
    min-width: 700px;
  }
  body > .shell .table-wrap {
    background: linear-gradient(90deg, transparent 92%, rgba(15, 23, 42, .05));
    scroll-snap-type: x proximity;
  }
  body > .shell .admin-modal-body .table-wrap {
    background: transparent;
    overflow: visible;
    scroll-snap-type: none;
  }
  body > .shell .admin-modal-body table {
    min-width: 0;
    table-layout: fixed;
    width: 100%;
  }
  body > .shell .admin-modal-body td,
  body > .shell .admin-modal-body th {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
  }
  .users-table-wrap {
    background: transparent;
    overflow: visible;
    scroll-snap-type: none;
  }
  .users-card-table {
    background: transparent;
    min-width: 0;
    width: 100%;
  }
  body > .shell .users-card-table {
    min-width: 0;
    table-layout: fixed;
    width: 100%;
  }
  .users-card-table thead {
    display: none;
  }
  .users-card-table tbody,
  .users-card-table tr,
  .users-card-table td {
    display: block;
    width: 100%;
  }
  .users-card-table .users-desktop-cell {
    display: none;
  }
  .users-card-table .mobile-only {
    display: grid;
  }
  .users-card-table tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 0 0 10px;
    padding: 9px;
  }
  .users-card-table td {
    align-items: start;
    background: transparent !important;
    border: 0;
    display: grid;
    font-size: 12px;
    gap: 8px;
    grid-template-columns: minmax(62px, 22%) minmax(0, 1fr);
    line-height: 1.35;
    padding: 8px 6px;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
  }
  .users-card-table td > * {
    min-width: 0;
  }
  .users-card-table .entity-link {
    min-width: 0;
  }
  .users-card-table .entity-link strong,
  .users-card-table .entity-link span {
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
  }
  .users-card-table .users-stat-line {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 0 5px;
    line-height: 1.35;
  }
  .users-inline-status {
    margin-top: 6px;
  }
  .users-stat-part strong {
    font-weight: 600;
  }
  .users-stat-part {
    white-space: nowrap;
  }
  .users-stat-part span {
    color: #389e0d;
    font-weight: 600;
  }
  .users-card-table td + td {
    border-top: 1px solid var(--line);
  }
  .users-card-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.25;
    text-transform: none;
  }
  .users-card-table tr:hover td {
    background: transparent;
  }
  .users-card-table .users-actions-cell { white-space: normal; }
  body:has(dialog.admin-modal[open]) {
    overflow: hidden;
  }
  .login {
    align-items: start;
    padding: 14px 14px 48px;
  }
  .login-shell {
    gap: 20px;
    padding: 24px 20px;
  }
  .login-card-top {
    display: block;
  }
  .stat-grid { grid-template-columns: 1fr; }
  .entity-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }
  .entity-header-actions { justify-content: flex-start; }
  .detail-col .metric-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .user-modal-grid {
    grid-template-columns: 1fr;
  }
}

/* 侧栏底部管理员（按稿）：头像 + 用户名 / 角色 */
.sidebar-user {
  align-items: center;
  border-radius: var(--radius-md);
  color: #fff;
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding: 8px;
}
.sidebar-user .sidebar-user-text { display: grid; min-width: 0; }
.sidebar-user strong {
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user small {
  color: var(--color-text-on-sidebar);
  font-size: 12px;
  line-height: 16px;
  opacity: .7;
}
.sidebar {
  display: flex;
  flex-direction: column;
}
.sidebar .nav { flex: 1 1 auto; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--color-bg-surface);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-card);
}
/* 表格卡片后面紧跟分页时，卡片只保留上圆角并取消下边距，视觉上合为一张卡 */
.panel:has(+ .pagination),
.panel:has(+ script + .pagination) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  margin-bottom: 0;
}
.pagination-controls .btn.secondary {
  border-radius: var(--radius-sm);
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-controls .btn.secondary {
  padding: 4px 12px;
  font-size: 13px;
  min-height: 32px;
}

.pagination-controls .btn.secondary.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

.page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-decoration: none;
  color: var(--text, #1f2329);
  background: #fff;
  border: 1px solid var(--line);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

a.page-num:hover {
  background: var(--surface-hover, #f5f7fa);
  border-color: var(--brand);
  color: var(--brand);
}

.page-num.active {
  background: var(--color-bg-brand);
  border-color: var(--color-bg-brand);
  color: var(--color-text-inverse);
  font-weight: 500;
  cursor: default;
}

.pagination .ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 32px;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
  user-select: none;
}

@media (max-width: 640px) {
  .pagination {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .pagination-controls {
    justify-content: center;
  }
}

/* ASAFChat：告警角标、谷歌验证码绑定、审计原文 */
.nav-badge {
  background: var(--danger);
  border-radius: 999px;
  color: white;
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  margin-left: auto;
  min-width: 18px;
  padding: 0 6px;
  text-align: center;
}
.nav-badge[hidden] { display: none; }
.totp-qr {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  justify-self: center;
  padding: 8px;
  width: 236px;
}
.totp-qr svg { display: block; height: auto; width: 100%; }
.totp-secret {
  display: block;
  font-size: 15px;
  letter-spacing: .08em;
  overflow-wrap: anywhere;
}
.audit-json {
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.audit-body {
  max-width: 420px;
  white-space: pre-wrap;
  word-break: break-word;
}
tr.alert-unread td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.alert-detail-item {
  display: inline-block;
  margin: 0 8px 4px 0;
  overflow-wrap: anywhere;
}
.help-steps {
  display: grid;
  gap: 8px;
  line-height: 1.5;
  margin: 0;
  padding: 16px 16px 16px 36px;
}

/* ===== Figma 对照后的补充精修 ===== */
/* 顶栏已显示页面标题，hero 只保留副标题与操作按钮，避免标题重复 */
.hero h1 { display: none; }
.hero { align-items: center; }
/* 顶栏语言选择：无边框、透明底（按稿） */
.language-form--topbar select {
  background-color: transparent;
  border-color: transparent;
  color: var(--muted);
  min-height: 36px;
}
.language-form--topbar select:hover { background-color: var(--color-bg-subtle); }
/* 用户列表：单元格不换行、横向滚动；操作列固定在右侧始终可见 */
.users-card-table td,
.users-card-table th {
  overflow-wrap: normal;
  white-space: nowrap;
}
.users-card-table .users-inline-status {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 2px;
}
.users-card-table .users-actions-cell,
.users-card-table th:last-child {
  background: var(--color-bg-surface);
  box-shadow: inset 1px 0 0 var(--color-border-default);
  position: sticky;
  right: 0;
  z-index: 1;
}
.users-card-table th:last-child { background: var(--color-bg-subtle); }
.users-card-table tbody tr:hover .users-actions-cell { background: var(--color-bg-hover); }
.table-wrap:has(.row-menu[open]) .users-actions-cell { position: static; }
/* 详情页侧列中的表格不强制最小宽度，改为自适应 */
.detail-col table, .side-card table { min-width: 0; }
/* 表格内的行操作按钮改为文字链接（按稿：品牌蓝 / 危险红） */
td .row-actions { flex-wrap: nowrap; gap: 12px; }
td .row-actions form { margin: 0; }
td .row-actions button.small,
td .row-actions .btn.small {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--color-text-brand);
  font-size: 14px;
  line-height: 22px;
  min-height: 0;
  padding: 0;
  white-space: nowrap;
}
td .row-actions button.small:hover,
td .row-actions .btn.small:hover { background: transparent; color: var(--brand2); }
td .row-actions button.small.secondary { color: var(--color-text-secondary); }
td .row-actions button.small.danger { color: var(--color-text-danger); }
td .row-actions button.small.danger:hover { color: #b91c1c; }
@media (max-width: 760px) {
  .users-card-table td, .users-card-table th { white-space: normal; }
  .users-card-table .users-actions-cell { box-shadow: none; position: static; }
}
/* 用户列：给足最小宽度，状态徽标与编号保持一行 */
.users-card-table td:first-child { min-width: 220px; }
.users-card-table .users-inline-status { flex-wrap: nowrap; }

/* ===== Figma 对齐（第二轮）：顶栏搜索 / 通知铃、群详情、用户列表与详情、仪表盘告警 ===== */
/* 顶栏：全局搜索框（240×36 浅灰圆角）+ 通知铃（未读角标）+ 退出登录图标按钮 */
.topbar-actions { gap: 16px; }
.topbar-search {
  align-items: center;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  color: var(--color-text-tertiary);
  display: flex;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  width: 240px;
}
.topbar-search svg { flex: 0 0 auto; height: 16px; width: 16px; }
.topbar-search input {
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 13px;
  min-height: 0;
  padding: 0;
}
.topbar-search input:focus { box-shadow: none; }
.topbar-actions .topbar-icon-btn,
.topbar-icon-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--color-icon-default);
  display: inline-flex;
  height: 36px;
  justify-content: center;
  min-height: 36px;
  padding: 0;
  position: relative;
  width: 36px;
}
.topbar-icon-btn:hover { background: var(--color-bg-subtle); color: var(--ink); }
.topbar-icon-btn svg { height: 20px; width: 20px; }
.topbar-badge {
  background: var(--color-status-danger);
  border: 2px solid var(--color-bg-surface);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 14px;
  min-width: 18px;
  padding: 0 4px;
  position: absolute;
  right: 0;
  text-align: center;
  top: 0;
}
.topbar-badge[hidden] { display: none; }
@media (max-width: 1100px) { .topbar-search { width: 180px; } }

/* 通用小元素 */
.avatar-sm { font-size: 12px; height: 24px; width: 24px; }
.meta-dot { color: var(--color-text-tertiary); margin: 0 6px; }
.subtle-strong { color: var(--ink); }
.cell-muted { color: var(--color-text-secondary); }
.link-muted { color: var(--color-text-secondary); font-size: 14px; }
.link-muted:hover { color: var(--ink); }
.link-primary { color: var(--color-text-brand); }
.member-cell { align-items: center; display: flex; gap: 8px; min-width: 0; }
.member-cell-text { display: grid; line-height: 20px; min-width: 0; }
.member-cell-text a { color: var(--ink); font-weight: 400; }
.member-cell-text a:hover { color: var(--color-text-brand); }
.member-cell-text small { color: var(--color-text-tertiary); font-size: 12px; line-height: 16px; }
.member-alias { display: block; font-size: 12px; margin-left: 32px; }
.btn-pair { display: flex; gap: 8px; }
.btn-pair form { margin: 0; }
.panel-head-actions { align-items: center; display: flex; gap: 8px; margin-left: auto; }
.panel-head-actions button.small { min-height: 28px; }
.search-input { display: block; position: relative; }
.search-input input {
  background: var(--color-bg-subtle) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l5 5'/%3E%3C/svg%3E") no-repeat 10px center;
  border-color: transparent;
  min-height: 32px;
  padding: 4px 12px 4px 32px;
}
.panel-head-actions .search-input input { font-size: 13px; width: 200px; }

/* 群详情：成员表 / 待确认邀请 / 群二维码 */
.members-panel td { padding-bottom: 8px; padding-top: 8px; }
.members-panel .row-actions { align-items: center; }
.members-panel .row-menu > summary { color: var(--color-text-brand); font-weight: 400; }
.members-panel .row-menu-list { min-width: 140px; }
.detail-col .table-wrap:has(.row-menu[open]),
.panel:has(.row-menu[open]) { overflow: visible; }
.group-qr-body { justify-items: center; text-align: center; }
.group-qr-body .copy-box { max-width: 100%; overflow-wrap: anywhere; }
.group-settings-form .form-foot button { min-width: 60px; }
.entity-header-meta { align-items: center; display: flex; flex-wrap: wrap; }

/* 用户列表（按稿）：工具栏下拉 + 导出 / 新建；表格行高 48；勾选列、对错号、在线点 */
.users-toolbar .toolbar-search { flex: 0 1 320px; }
.users-toolbar .toolbar-search input { background-color: var(--color-bg-surface); border-color: var(--color-border-default); min-height: 36px; width: 100%; }
.users-toolbar .inline-select {
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 14px;
  gap: 0;
  height: 36px;
  padding-left: 12px;
}
.users-toolbar .inline-select select { border: 0; box-shadow: none; min-height: 34px; padding-left: 4px; }
.users-toolbar .toolbar-spacer { flex: 1 1 auto; }
.users-panel .table-wrap { border-radius: var(--radius-lg); }
.users-table-v2 td { height: 48px; padding-bottom: 6px; padding-top: 6px; }
.users-table-v2 .col-check { padding-right: 0; width: 40px; }
.users-table-v2 .col-check input { height: 16px; width: 16px; }
.users-table-v2 td:first-child { min-width: 0; }
.users-table-v2 td:nth-child(2) { min-width: 180px; }
.users-table-v2 .row-menu > summary { color: var(--color-text-secondary); font-weight: 400; }
.mark-yes { color: var(--color-status-online); font-weight: 600; }
.mark-no { color: var(--color-text-tertiary); }
.online-dot { background: var(--color-border-strong); border-radius: 50%; display: inline-block; height: 8px; width: 8px; }
.online-dot.on { background: var(--color-status-online); }

/* 仪表盘：最近告警列表 + 趋势图峰值气泡 */
.recent-alerts { display: grid; gap: 0; list-style: none; margin: 0; padding: 4px 20px 16px; }
.recent-alerts li { align-items: flex-start; display: flex; gap: 12px; padding: 10px 0; }
.recent-alerts li + li { border-top: 1px solid var(--color-border-default); }
.recent-alerts .alert-dot { background: var(--color-status-warning); border-radius: 50%; flex: 0 0 auto; height: 8px; margin-top: 7px; width: 8px; }
.recent-alerts .alert-dot.danger { background: var(--color-status-danger); }
.recent-alerts .alert-dot.soft { background: var(--color-text-secondary); }
.recent-alert-text { display: grid; flex: 1 1 auto; min-width: 0; }
.recent-alert-text strong { font-size: 14px; font-weight: 500; line-height: 22px; }
.recent-alert-text small { color: var(--color-text-tertiary); font-size: 12px; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-alerts .pill { flex: 0 0 auto; }
.chart-svg .chart-tip rect { fill: #111827; }
.chart-svg .chart-tip text { fill: #fff; font-size: 12px; }

/* 用户详情：所在群组列表 / 操作日志时间线 / 权限卡 / 头部「更多」菜单 */
.entity-list { display: grid; list-style: none; margin: 0; padding: 4px 20px 12px; }
.entity-list li { align-items: center; display: flex; gap: 12px; padding: 10px 0; }
.entity-list-text { display: grid; flex: 1 1 auto; min-width: 0; }
.entity-list-text a { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-list-text a:hover { color: var(--color-text-brand); }
.entity-list-text small { color: var(--color-text-tertiary); font-size: 12px; line-height: 18px; }
.timeline { list-style: none; margin: 0; padding: 8px 20px 16px; }
.timeline li { display: grid; padding: 0 0 16px 24px; position: relative; }
.timeline li::before {
  background: var(--color-border-strong);
  border-radius: 50%;
  content: '';
  height: 10px;
  left: 0;
  position: absolute;
  top: 6px;
  width: 10px;
}
.timeline li::after { background: var(--color-border-default); bottom: -6px; content: ''; left: 4px; position: absolute; top: 20px; width: 2px; }
.timeline li:last-child::after { display: none; }
.timeline li.first::before { background: var(--color-bg-brand); }
.timeline li.failed::before { background: var(--color-status-danger); }
.timeline strong { font-size: 14px; font-weight: 400; line-height: 22px; }
.timeline small { color: var(--color-text-tertiary); font-size: 12px; line-height: 18px; }
.permission-form .form-row { align-items: center; color: var(--color-text-secondary); font-weight: 400; grid-template-columns: 112px minmax(0, 280px); }
.header-menu > summary.btn::after { display: none; }
.header-menu > summary.btn { color: var(--ink); font-weight: 500; }
.entity-header-actions .row-menu-list { min-width: 220px; }
.entity-header:has(.row-menu[open]) { overflow: visible; position: relative; z-index: 25; }
/* 群成员 / 待确认邀请表：单元格不换行，宽度不够时横向滚动 */
.members-panel td, .members-panel th,
.detail-col .panel td .member-cell-text { white-space: nowrap; }
.members-panel table { min-width: 640px; }
.group-qr-body code { white-space: normal; word-break: break-all; }
/* 用户列表：服务器 / 排序 / 统计列开关收进「更多筛选」弹层，工具栏保持一行（按稿） */
.toolbar-more { position: relative; }
.toolbar-more > summary { list-style: none; }
.toolbar-more > summary::-webkit-details-marker { display: none; }
.toolbar-more-panel {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  display: grid;
  gap: 12px;
  left: 0;
  min-width: 280px;
  padding: 12px;
  position: absolute;
  top: calc(100% + 6px);
  z-index: 30;
}
.toolbar-more-panel label { justify-content: space-between; }
.users-toolbar { flex-wrap: nowrap; }
.users-toolbar .toolbar-search { flex: 1 1 240px; min-width: 160px; }
@media (max-width: 1100px) { .users-toolbar { flex-wrap: wrap; } }

/* 用户列表：账号类型（胶囊下拉）、可建群（小开关）可直接修改；勾选后显示批量操作条 */
.inline-flag-select {
  appearance: none;
  background-color: var(--color-bg-subtle);
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 13px) calc(50% - 1px),
    calc(100% - 9px) calc(50% - 1px);
  background-repeat: no-repeat;
  background-size: 4px 4px, 4px 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  min-height: 28px;
  padding: 4px 24px 4px 8px;
  width: auto;
}
.inline-flag-select.is-internal { background-color: var(--color-bg-brand-soft); color: var(--color-text-brand); }
.inline-flag-select:hover { border-color: var(--color-border-strong); }
.inline-flag-switch {
  appearance: none;
  background: var(--color-border-strong);
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  height: 20px;
  margin: 0;
  min-height: 0;
  padding: 0;
  position: relative;
  transition: background-color .15s ease;
  vertical-align: middle;
  width: 36px;
}
.inline-flag-switch::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(15, 23, 41, 0.2);
  content: '';
  height: 16px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform .15s ease;
  width: 16px;
}
.inline-flag-switch:checked { background: var(--color-bg-brand); }
.inline-flag-switch:checked::after { transform: translateX(16px); }
.inline-flag-switch:focus-visible { box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.24); }
.inline-flag-select:disabled, .inline-flag-switch:disabled { cursor: progress; opacity: .6; }
.users-bulk-bar {
  align-items: center;
  background: var(--color-bg-brand-soft);
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
}
.users-bulk-bar[hidden] { display: none; }
.users-bulk-count { color: var(--color-text-brand); font-size: 14px; font-weight: 500; margin-right: 8px; }
.users-bulk-bar .link-button { font-size: 12px; margin-left: auto; }
.users-card-table .inline-flag-select, .users-card-table .inline-flag-switch { justify-self: start; }
/* 管理员表单：选了角色时隐藏逐项权限表和提示切换 */
[data-role-permissions][hidden], [data-role-note][hidden] { display: none; }
/* 用户详情「修改邀请码」：风险提示醒目显示；邀请码本身和完整手机号一样清楚 */
.notice.invite-code-risk { font-weight: 600; }
.invite-code-value { font-size: 14px; font-weight: 600; letter-spacing: .5px; }
/* 用户详情「手机号」：号码与查看 / 解绑按钮同一行（form 不带默认内边距） */
.phone-detail { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.phone-detail form { display: inline-flex; margin: 0; padding: 0; }
.phone-detail .phone-full { font-size: 14px; font-weight: 600; letter-spacing: .5px; }
.users-toolbar .phone-key-hint { align-self: center; cursor: help; white-space: nowrap; }
/* 用户列表「按手机号查找」（仅超级管理员，POST 表单，与上方筛选栏分开） */
.toolbar.users-phone-lookup { padding-bottom: 12px; padding-top: 12px; }
.toolbar.users-phone-lookup label:first-child { flex: 0 1 auto; }
.toolbar.users-phone-lookup label:first-child input { width: 220px; }
/* 官方标签：浅蓝底 + 主题蓝字的小胶囊（沿用 .pill 的品牌色），不换行，超宽省略；列表里紧跟在名字后面 */
.pill.official-tag { border-radius: var(--radius-full); display: inline-block; flex: 0 1 auto; font-size: 11px; line-height: 16px; max-width: 12em; min-width: 0; overflow: hidden; padding: 0 6px; text-overflow: ellipsis; vertical-align: middle; }
.member-name-line { align-items: center; display: flex; gap: 6px; min-width: 0; }
.member-name-line > a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-name-line .pill.official-tag { margin: 0; }
/* 组织架构（代理层级）：树形表格的缩进与连接符、级别胶囊、用户列表「组织/归属」列、成员行里的交接表单 */
/* 组织架构首页：左边树（宽）、右边新增表单；窄屏上下排列 */
.detail-grid.agent-index-grid { align-items: start; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 1180px) { .detail-grid.agent-index-grid { grid-template-columns: 1fr; } }
table.agent-tree-table, table.agent-members-table { min-width: 560px; }
/* 组织架构里的信息提示（节点管理员的范围、成员只显示前 N 个）：浅蓝底，不是错误 */
.notice.agent-info-notice { background: var(--color-bg-brand-soft); color: var(--color-text-secondary); }
.notice.agent-info-notice strong { color: var(--color-text-primary); margin-left: 4px; }
.agent-tree-name { align-items: center; display: flex; gap: 6px; min-width: 0; }
.agent-tree-name a { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-tree-branch { color: var(--color-text-tertiary); flex: 0 0 auto; }
.pill.agent-level { white-space: nowrap; }
.pill.agent-level-1 { background: var(--color-bg-warning-soft); color: var(--color-text-warning); }
.pill.agent-level-2 { background: var(--color-bg-success-soft); color: var(--color-text-success); }
.pill.agent-level-5 { background: var(--color-bg-subtle); color: var(--color-text-secondary); }
.agent-path, .org-path { overflow-wrap: anywhere; }
.users-org-cell { max-width: 180px; }
.users-org-cell .org-path { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-org-cell .org-owner { display: inline; }
.users-org-cell small { display: block; }
.agent-member-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.agent-member-actions form { margin: 0; }
.agent-handover summary { cursor: pointer; }
.agent-handover form { margin-top: 8px; min-width: 220px; }
.org-forms { border-top: 1px solid var(--color-border-default); margin-top: 12px; padding-top: 12px; }
