/* ==========================================================================
   bat-saas console — 清晰优先的 Apple 风
   原则：
   1. 毛玻璃只用于「浮在内容之上」的导航层（侧栏 / 顶栏 / 登录卡），内容区一律实心白
   2. 文字与背景对比度优先，任何半透明文字都必须 >= 4.5:1
   3. 中文禁用负字距（会造成笔画粘连、视觉发虚）
   4. 阴影收敛到 1px 描边 + 小范围柔光，不用大扩散阴影
   ========================================================================== */

:root {
  /* Windows 优先 Segoe UI（系统原生 UI 字体，渲染最实）；
     macOS 优先 SF Pro / 苹方；中文兜底微软雅黑 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text",
    "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* 文字：三档，全部满足 WCAG AA */
  --text: #111318;
  --text-2: #383c45;
  --muted: #5f646e;
  --faint: #878c96;

  /* 描边与分隔 */
  --line: rgba(16, 20, 30, 0.09);
  --line-2: rgba(16, 20, 30, 0.14);

  /* 表面 */
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --surface-3: #eef1f6;

  /* 玻璃层（仅导航） */
  --glass-nav: rgba(255, 255, 255, 0.78);
  --glass-float: rgba(255, 255, 255, 0.82);

  /* 强调色 */
  --blue: #0a7cff;
  --blue-deep: #0063d1;
  --indigo: #5457d6;
  --green: #1c7a37;
  --orange: #b8460a;
  --red: #cf1428;

  /* 阴影：小、实、不扩散 */
  --shadow-xs: 0 1px 2px rgba(16, 20, 30, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 20, 30, 0.05), 0 3px 10px rgba(16, 20, 30, 0.05);
  --shadow-md: 0 1px 2px rgba(16, 20, 30, 0.05), 0 10px 28px rgba(16, 20, 30, 0.07);
  --shadow-lg: 0 2px 4px rgba(16, 20, 30, 0.04), 0 18px 44px rgba(16, 20, 30, 0.09);

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font: 14px/1.6 var(--font);
  color: var(--text);
  background-color: #e9edf4;
  background-image:
    radial-gradient(780px 520px at 10% -10%, rgba(90, 145, 255, 0.085), transparent 62%),
    radial-gradient(680px 520px at 100% 0%, rgba(148, 118, 255, 0.07), transparent 58%),
    radial-gradient(760px 620px at 50% 112%, rgba(86, 196, 255, 0.06), transparent 64%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  /* 不写 -webkit-font-smoothing: antialiased：
     那是 macOS 的做法，在 Windows 上会关闭 ClearType，让文字发灰发虚。
     这里交给系统默认（Windows = 次像素渲染，最清晰）。 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

::selection { background: rgba(10, 124, 255, 0.18); }

.app-loading {
  padding: 120px; text-align: center; color: var(--muted);
}

/* ---------- 外壳 ---------- */
.layout {
  display: flex;
  gap: 20px;
  min-height: 100vh;
  max-width: 1520px;
  margin: 0 auto;
  padding: 18px;
}

/* 侧栏：唯一保留较明显玻璃感的地方（导航需要层次） */
.sidebar {
  width: 228px;
  flex: 0 0 228px;
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  padding: 20px 12px;
  border-radius: var(--radius-xl);
  background: var(--glass-nav);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), var(--shadow-md);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  display: flex;
  flex-direction: column;
}

.brand {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
  margin: 2px 10px 2px;
}
.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 10px 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin: 16px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(16, 20, 30, 0.045); color: var(--text); }
.nav-item.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.sidebar-foot { margin-top: auto; padding: 10px 4px 2px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.avatar {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(145deg, #6f9dff, var(--indigo));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.user-chip .name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.user-chip .role { font-size: 11px; color: var(--muted); }

.main { flex: 1; min-width: 0; padding: 8px 10px 48px 0; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 2px 20px;
}
.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0;              /* 中文不能用负字距 */
}
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 5px; }
.top-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 内容容器：一律实心白 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.glass-strong {
  background: var(--surface);
  border-color: var(--line-2);
  box-shadow: var(--shadow-md);
}
.section { margin-top: 22px; }
.section > h2 {
  font-size: 15px; font-weight: 600; letter-spacing: 0; margin: 0 0 10px;
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 0 2px 10px;
}
.section-head h2 {
  font-size: 15px; font-weight: 600; letter-spacing: 0; margin: 0;
}

/* ---------- 指标卡 ---------- */
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: 1.35fr 0.9fr; gap: 16px; }

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
}
.stat-card::after {
  content: "";
  position: absolute; right: -34px; top: -44px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(10, 124, 255, 0.09), transparent 70%);
  pointer-events: none;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label {
  font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0;
}
.stat-icon {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: rgba(10, 124, 255, 0.08);
  color: var(--blue-deep);
}
.stat-icon svg, .btn svg, .admin-nav svg { stroke-width: 2; }
.stat-value {
  font-size: 31px; font-weight: 600; letter-spacing: -0.02em;
  margin-top: 10px; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  font-size: 12px; color: var(--muted); font-weight: 500;
  letter-spacing: 0; margin-left: 5px;
}
.stat-foot { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: 22px 26px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(520px 220px at 100% 0%, rgba(84, 87, 214, 0.09), transparent 66%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.hero-main { min-width: 0; }
.hero h2 {
  margin: 0 0 6px; font-size: 23px; font-weight: 600; letter-spacing: 0;
}
.hero p { margin: 0; color: var(--muted); font-size: 13px; }
.hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* 右侧关键指标，填满 hero 空白并给出即时状态 */
.hero-side {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  padding-left: 30px;
  border-left: 1px solid var(--line);
}
.hero-metric {
  display: grid;
  gap: 2px;
  padding: 0 26px;
  border-left: 1px solid var(--line);
}
.hero-metric:first-child { border-left: 0; padding-left: 0; }
.hero-metric:last-child { padding-right: 0; }
.hero-metric .k { font-size: 12px; color: var(--muted); }
.hero-metric .v {
  font-size: 24px; font-weight: 600; letter-spacing: -0.02em;
  line-height: 1.15; font-variant-numeric: tabular-nums;
}
.hero-metric .d { font-size: 12px; color: var(--muted); }

/* ---------- 按钮：实心，无模糊 ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--text);
  padding: 8px 15px;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--surface-2); border-color: rgba(16, 20, 30, 0.18); }
.btn:active { background: var(--surface-3); }
.btn-primary {
  background: linear-gradient(180deg, #2890ff, var(--blue-deep));
  border-color: rgba(0, 99, 209, 0.9);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 79, 168, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #3a9aff, #006fe0);
  border-color: rgba(0, 99, 209, 1);
}
.btn-danger {
  color: var(--red);
  border-color: rgba(207, 20, 40, 0.22);
  background: #fff;
}
.btn-danger:hover { background: rgba(207, 20, 40, 0.055); border-color: rgba(207, 20, 40, 0.3); }
/* 警告类：会改变状态但可恢复（冻结），与不可恢复的删除区分开 */
.btn-warn {
  color: var(--orange);
  border-color: rgba(184, 70, 10, 0.26);
  background: #fff;
}
.btn-warn:hover { background: rgba(184, 70, 10, 0.06); border-color: rgba(184, 70, 10, 0.4); }
.btn-ghost {
  background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2);
}
.btn-ghost:hover { background: rgba(16, 20, 30, 0.05); border-color: transparent; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn[disabled], .btn:disabled { opacity: 0.42; cursor: not-allowed; }

/* ---------- 管理端顶部导航（第二处玻璃） ---------- */
.admin-topbar {
  position: sticky; top: 12px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px;
  padding: 11px 14px 11px 18px;
  margin-bottom: 22px;
  border-radius: 18px;
  background: var(--glass-float);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--shadow-md);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}
.admin-brand { display: flex; align-items: center; gap: 10px; }
.admin-brand .logo {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: linear-gradient(145deg, #2890ff, var(--indigo));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: grid; place-items: center; color: #fff;
}
.admin-brand .title { font-size: 14px; font-weight: 600; letter-spacing: 0; }
.admin-brand .sub { font-size: 11px; color: var(--muted); }
.admin-nav {
  display: flex; align-items: center; gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(16, 20, 30, 0.055);
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a {
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.6); }
.admin-nav a.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.admin-user { display: flex; align-items: center; gap: 10px; }

/* ---------- 表格：白底细线，可读性优先 ---------- */
.table-wrap {
  border-radius: var(--radius-lg);
  overflow-x: auto;          /* 列不被挤压，宁可横向滚动 */
  overflow-y: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
table {
  width: 100%;
  min-width: 880px;          /* 低于此宽度横向滚动，保证每列都够宽 */
  border-collapse: separate;
  border-spacing: 0;
}
th, td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}
th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: #eef2f8;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
table tbody tr { transition: background 0.12s ease; }
table tbody tr:hover td { background: #f8fafd; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; }

/* 卡片自己的运行进度 */
.card-progress {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fffbf2;
  border: 1px solid rgba(184, 70, 10, 0.16);
}
.card-progress .progress { height: 6px; }

/* 卡片上的一行失败原因（最多两行，超出省略） */
.card-error {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #b3261e;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-all;
}

/* ---------- 表单 ---------- */
.form { display: grid; gap: 14px; }
/* 表单里的提交按钮不要被 grid 拉成整行宽 */
.form > .btn { justify-self: start; }
.form-card { max-width: 860px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0;
}
/* 表单项下方的通俗说明 */
.field-hint {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
input, textarea, select {
  width: 100%;
  border: 1px solid rgba(16, 20, 30, 0.16);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(10, 124, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(10, 124, 255, 0.13);
}
textarea { min-height: 104px; resize: vertical; line-height: 1.6; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%),
    linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

details.glass-details {
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
details.glass-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border-bottom: 1px solid transparent;
  transition: background 0.15s ease;
}
details.glass-details > summary:hover { background: #f1f4f9; }
details.glass-details[open] > summary { border-bottom-color: var(--line); }
details.glass-details > summary::-webkit-details-marker { display: none; }
details.glass-details > summary::after {
  content: "+"; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1;
}
details.glass-details[open] > summary::after { content: "−"; }
details.glass-details .details-body { padding: 20px; }

/* ---------- 标签 / 进度 / 杂项 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
  background: rgba(16, 20, 30, 0.06);
  color: var(--text-2);
  white-space: nowrap;
}
.tag::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: 0.6;
}
.tag.ok { background: rgba(28, 122, 55, 0.1); color: var(--green); }
.tag.warn { background: rgba(184, 70, 10, 0.1); color: var(--orange); }
.tag.bad { background: rgba(207, 20, 40, 0.09); color: var(--red); }
.tag.blue { background: rgba(10, 124, 255, 0.09); color: var(--blue-deep); }

.progress {
  height: 6px; border-radius: 999px;
  background: rgba(16, 20, 30, 0.08);
  overflow: hidden;
}
.progress > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #2890ff, var(--indigo));
  transition: width 0.4s ease;
}
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.error { color: var(--red); font-size: 13px; }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
/* 说明性提示块（不是错误，是限制/告知） */
.notice {
  background: #fffbf2;
  border-color: rgba(184, 70, 10, 0.16);
}
.notice strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #7a3208;
}
.notice .hint { margin: 0; color: #6b5344; }

/* ---------- 列表 ---------- */
.list { display: grid; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-row .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 18px; position: relative;
}
.login-card {
  width: 100%; max-width: 400px; box-sizing: border-box;
  padding: 32px 30px 28px;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid rgba(16, 20, 30, 0.06);
  box-shadow: 0 2px 4px rgba(16, 20, 30, 0.04), 0 16px 40px rgba(16, 20, 30, 0.1);
}
.login-card {
  text-align: center;
}
.login-card h1 {
  font-size: 27px; font-weight: 700; letter-spacing: 0.02em; margin: 0;
  color: var(--text);
}
.login-card .form { margin-top: 26px; text-align: left; }
.login-card .field { margin-bottom: 4px; }
.login-btn {
  width: 100%;
  height: 46px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  margin-top: 6px;
  border-radius: 12px;
}
.login-foot {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}
.login-logo {
  width: 54px; height: 54px; border-radius: 16px;
  background: linear-gradient(145deg, #2890ff, var(--indigo));
  box-shadow: 0 8px 20px rgba(10, 124, 255, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: grid; place-items: center; margin: 0 auto 16px; color: #fff;
  font-size: 26px; font-weight: 800; font-family: Avenir, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(23, 25, 31, 0.94);
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 99;
  max-width: 80vw;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(16, 20, 30, 0.24);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast:not([hidden]) { opacity: 1; transform: translateX(-50%) translateY(0); }
/* 错误提示：深红底 + 可折行，长句子也能读清 */
.toast.toast-error {
  background: rgba(176, 22, 38, 0.96);
  border-color: rgba(255, 255, 255, 0.18);
  max-width: min(560px, 88vw);
  line-height: 1.6;
  text-align: center;
  border-radius: 12px;
}

/* ---------- 代码块 ---------- */
.pre {
  background: #1b1e25;
  color: #e9edf5;
  padding: 16px; border-radius: var(--radius-md);
  overflow: auto; max-height: 300px;
  white-space: pre-wrap; word-break: break-all;
  font-family: var(--font-mono);
  font-size: 12px; line-height: 1.7;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---------- 日期胶囊 ---------- */
.pill-date {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2);
}

/* ---------- 弹窗（编辑客户） ---------- */
.modal {
  border: 0;
  padding: 0;
  border-radius: 18px;
  width: min(580px, 92vw);
  max-height: 88vh;
  background: #fff;
  color: var(--text);
  box-shadow: 0 26px 70px rgba(16, 20, 30, 0.26);
}
.modal::backdrop { background: rgba(16, 20, 30, 0.34); }
.modal-body {
  display: grid;
  gap: 16px;
  padding: 24px 26px 22px;
}
.modal-body h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .admin-topbar { flex-wrap: wrap; }
  .admin-nav { order: 3; width: 100%; }
  .admin-user .pill-date { display: none; }
  .hero { gap: 24px; }
  .hero-metric { padding: 0 18px; }
}
@media (max-width: 900px) {
  .layout { display: block; padding: 12px; }
  .sidebar {
    width: auto; height: auto; position: static;
    flex-direction: row; align-items: center; overflow-x: auto;
    padding: 12px; gap: 4px;
  }
  .brand, .brand-sub, .nav-group, .sidebar-foot { display: none; }
  .nav-item { white-space: nowrap; }
  .main { padding: 0 0 30px; }
  .admin-topbar { flex-wrap: wrap; gap: 10px; }
  .admin-nav { order: 3; width: 100%; overflow-x: auto; }
  .grid-4, .grid-3, .grid-2, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 24px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 20px; }
  .hero-side {
    padding-left: 0; padding-top: 18px;
    border-left: 0; border-top: 1px solid var(--line);
    width: 100%; flex-wrap: wrap; row-gap: 14px;
  }
  .hero-metric { padding: 0 20px 0 0; }
}

/* ---------- 新客户上手引导 ---------- */
.guide { margin-bottom: 16px; padding: 16px 18px; }
.guide-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 4px;
}
.guide-head strong { font-size: 14px; font-weight: 600; }
.guide-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.guide-no {
  width: 24px; height: 24px; flex: 0 0 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(10, 124, 255, 0.1);
  color: var(--blue-deep);
  font-size: 12px; font-weight: 600;
}
.guide-t { font-size: 13.5px; font-weight: 600; }
.guide-d { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- 草稿提示条 / 群号实时统计 ---------- */
.draft-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 760px;
  padding: 9px 14px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: #f2f7ff;
  border: 1px solid rgba(10, 124, 255, 0.16);
  font-size: 12.5px;
  color: var(--text-2);
}
.draft-bar[hidden] { display: none; }
.draft-bar .draft-text { min-width: 0; }

.group-count {
  margin-top: 8px;
  min-height: 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.group-count.ok { color: var(--green); }
.group-count.warn { color: var(--orange); }

/* ==========================================================
   移动端（≤768px）：底部导航 + 抽屉，桌面端以上全部隐藏
   ========================================================== */
.tabbar { display: none; }
.drawer { display: none; }

@media (max-width: 768px) {
  body { background-attachment: scroll; -webkit-text-size-adjust: 100%; }
  /* 打字时收起底部导航，别挡输入框；失焦即恢复 */
  body.typing .tabbar { display: none; }
  body.typing .layout { padding-bottom: 24px; }
  .layout { display: block; padding: 0 0 calc(64px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }

  .main { padding: 0 12px 24px; }
  .topbar { display: none; }

  /* 底部标签栏 */
  .tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-top: 1px solid var(--line);
  }
  .tab-item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
    text-decoration: none;
    border-radius: 10px;
  }
  .tab-item svg { width: 20px; height: 20px; }
  .tab-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-item.active { color: var(--blue-deep); font-weight: 600; }

  /* 「更多」抽屉 */
  .drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(16, 20, 30, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .drawer.open { opacity: 1; pointer-events: auto; }
  .drawer-panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    max-height: 78vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.22s ease;
    box-shadow: 0 -8px 32px rgba(16, 20, 30, 0.16);
  }
  .drawer.open .drawer-panel { transform: translateY(0); }
  .drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px; padding: 0 4px 10px;
    border-bottom: 1px solid var(--line);
  }
  .drawer-item {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 10px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
  }
  .drawer-item:hover { background: var(--surface-2); }
  .drawer-foot {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  /* 提示条抬高，别被底部导航挡住 */
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); font-size: 13px; }

  /* 触屏友好：输入框 16px 防止 iOS 自动放大；按钮够大 */
  .form > .btn { justify-self: stretch; }
  input, textarea, select { font-size: 16px; }
  .btn { min-height: 40px; padding: 9px 15px; }
  .btn-sm { min-height: 34px; }
  .btn-primary { min-height: 46px; font-size: 15px; }

  /* 表格：字号收紧 + 允许横向滑动 */
  .table-wrap { border-radius: 12px; }
  table { min-width: 620px; font-size: 12px; }
  th, td { padding: 9px 12px; }
  th { font-size: 11px; }

  /* 卡片与表单间距 */
  .card { padding: 15px; border-radius: 14px; }
  .login-card { padding: 30px 22px 22px; border-radius: 20px; }
  .grid { gap: 10px; }
  .stat-value { font-size: 26px; }
  .hero { padding: 18px; }
  .hero h2 { font-size: 20px; }
  .form { gap: 12px; }
  .modal-body { padding: 20px 18px 18px; }
}

/* ==========================================================
   群发页（对齐原始 broadcast 页）
   账号卡片 / 分段选择 / 风控参数 / 统计块
   ========================================================== */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-head strong { font-size: 15px; font-weight: 600; display: block; }
.card-head .hint { margin-top: 4px; }

.acct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}
.acct-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.acct-card.warn { border-color: rgba(184, 70, 10, 0.35); background: #fffdf8; }
.acct-head {
  display: flex;
  align-items: center;
  gap: 8px;
  /* 窄屏时标签/按钮换行，否则会把卡片撑出屏幕 */
  flex-wrap: wrap;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}
.acct-no {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
}
.acct-head .grow { flex: 1; }

/* 分段选择（内容类型 / 通道） */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(118, 118, 128, 0.12);
}
.seg-btn {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 8px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn.active {
  background: #fff;
  color: var(--blue-deep);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 20, 30, 0.1);
}

/* 滑块行 */
.risk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.risk-label {
  font-size: 13px;
  width: 118px;
  flex: 0 0 118px;
  color: var(--text-2);
}
.risk-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--blue);
  height: 22px;
}
.risk-val {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 42px;
  text-align: right;
}
.risk-num {
  width: 74px;
  flex: 0 0 74px;
}

/* 开关 */
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-2);
}
.switch-row input[type="checkbox"] { width: auto; accent-color: var(--blue); }

/* 话术条目 */
.acct-texts { display: flex; flex-direction: column; gap: 9px; }
.text-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.text-no {
  font-size: 11.5px;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
}
.acct-texts textarea { min-height: 88px; }

/* 实时统计块 */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.stat-box {
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.stat-box .k { font-size: 12px; color: var(--muted); }
.stat-box .v {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
  letter-spacing: -0.01em;
}
.stat-box.ok .v { color: var(--green); }
.stat-box.warn .v { color: var(--orange); }
.stat-box.bad .v { color: var(--red); }

/* 风控选项两栏：左侧节奏参数，右侧循环设置 */
.risk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 28px;
  align-items: start;
}
@media (max-width: 860px) {
  .risk-grid { grid-template-columns: 1fr; }
}

/* 按账号分组的明细 */
.acc-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--surface);
}
.acc-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  background: var(--surface-2);
  flex-wrap: wrap;
}
.acc-group-head:hover { background: #f1f4f9; }
.acc-group-body { padding: 0 4px 4px; }

@media (max-width: 1180px) {
  .acct-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .acct-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .risk-label { width: 96px; flex-basis: 96px; }
  /* 说明文字单独占一行，别被挤成竖排 */
  .risk-row { flex-wrap: wrap; }
  .risk-row .hint { flex: 1 1 100%; white-space: normal; line-height: 1.5; }
  .risk-num { flex: 1 1 0; width: auto; }
}

/* ==========================================================
   折叠面板（风控选项 / 邀请节奏）
   默认收起，summary 一行显示关键参数，点开才展开
   ========================================================== */
.panel-fold { margin: -2px 0 -2px; }
.panel-fold > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 2px 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.panel-fold > summary::-webkit-details-marker { display: none; }
.panel-fold > summary strong { font-size: 15px; font-weight: 600; flex: none; }
.panel-fold .fold-meta {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-fold .fold-chevron {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 0.18s ease;
}
.panel-fold[open] .fold-chevron { transform: rotate(180deg); }
.panel-fold .fold-body { padding: 12px 0 2px; }

/* 卡片底部操作区：主按钮 + 次要按钮 */
.acct-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.acct-actions .btn { flex: none; }

/* 参数行：标签 + 控件组，窄屏时控件整体换行 */
.risk-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.risk-ctl .risk-num { flex: 0 0 auto; }
.risk-ctl .muted { flex: none; }

/* 卡片内「已选图片」一行：名字截断 + 右侧按钮 */
.acct-card .pic-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.acct-card .pic-row .tag.ok {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-card .pic-row .btn { flex: none; }

/* 触屏点击不要蓝色高亮、不要双击放大 */
.btn, .seg-btn, .tab-item, .chip, summary, .acc-group-head {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@media (max-width: 768px) {
  /* 参数行：标签独占一行，控件整行铺开，不再被挤成竖排 */
  .risk-row { flex-wrap: wrap; gap: 8px 10px; }
  .risk-label {
    width: auto;
    flex: 1 1 100%;
    font-size: 13px;
  }
  .risk-ctl { flex: 1 1 100%; }
  .risk-ctl .risk-num { flex: 1 1 0; width: auto; min-width: 0; }
  .risk-ctl .hint {
    flex: none;
    max-width: 45%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 卡片操作：启动占满整行，删除靠右 */
  .acct-actions { gap: 10px; padding-top: 13px; }
  .acct-actions .acct-main { flex: 1 1 auto; min-height: 46px; font-size: 15px; }
  .acct-actions .btn { border-radius: 12px; }
  .acct-actions .btn-danger { min-height: 46px; padding: 0 18px; }

  /* 内容类型分段：整行等分，手指好点 */
  .acct-card .seg { display: flex; width: 100%; }
  .acct-card .seg .seg-btn { flex: 1 1 0; min-height: 38px; }

  /* 卡片头：标签允许换行不挤压 */
  .acct-head { gap: 6px; }
  .acct-no { font-size: 13px; }

  /* 折叠面板在手机上更好点 */
  .panel-fold > summary { min-height: 48px; }
  .panel-fold > summary strong { font-size: 16px; }
  .panel-fold .fold-meta { font-size: 11.5px; }
}

/* ==========================================================
   手机端账号列表：默认一行摘要（手风琴），点开才是完整卡片
   解决「卡片一多、滑下来眼花缭乱」
   ========================================================== */
.acct-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 0 12px;
  padding-bottom: 2px;
}
.acct-filter::-webkit-scrollbar { display: none; }
.fchip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.fchip b { font-weight: 600; }
.fchip.on {
  background: rgba(10, 124, 255, 0.1);
  border-color: rgba(10, 124, 255, 0.4);
  color: var(--blue-deep);
  font-weight: 600;
}

.acct-rows { display: flex; flex-direction: column; gap: 8px; }
/* 两行式摘要：第一行 蝙蝠号 + 数量；第二行 编号 · 状态（彩点） */
.acct-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.acct-row:active { background: var(--surface-2); }
.acct-row.warn { border-color: rgba(184, 70, 10, 0.35); background: #fffdf8; }
.acct-row .row-main { flex: 1 1 auto; min-width: 0; }
.acct-row .row-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.acct-row .row-title .mono {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-row .row-num { font-size: 12px; color: var(--muted); flex: none; white-space: nowrap; }
.acct-row .row-num b { font-size: 15px; color: var(--text); font-weight: 700; margin-left: 3px; }
.acct-row .row-sub {
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.acct-row .row-side { flex: none; display: flex; align-items: center; }
.acct-row .fold-chevron {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--faint);
  transform: rotate(-90deg);
}

/* 行状态：彩点 + 文字（不再用药丸标签，颜色即语义） */
.row-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  flex: none;
}
.row-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.row-state.blue { color: var(--blue-deep); }
.row-state.gray { color: var(--muted); }
.row-state.red { color: #c0362c; }
.row-state.orange { color: #b8460a; }
.row-state.green { color: var(--green); }

/* 手机端展开卡片右上角的「收起」按钮 */
.row-fold-btn {
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.row-fold-btn svg { width: 16px; height: 16px; transform: rotate(180deg); }
.row-fold-btn:active { background: var(--surface-2); }
