/* ==========================================================================
   小蓝群管后台 · 样式表
   00 · Design tokens:下面的 :root 块原样取自 design/00-tokens.css(浅色,唯一强调色 --accent)
   ========================================================================== */
:root {
  /* 表面 */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --surface-3: #e8e8ed;
  --separator: rgba(60, 60, 67, .12);
  --separator-strong: rgba(60, 60, 67, .22);
  /* 文字 */
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --text-4: #aeaeb2;
  /* 强调色(唯一) */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-tint: rgba(0, 113, 227, .10);
  --accent-tint-strong: rgba(0, 113, 227, .18);
  --on-accent: #ffffff;
  /* 语义色 */
  --green: #34c759;  --green-text: #248a3d;  --green-tint: rgba(52, 199, 89, .12);
  --red: #ff3b30;    --red-text: #d70015;    --red-tint: rgba(255, 59, 48, .12);
  --orange: #ff9500; --orange-text: #c93400; --orange-tint: rgba(255, 149, 0, .14);
  --yellow: #ffcc00;
  --purple: #af52de; --purple-text: #8944ab; --purple-tint: rgba(175, 82, 222, .12);
  --teal: #30b0c7;
  --indigo-sys: #5856d6;
  --pink: #ff2d55;
  --mint: #00c7be;
  /* 图表系列色(已过 dataviz 校验器,槽序 蓝>绿>青>粉>紫>橙>靛>金) */
  --chart-1: #0071e3;
  --chart-2: #009035;
  --chart-3: #069db4;
  --chart-4: #ff375f;
  --chart-5: #af52de;
  --chart-6: #d47b00;
  --chart-7: #5856d6;
  --chart-8: #b48f00;
  --tooltip-bg: #ffffff;
  /* 材质与阴影 */
  --material-nav: rgba(255, 255, 255, .72);
  --hover-bg: rgba(0, 0, 0, .04);
  --active-bg: rgba(0, 0, 0, .07);
  --seg-track: rgba(120, 120, 128, .12);
  --seg-knob: #ffffff;
  --mask: rgba(0, 0, 0, .28);
  --shadow-card: 0 0 0 .5px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .04);
  --shadow-pop: 0 0 0 .5px rgba(0, 0, 0, .06), 0 12px 40px rgba(0, 0, 0, .14);
  --shadow-knob: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04);
  --focus-ring: 0 0 0 4px var(--accent-tint-strong);
  /* 圆角 */
  --radius-card: 18px;
  --radius-ctl: 10px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Inter", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* 动效 */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: 180ms;
  /* 布局 */
  --sidebar-w: 236px;
  --wrap-max: 1600px;
  /* ---- 旧 token 别名(app.js 模板里仍写死 var(--ink) / var(--muted) 等,必须保留) ---- */
  --ink: var(--text);
  --muted: var(--text-2);
  --line: var(--separator);
  --card: var(--surface);
  --indigo: var(--accent);
  --indigo-soft: var(--accent-tint);
  --radius: var(--radius-card);
  --shadow: var(--shadow-card);
}

/* ==========================================================================
   01 · 基础
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 88px; }   /* 规则页、群设置页的操作栏是吸顶的:键盘切换焦点时别把输入框藏到它下面 */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono, pre { font-family: var(--mono); }
code { font-size: .92em; background: var(--surface-2); border-radius: 5px; padding: 1px 5px; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, table, .kpi-value, .count { font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; }
.skip-link:focus {
  left: 12px; padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-pop);
}
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.text-bad { color: var(--red-text); }
.nowrap { white-space: nowrap; }

/* ==========================================================================
   02 · 布局:左侧栏(毛玻璃)+ 内容区
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: relative; z-index: 30;
  background: var(--material-nav);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-right: .5px solid var(--separator);
}
.sb-inner {
  position: sticky; top: 0;
  display: flex; flex-direction: column;
  height: 100vh;
  padding: 20px 12px 14px;
}
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent);
  font-size: 15px; font-weight: 600; line-height: 1;
}
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.menu-btn { display: none; }
.sb-label { padding: 0 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.sb-item:hover { background: var(--hover-bg); text-decoration: none; }
.sb-item .icon { flex: none; color: var(--text-2); }
.sb-item.is-active { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.sb-item.is-active .icon { color: var(--accent); }
.sb-foot {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  padding: 10px; font-size: 12px; color: var(--text-2);
}
.sb-foot-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot-state { margin-left: auto; color: var(--text-3); flex: none; }

.main { min-width: 0; padding: 0 40px 72px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: var(--wrap-max); padding: 30px 0 22px;
}
.tb-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.tb-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-2); }
.tb-user { display: flex; align-items: center; gap: 10px; flex: none; }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent);
  font-size: 13.5px; font-weight: 600;
}
.tb-user-text { display: flex; flex-direction: column; line-height: 1.25; }
.tb-user-name { font-size: 13.5px; font-weight: 600; }
.role { font-size: 11.5px; color: var(--text-2); }
.role-owner { color: var(--accent); }
.tb-logout { margin-left: 4px; }
.content { max-width: var(--wrap-max); display: flex; flex-direction: column; gap: 16px; }

/* ==========================================================================
   03 · 网格与卡片
   ========================================================================== */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-test { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }

.card {
  min-width: 0;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.card-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-2); }
.count {
  flex: none; min-width: 28px; padding: 2px 10px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-2); font-size: 12.5px; text-align: center;
}

.statusline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 0 2px; font-size: 13px; color: var(--text-2);
}
.statusline .sep { color: var(--text-4); }

.kpi { padding: 18px 20px 16px; }
.kpi-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi-value { margin-top: 6px; font-size: 34px; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; }
.kpi-sub { margin-top: 8px; font-size: 12px; color: var(--text-3); }

/* ==========================================================================
   04 · 按钮
   ========================================================================== */
.btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 16px;
  border: 0; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap;
  cursor: pointer; user-select: none; text-decoration: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-busy { opacity: .5; cursor: default; transform: none; }
.btn .icon { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--accent-tint); color: var(--accent); }
.btn-secondary:hover { background: var(--accent-tint-strong); }
.btn-plain { background: var(--surface-2); color: var(--text); }
.btn-plain:hover { background: var(--surface-3); }
.btn-outline { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--separator-strong); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover-bg); color: var(--text); }
.btn-danger { background: var(--red-tint); color: var(--red-text); }
.btn-danger:hover { background: var(--red-tint); color: var(--red); }
.btn-sm { height: 30px; padding: 0 13px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* ==========================================================================
   05 · 表单控件
   ========================================================================== */
.input, .textarea, .select {
  width: 100%;
  padding: 8px 11px;
  font-size: 14px; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--separator-strong);
  border-radius: var(--radius-ctl);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input { height: 36px; }
.textarea { display: block; min-height: 72px; line-height: 1.55; resize: vertical; }
.textarea.mono, .input.mono { font-size: 12.5px; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.select {
  appearance: none; -webkit-appearance: none;
  height: 36px; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select-sm { height: 26px; padding: 0 26px 0 9px; font-size: 12px; border-radius: var(--radius-sm); background-position: right 8px center; width: auto; max-width: 150px; }
.has-error .input, .has-error .textarea { border-color: var(--red); }
.has-error .input:focus, .has-error .textarea:focus { box-shadow: 0 0 0 4px var(--red-tint); }
.field-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.field-help { margin: -2px 0 8px; font-size: 12.5px; color: var(--text-2); }
.field-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.field-error { margin-top: 6px; font-size: 12.5px; color: var(--red-text); }
.field-error p + p { margin-top: 2px; }
.field-spaced { margin-top: 22px; padding-top: 20px; border-top: .5px solid var(--separator); }
.hint { margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.note { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12.5px; color: var(--text-2); }
.note .icon { width: 16px; height: 16px; flex: none; color: var(--text-3); }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* 开关(Apple 风) */
.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track {
  position: relative; display: block;
  width: 46px; height: 28px; border-radius: 14px;
  background: var(--surface-3);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--seg-knob); box-shadow: var(--shadow-knob);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus-ring); }
.switch-sm .switch-track { width: 38px; height: 23px; border-radius: 12px; }
.switch-sm .switch-track::after { width: 19px; height: 19px; }
.switch-sm input:checked + .switch-track::after { transform: translateX(15px); }

/* 分段控件 */
.seg-wrap { overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.seg-wrap::-webkit-scrollbar { display: none; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--seg-track); }
.seg-item {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 16px; border-radius: 8px;
  color: var(--text); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.seg-item:hover { text-decoration: none; background: var(--hover-bg); }
.seg-item.is-active { background: var(--seg-knob); box-shadow: var(--shadow-knob); }
.seg-sm .seg-item { height: 26px; padding: 0 12px; font-size: 12.5px; }
.seg-badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: var(--on-accent); font-size: 11px; font-weight: 600;
}

/* ==========================================================================
   06 · 表格、徽标、状态点
   ========================================================================== */
.table-wrap { position: relative; margin: 0 -22px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  padding: 0 12px 9px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 500; color: var(--text-3);
  border-bottom: .5px solid var(--separator);
}
.table td { padding: 11px 12px; vertical-align: top; border-bottom: .5px solid var(--separator); }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--hover-bg); }
.cell-main { color: var(--text); word-break: break-word; }
.cell-sub { margin-top: 2px; font-size: 12px; color: var(--text-3); word-break: break-word; }
.cell-sub.mono { white-space: nowrap; word-break: normal; }
.cell-sub-strong { font-size: 13px; color: var(--text-2); }
.clamp { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; max-width: 180px; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.col-text { min-width: 200px; max-width: 360px; }
.quote { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.row-actions { display: inline-grid; grid-auto-flow: row; justify-items: stretch; gap: 6px; min-width: 88px; }
.row-actions form { display: block; margin: 0; }
.row-actions .btn { width: 100%; }
.row-result { margin-top: 6px; font-size: 12px; text-align: right; white-space: normal; max-width: 260px; margin-left: auto; }
.row-result:empty, .inline-result:empty { display: none; }
.row-result:not(:empty) { min-width: 220px; }           /* 说明较长时(如 Telegram 拒绝的原因)把操作列撑宽,别挤成一条 */
.inline-result { margin: -4px 0 12px; padding: 9px 12px; border-radius: var(--radius-ctl); font-size: 13px; }
.is-ok.row-result { color: var(--green-text); }
.is-err.row-result { color: var(--red-text); }
.is-ok.inline-result { background: var(--green-tint); color: var(--green-text); }
.is-err.inline-result { background: var(--red-tint); color: var(--red-text); }
.is-busy.inline-result { background: var(--surface-2); color: var(--text-2); }
.is-warn.inline-result { background: var(--orange-tint); color: var(--orange-text); }
.is-warn.row-result { color: var(--orange-text); }
.status-note { max-width: 220px; white-space: normal; }
.table-meta { margin-bottom: 10px; font-size: 12.5px; color: var(--text-3); }
.form-row { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: var(--radius-pill); white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12px; font-weight: 500;
}
.badge-red { background: var(--red-tint); color: var(--red-text); }
.badge-orange { background: var(--orange-tint); color: var(--orange-text); }
.badge-green { background: var(--green-tint); color: var(--green-text); }
.badge-purple { background: var(--purple-tint); color: var(--purple-text); }
.badge-blue { background: var(--accent-tint); color: var(--accent); }
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-orange { background: var(--orange); }
.status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.status-bad { color: var(--red-text); }

/* 键值列表 */
.kv { display: flex; flex-direction: column; }
.kv > div {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 0; border-bottom: .5px solid var(--separator); font-size: 13.5px;
}
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--text-2); flex: none; }
.kv dd { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; text-align: right; }
.kv-stack { margin-top: 16px; }
.kv-stack > div { flex-direction: column; align-items: stretch; gap: 4px; }
.kv-stack dd { justify-content: flex-start; text-align: left; font-size: 12.5px; word-break: break-all; white-space: pre-wrap; }

/* ==========================================================================
   07 · 提示:提示条、toast、空状态、加载
   ========================================================================== */
.banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.55;
}
.banner .icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.banner > span, .banner p { text-wrap: pretty; }
.banner ul { margin-top: 6px; padding-left: 18px; }
.banner a { color: inherit; text-decoration: underline; }
.banner p + p { margin-top: 2px; }
.banner-error { background: var(--red-tint); color: var(--red-text); }
.banner-warn { background: var(--orange-tint); color: var(--orange-text); }
.banner-info { background: var(--accent-tint); color: var(--accent); }
.banner-ok { background: var(--green-tint); color: var(--green-text); }

.toast {
  position: fixed; top: 18px; right: 18px; z-index: 60;
  display: flex; align-items: flex-start; gap: 10px;
  width: min(420px, calc(100vw - 36px));
  padding: 14px 10px 14px 16px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-pop);
  animation: toast-in 260ms var(--ease);
}
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity 200ms var(--ease), transform 200ms var(--ease); }
.toast-icon { flex: none; display: inline-flex; margin-top: 1px; color: var(--green); }
.toast-warn .toast-icon { color: var(--orange); }
.toast-err .toast-icon { color: var(--red); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 14px; font-weight: 600; }
.toast-line { margin-top: 4px; font-size: 13px; color: var(--text-2); word-break: break-word; }
.toast-close {
  flex: none; display: inline-grid; place-items: center;
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-3); cursor: pointer;
}
.toast-close:hover { background: var(--hover-bg); color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.empty { display: flex; flex-direction: column; align-items: center; padding: 36px 16px 30px; text-align: center; }
.empty-icon {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px;
  border-radius: 12px; background: var(--surface-2); color: var(--text-3);
}
.empty-title { font-size: 14px; font-weight: 600; }
.empty-text { margin-top: 4px; max-width: 40ch; font-size: 13px; color: var(--text-2); text-wrap: balance; }

.loading { display: flex; align-items: center; gap: 10px; padding: 18px 0; font-size: 13px; color: var(--text-2); }
.spinner {
  display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--accent-tint-strong); border-top-color: var(--accent);
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 错误 / bot 未响应 状态页 */
.state-wrap { display: flex; justify-content: center; padding: 8px 0 24px; }
.state-wrap-bare { min-height: 100vh; align-items: center; padding: 32px 16px; }
.state-card { width: 100%; max-width: 560px; padding: 40px 32px 28px; text-align: center; }
.brand-center { margin-bottom: 26px; }
.state-icon { display: inline-grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 15px; }
.state-wrap .state-icon { display: grid; }
.state-icon .icon { width: 26px; height: 26px; }
.state-red { background: var(--red-tint); color: var(--red-text); }
.state-orange { background: var(--orange-tint); color: var(--orange-text); }
.state-gray { background: var(--surface-2); color: var(--text-2); }
.state-blue { background: var(--accent-tint); color: var(--accent); }
.state-title { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.state-text { margin: 8px auto 0; max-width: 46ch; font-size: 14px; color: var(--text-2); text-wrap: balance; }
.state-hint { margin: 6px auto 0; max-width: 46ch; font-size: 13px; color: var(--text-3); text-wrap: balance; }
.state-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.state-code { margin-top: 18px; font-size: 12px; color: var(--text-4); }

/* ==========================================================================
   08 · 页面:总览
   ========================================================================== */
.events { list-style: none; }
.event {
  display: grid; align-items: start; gap: 4px 12px;
  grid-template-columns: 64px auto minmax(0, 1fr) auto;
  grid-template-areas: "time badge body chat";
  padding: 10px 0; border-bottom: .5px solid var(--separator);
}
.event:last-child { border-bottom: 0; }
.event-time { grid-area: time; font-size: 12.5px; line-height: 22px; color: var(--text-3); }
.event > .badge { grid-area: badge; }
.event-body { grid-area: body; min-width: 0; }
.event-text { font-size: 13.5px; line-height: 22px; }
.event-quote { margin-top: 1px; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-chat { grid-area: chat; max-width: 170px; font-size: 12px; line-height: 22px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold-icon { display: inline-flex; color: var(--text-3); transition: transform var(--dur) var(--ease); }
.fold[open] .fold-icon { transform: rotate(180deg); }
.fold-body { margin-top: 16px; }
.logs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.logbox {
  max-height: 560px; overflow: auto;
  padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2);
  font-family: var(--mono); font-size: 12px; line-height: 1.65;
}
.log-line { white-space: pre-wrap; word-break: break-all; }
.log-warn { color: var(--orange-text); }
.log-error { color: var(--red-text); }
.logs-meta { margin-top: 8px; }

/* ==========================================================================
   09 · 页面:规则
   ========================================================================== */
.rules-form { display: flex; flex-direction: column; gap: 16px; }
.actionbar {
  position: sticky; top: 12px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px;
  padding: 10px 12px 10px 18px; border-radius: 16px;
  background: var(--material-nav);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-card);
}
.ab-info { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); }
.ab-version strong { color: var(--text); font-weight: 600; }
.ab-dirty { display: inline-flex; align-items: center; gap: 6px; color: var(--orange-text); font-weight: 500; }
.ab-actions { display: flex; gap: 8px; }

.settings-group + .settings-group { margin-top: 26px; }
.group-title { margin-bottom: 2px; font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; }
.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px 0; border-bottom: .5px solid var(--separator);
}
.setting:last-child { border-bottom: 0; }
.setting-text { min-width: 0; }
.setting-label { font-size: 14px; font-weight: 500; }
.setting-help { margin-top: 2px; max-width: 64ch; font-size: 12.5px; color: var(--text-2); }
.setting-control { flex: none; }
.num-input { display: inline-flex; align-items: center; gap: 8px; }
.input-num { width: 92px; text-align: right; }
.unit { min-width: 1.5em; font-size: 13px; color: var(--text-2); }

.pat-table { display: flex; flex-direction: column; }
.pat-row {
  display: grid; align-items: start; gap: 12px;
  grid-template-columns: 150px minmax(0, 1fr) 56px 64px;
  padding: 10px 0; border-bottom: .5px solid var(--separator);
}
.pat-header { padding-top: 0; font-size: 12px; font-weight: 500; color: var(--text-3); }
.pat-header span:nth-child(3), .pat-header span:nth-child(4) { text-align: center; }
.pat-cell { min-width: 0; }
.pat-cell-center { display: flex; justify-content: center; padding-top: 6px; }
.pat-input { min-height: 36px; max-height: 240px; field-sizing: content; }
.pat-row.is-deleted .input, .pat-row.is-deleted .textarea { color: var(--text-3); text-decoration: line-through; background: var(--surface-2); }
.pat-empty { padding: 16px 0 4px; }
.del-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.del-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--red); }
/* 规则保存的确认框:关掉 Claude / 一条正则都没启用时才出现 */
.confirm-box {
  margin: 4px 0 10px; padding: 10px 12px; border-radius: var(--radius-ctl);
  background: var(--orange-tint); color: var(--orange-text); font-size: 13px; line-height: 1.55;
}
.panel > .confirm-box { margin: 14px 0 0; }
.confirm-box .check { align-items: flex-start; margin-top: 0; font-size: 13px; }
.confirm-box .check input { flex: none; margin-top: 1px; accent-color: var(--orange-text); }
.confirm-box .field-error { padding-left: 26px; }
.prompt-input { min-height: 420px; font-size: 13.5px; line-height: 1.7; }
.prompt-ok { color: var(--green-text); }
.prompt-bad { color: var(--red-text); }
/* 昵称判定:左边提示词,右边暗示词 */
.cols-name { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.name-prompt-input { min-height: 320px; }
.match-note {
  margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-ctl);
  background: var(--surface-2); font-size: 12.5px; line-height: 1.6; color: var(--text-2);
}
.match-note strong { color: var(--text); font-weight: 600; }
.match-note p + p { margin-top: 6px; }
.match-words .mono { color: var(--text); word-break: break-word; }

/* ==========================================================================
   10 · 页面:试一试、群与人、违规记录、操作日志
   ========================================================================== */
.test-input { min-height: 150px; font-size: 14px; }
.test-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 8px; }
.test-head .field-label { margin-bottom: 0; }
.mode-switch { display: inline-flex; align-items: center; gap: 8px; }
.mode-switch-label { font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.is-name-mode .mode-switch-label { color: var(--accent); }
.is-name-mode .test-input { min-height: 72px; height: 96px; }       /* 昵称只有一行,输入框收矮 */
.samples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.samples-label { margin-right: 2px; font-size: 12.5px; color: var(--text-3); }
.chip {
  height: 28px; padding: 0 12px; border: 0; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text); font-size: 12.5px; cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.chip:hover { background: var(--surface-3); }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.step {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px; background: var(--surface-2);
}
.step-index {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600;
}
.tone-red .step-index { background: var(--red-tint); color: var(--red-text); }
.tone-orange .step-index { background: var(--orange-tint); color: var(--orange-text); }
.tone-green .step-index { background: var(--green-tint); color: var(--green-text); }
.step-name { font-size: 14px; font-weight: 600; }
.step-detail { margin-top: 2px; font-size: 13px; color: var(--text-2); word-break: break-word; }
.verdict { margin-top: 16px; padding: 18px 20px; border-radius: 14px; background: var(--surface-2); }
.verdict-label { font-size: 12px; font-weight: 600; color: var(--text-3); }
.verdict-text { margin-top: 4px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; }
.verdict-note { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.verdict-red { background: var(--red-tint); }
.verdict-red .verdict-text, .verdict-red .verdict-label { color: var(--red-text); }
.verdict-orange { background: var(--orange-tint); }
.verdict-orange .verdict-text, .verdict-orange .verdict-label { color: var(--orange-text); }
.verdict-green { background: var(--green-tint); }
.verdict-green .verdict-text, .verdict-green .verdict-label { color: var(--green-text); }

.add-form { margin-top: 16px; }
.add-form > summary { list-style: none; display: inline-flex; }
.add-form > summary::-webkit-details-marker { display: none; }
.add-form[open] > summary { margin-bottom: 12px; background: var(--surface-3); }
.form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-inline .input, .form-inline .select { flex: 1 1 170px; width: auto; }

.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.search-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search { position: relative; width: 260px; max-width: 100%; }
.search .input { padding-left: 34px; height: 32px; }
.search-icon { position: absolute; left: 11px; top: 50%; display: inline-flex; color: var(--text-3); transform: translateY(-50%); pointer-events: none; }
.search-icon .icon { width: 16px; height: 16px; }

.detail > summary { list-style: none; display: inline-flex; align-items: center; gap: 2px; cursor: pointer; color: var(--accent); font-size: 12.5px; }
.detail > summary::-webkit-details-marker { display: none; }
.detail > summary .icon { width: 14px; height: 14px; transition: transform var(--dur) var(--ease); }
.detail[open] > summary .icon { transform: rotate(180deg); }
.detail:not([open]) .when-open, .detail[open] .when-closed { display: none; }
.detail-pre {
  margin: 8px 0 0; max-width: 420px; max-height: 260px; overflow: auto;
  padding: 10px 12px; border-radius: 10px; background: var(--surface-2);
  font-size: 11.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all;
}

/* ==========================================================================
   10b · v2.0:群设置、群管理员、按群筛选
   ========================================================================== */
.cols-1 { grid-template-columns: minmax(0, 1fr); }
.cols-2 > .card-wide { grid-column: 1 / -1; }
.badges { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* 群选择器 */
.picker-card { padding-top: 16px; padding-bottom: 16px; }
.picker-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.picker-row .select { flex: 0 1 360px; width: auto; min-width: 200px; }
.picker-card .hint { margin-top: 8px; }

/* 群设置的每一行:左边说明,右边「跟随全局」;下面是全局值(只读)或编辑框 */
.gs-form .card > .group-title { margin-bottom: 4px; }
.gs-row {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: start; gap: 0 20px;
  padding: 16px 0; border-bottom: .5px solid var(--separator);
}
.gs-row:last-child { border-bottom: 0; padding-bottom: 4px; }
.gs-body { min-width: 0; }
.gs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.gs-inherit { display: inline-flex; align-items: center; gap: 8px; padding-top: 1px; }
.gs-inherit-text { font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.gs-row.is-inherit .gs-inherit-text { color: var(--accent); }
.gs-inherit-sub { display: block; margin-top: 1px; font-size: 11px; font-weight: 400; color: var(--text-3); }
.gs-row .setting-label .badge { margin-left: 6px; vertical-align: 1px; }
.gs-global {
  display: flex; align-items: baseline; gap: 10px; margin-top: 10px;
  padding: 9px 12px; border-radius: var(--radius-ctl); background: var(--surface-2);
}
.gs-global-label { flex: none; font-size: 12px; font-weight: 600; color: var(--text-3); }
.gs-global-value { min-width: 0; font-size: 13px; color: var(--text-2); word-break: break-word; }
.gs-global-long { white-space: pre-wrap; }
.gs-edit { margin-top: 10px; }
.gs-edit .textarea { max-width: 720px; }
.gs-switch-line { display: flex; align-items: center; gap: 12px; }
.gs-row.has-error .gs-edit .input, .gs-row.has-error .gs-edit .textarea { border-color: var(--red); }

.radio-group { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.radio { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.radio input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* 放行的人:一行一个(用户 ID / 名字 / 删除) */
.tu-table { display: flex; flex-direction: column; gap: 8px; max-width: 720px; }
.tu-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 64px; align-items: center; gap: 10px; }
.tu-header { font-size: 12px; font-weight: 500; color: var(--text-3); }
.tu-row.is-deleted .input { color: var(--text-3); text-decoration: line-through; background: var(--surface-2); }
.tu-empty { padding: 2px 0; }
.tu-table > .btn { align-self: flex-start; }

/* 欢迎语预览:像群里的一条消息,名字那段是蓝色(能点) */
.welcome-input { min-height: 72px; }
.welcome-preview { margin-top: 10px; max-width: 720px; }
.wp-label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.wp-bubble {
  display: inline-block; max-width: 100%; padding: 9px 13px; border-radius: 16px 16px 16px 6px;
  background: var(--surface-2); font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.wp-name { color: var(--accent); font-weight: 500; }
.welcome-field .welcome-input { max-width: 720px; }

/* 试一试:按哪个群测 */
.test-group { margin-bottom: 16px; padding-bottom: 16px; border-bottom: .5px solid var(--separator); }
.test-group .select { max-width: 420px; }

/* 群与人:群管理员、总管理员 */
.row-actions-inline { display: inline-flex; grid-auto-flow: column; gap: 6px; min-width: 0; }
.row-actions-inline .btn { width: auto; }
.gm-row-pending td { background: var(--orange-tint); }
.gm-row-pending:hover td { background: var(--orange-tint); }
.gm-pending-banner, .admin-warning { margin-bottom: 14px; }

/* 按群筛选 */
.select-filter { width: auto; min-width: 150px; max-width: 240px; height: 32px; }
.filters-compact { justify-content: flex-start; gap: 10px 12px; }
.filter-label { margin: 0; }

/* ==========================================================================
   10c · 2026-10-16「AI 判错了」:违规记录的改判按钮、「AI 放过的」、全局规则的「判错的例子」
   ========================================================================== */
.fb-hint { margin-bottom: 14px; }
/* 「其实是广告」的选项:操作列是 width: 1%; white-space: nowrap 的,展开的小表单要自己撑开宽度 */
.row-more > summary { list-style: none; }
.row-more > summary::-webkit-details-marker { display: none; }
.row-more[open] > summary { background: var(--accent-tint-strong); }
.fb-form { white-space: normal; text-align: left; max-width: 260px; margin-top: 6px; }
.row-more[open] .fb-form { min-width: 220px; }
.fb-form .check { display: flex; align-items: flex-start; margin-top: 6px; font-size: 12.5px; line-height: 1.45; }
.fb-form .check input { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.fb-form .check input:disabled + span { color: var(--text-3); }
.fb-form .hint { margin: 2px 0 0 24px; font-size: 12px; line-height: 1.45; color: var(--text-3); }
.fb-form .btn { margin-top: 10px; }
.fb-note { white-space: normal; text-align: left; max-width: 220px; margin: 0; }
/* 处理那一格下面的改判记录:说失败 / 结果未知的那条是橙色(刷新后也看得到) */
.fb-line { white-space: normal; }
.fb-line.is-warn { color: var(--orange-text); }
.table-violations .fb-line { max-width: 260px; }        /* 处理记录很长时别把「群」那一列挤没了(手机上照样占满) */
.table-violations td[data-label="处理"]:has(.fb-line) { min-width: 12em; }   /* 有处理记录时这一格至少 12 个字宽,不挤成一两个字一行 */
.table-violations .cell-main.clamp { min-width: 7em; }  /* 群名至少露出 7 个字 */
/* 展开「其实是广告」的选项时操作列会变宽:规则、处理两列别挤成一个字一行,原文那列让出一点 */
.table-violations td[data-label="规则"] > .cell-main, .table-violations td[data-label="处理"] > .cell-main { min-width: 4.5em; }
.table-violations:has(.row-more[open]) .col-text, .table-violations:has(.fb-line) .col-text { min-width: 120px; }   /* 处理记录要宽一点时,原文那列让出来(原文本来就最多显示几行) */
/* 全局规则 →「判错的例子」 */
.ex-sub2 { margin-top: 4px; }
.ex-banner { margin-bottom: 14px; }
.ex-side + .ex-side, .ex-trash { margin-top: 22px; padding-top: 18px; border-top: .5px solid var(--separator); }
.ex-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.ex-trash .ex-title { margin-bottom: 0; }
.ex-trash .card-sub { margin-bottom: 10px; }
.quote.ex-text { display: block; overflow: visible; -webkit-line-clamp: none; }
/* 三张表(算广告、不算广告、最近删掉的)的列宽一样,上下对齐 */
.table-examples { table-layout: fixed; }
.table-examples th:nth-child(1) { width: 46%; }
.table-examples th:nth-child(2) { width: 22%; }
.table-examples th:nth-child(3) { width: 20%; }
.table-examples th:last-child { width: 12%; }
.ex-none { margin: 2px 0 0; }
.ex-add { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; max-width: 560px; }
.ex-add .field { width: 100%; }
.ex-add .ex-select { width: auto; min-width: 160px; }
.ex-add .hint { margin-top: 6px; }

/* ==========================================================================
   11 · 登录页
   ========================================================================== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.login-card {
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; gap: 18px;
  padding: 38px 32px 28px; border-radius: 22px;
  background: var(--surface); box-shadow: var(--shadow-card);
}
.login-brand { text-align: center; }
.brand-mark-lg { width: 54px; height: 54px; margin-bottom: 16px; border-radius: 15px; font-size: 26px; }
.login-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.login-lead { margin-top: 6px; font-size: 14px; color: var(--text-2); text-wrap: balance; }
.login-howto { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; padding-left: 20px; font-size: 13px; color: var(--text-2); }
.login-code-label { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.login-code {
  margin: 8px 0 10px; padding: 14px 0 14px .24em;
  border-radius: 16px; background: var(--surface-2);
  text-align: center; font-size: 46px; font-weight: 600; line-height: 1.1; letter-spacing: .24em;
}
.login-code-hint { margin-bottom: 16px; text-align: center; font-size: 13px; color: var(--text-2); }
.login-row { display: flex; justify-content: center; margin-top: 10px; }
.login-status { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--text-2); }
.login-countdown { color: var(--text-3); }
.login-error { padding: 10px 12px; border-radius: 10px; background: var(--red-tint); color: var(--red-text); font-size: 13px; text-align: center; }
.login-foot { font-size: 12px; text-align: center; color: var(--text-3); text-wrap: balance; }

/* ==========================================================================
   12 · 响应式:窄屏把侧栏收成顶部菜单
   ========================================================================== */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-main, .cols-test, .cols-3, .cols-name { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  html { scroll-padding-top: 140px; }          /* 顶部菜单 56px + 吸顶操作栏 */
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0;
    border-right: 0; border-bottom: .5px solid var(--separator);
  }
  .sb-inner { position: static; height: auto; padding: 0; }
  .sb-head { height: 56px; padding: 0 12px 0 16px; }
  .menu-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 13px; border: 0; border-radius: var(--radius-pill);
    background: var(--hover-bg); color: var(--text);
    font-size: 13.5px; font-weight: 500; cursor: pointer;
  }
  .menu-btn .icon { width: 17px; height: 17px; }
  .sb-nav { display: none; padding: 2px 10px 12px; }
  .nav-open .sb-nav { display: flex; }
  .sb-label { display: none; }
  .sb-item { height: 42px; font-size: 15px; }
  .sb-foot { display: none; }
  .nav-open .sb-foot { display: flex; margin: 0 10px 8px; padding-top: 0; }
  .main { padding: 0 16px 56px; }
  .topbar { flex-wrap: wrap; align-items: flex-start; padding: 20px 0 16px; }
  .tb-title { font-size: 22px; }
  .tb-user { margin-left: auto; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .kpis { gap: 12px; }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 28px; }
  .event { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "time badge" "body body" "chat chat"; }
  .event > .badge { justify-self: start; }
  .event-chat { max-width: none; }
  .actionbar { top: 66px; padding: 10px 12px; }
  .setting { flex-wrap: wrap; gap: 10px 16px; }
  .pat-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .pat-row > .pat-cell:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .pat-header { display: none; }
  .filters { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  .filters > .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .filters > .seg::-webkit-scrollbar { display: none; }
  .filters > .seg .seg-item { flex: none; }
  .search-form { flex-wrap: nowrap; }
  .search { width: auto; flex: 1; min-width: 0; }
  .toast { top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; }
  /* 宽表格在窄屏变成一行一张卡片(标签来自 data-label) */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr { display: block; width: 100%; }
  .table-stack tr { padding: 12px 16px; border-bottom: .5px solid var(--separator); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table.table-stack td, .table.table-stack td:first-child, .table.table-stack td:last-child {
    display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 0 10px;
    padding: 3px 0; border: 0; text-align: left; width: auto; max-width: none; min-width: 0; white-space: normal;
  }
  .table-stack td::before { content: attr(data-label); grid-column: 1; font-size: 12px; line-height: 20px; color: var(--text-3); }
  .table-stack td > * { grid-column: 2; justify-self: start; max-width: 100%; }
  .table.table-stack td.col-actions { display: block; padding-top: 10px; }
  .table-stack td.col-actions::before { display: none; }
  .table-stack .row-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; min-width: 0; }
  .table-stack .row-actions .btn { width: auto; }
  .table-stack .row-result { margin-left: 0; text-align: left; max-width: none; }
  .table-stack .clamp { max-width: none; }
  .table-stack .quote { -webkit-line-clamp: 3; }
  .table-stack .detail-pre { max-width: 100%; }
  .table-stack .row-more[open] { flex-basis: 100%; }        /* 手机上展开的「其实是广告」选项独占一行 */
  .table-stack .fb-form { max-width: none; }
  .table-stack .fb-note { max-width: none; }
  .table-stack .fb-line { max-width: 100%; }
  .table.table-stack td[data-label="处理"]:has(.fb-line) { min-width: 0; }   /* 手机上一格本来就占满一行 */
  .table.table-stack.table-examples td { grid-template-columns: 64px minmax(0, 1fr); }   /* 「算不算广告」一行放得下 */
  .gs-row { grid-template-columns: minmax(0, 1fr); gap: 10px 0; }
  .gs-inherit-sub { display: inline; margin: 0 0 0 6px; }
  .gs-head { flex-wrap: wrap; gap: 8px 16px; }
  .tu-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tu-row > .input:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .tu-header { display: none; }
  .picker-row .select { flex: 1 1 auto; min-width: 0; }
  .select-filter { max-width: none; flex: 1 1 auto; }
  .row-actions-inline { display: flex; }
  .topbar { position: relative; }
  .tb-titles { padding-right: 112px; }
  .tb-user { position: absolute; top: 18px; right: 0; margin: 0; }
  .login-card { padding: 30px 22px 24px; }
}
@media (max-width: 420px) {
  .tb-user-text { display: none; }
  .kpi-value { font-size: 26px; }
  .ab-actions { width: 100%; }
  .ab-actions .btn { flex: 1; }
  .login-code { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
  .spinner { animation: spin 2400ms linear infinite !important; }
}
