/* ==========================================================================
   设计系统 —— 浅色主题
   所有颜色、圆角、阴影都以 CSS 变量定义，改主题只需改这一处。
   ========================================================================== */

:root {
  /* 主色：TikTok 品牌色系的克制版本，避免大面积高饱和造成视觉疲劳 */
  --brand:          #16181c;
  --brand-soft:     #f1f2f4;
  --accent:         #2f6feb;
  --accent-hover:   #2559c4;
  --accent-soft:    #eef4ff;
  --accent-ring:    rgba(47, 111, 235, .18);

  --pink:           #fe2c55;
  --cyan:           #25f4ee;

  /* 中性色阶 */
  --bg:             #f7f8fa;
  --surface:        #ffffff;
  --surface-2:      #fbfbfc;
  --border:         #e6e8eb;
  --border-strong:  #d4d7dc;

  --text:           #16181c;
  --text-soft:      #5b6270;
  --text-muted:     #8a909c;
  --text-invert:    #ffffff;

  /* 语义色 */
  --success:        #12a150;
  --success-soft:   #e8f7ee;
  --warning:        #b7791f;
  --warning-soft:   #fdf6e3;
  --danger:         #d93025;
  --danger-soft:    #fdecea;
  --info:           #2f6feb;
  --info-soft:      #eef4ff;

  /* 圆角 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* 阴影：浅色主题下要克制，靠边框而不是重阴影分隔 */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .10);
  --shadow-xl: 0 24px 56px rgba(16, 24, 40, .14);

  /* 布局尺寸 */
  --nav-h: 64px;
  --sidebar-w: 236px;

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

  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ==========================================================================
   基础重置
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; line-height: 1.3; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

/* 键盘可达性：只在键盘导航时显示焦点环 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ==========================================================================
   布局
   ========================================================================== */

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding-inline: 24px;
}

.container-narrow { max-width: 900px; }

/* 顶部导航 */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

/*
 * 三栏 grid：左品牌 / 中导航 / 右操作。
 * 用 grid 的 1fr auto 1fr 而不是 flex + margin:auto ——
 * 后者会让中间导航在「剩余空间」里居中，两侧宽度不等时就会偏。
 */
.navbar-inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

/* 左：Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.01em;
}
.brand:hover { color: var(--text); }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }

/* 中：导航链接（grid 中间列，天然居中） */
.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: var(--r-md);
  color: var(--text-soft);
  font-weight: 500;
  transition: all .15s var(--ease);
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text); background: var(--brand-soft); }
.nav-links a.is-active { color: var(--text); background: var(--brand-soft); }

/* 右：操作区（grid 第三列，靠右对齐） */
.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--brand-soft);
  border-radius: var(--r-full);
}
.lang-switch a {
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}
.lang-switch a:hover { color: var(--text); }
.lang-switch a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* 移动端汉堡按钮 */
.nav-toggle {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  cursor: pointer;
  padding: 0;
  place-items: center;
}
.nav-toggle svg { width: 18px; height: 18px; }

/* ==========================================================================
   按钮
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s var(--ease);
  text-decoration: none;
  background: none;
}

.btn:disabled, .btn.is-loading { opacity: .55; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-dark { background: var(--brand); color: #fff; }
.btn-dark:hover { background: #2b2f36; color: #fff; }

.btn-default {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-default:hover { background: var(--surface-2); border-color: var(--text-muted); color: var(--text); }

.btn-ghost { color: var(--text-soft); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b7261c; color: #fff; }

.btn-danger-ghost { color: var(--danger); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger); }

.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: var(--r-sm); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }

/* ==========================================================================
   卡片
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title { font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body-flush { padding: 0; }
.card-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/*
 * 可折叠卡片：把 <details> 的 summary 当标题栏用。
 * 收起时不画分割线，展开时才画，否则卡片下沿会多出一条悬空的线。
 */
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }

details.card > summary.card-head {
  border-bottom: 0;
  border-radius: var(--r-lg);
  cursor: pointer;
  user-select: none;
}
details.card[open] > summary.card-head {
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
/* 右侧的展开箭头 */
details.card > summary.card-head::after {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform .2s;
}
details.card[open] > summary.card-head::after {
  transform: rotate(-135deg);
}

/* ==========================================================================
   表单
   ========================================================================== */

.field { margin-bottom: 16px; }

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.label .req { color: var(--danger); margin-left: 2px; }
.label .opt { color: var(--text-muted); font-weight: 400; margin-left: 4px; }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  appearance: none;
}

.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.input.is-error, .select.is-error, .textarea.is-error { border-color: var(--danger); }
.input.is-error:focus { box-shadow: 0 0 0 3px rgba(217, 48, 37, .15); }

.textarea { resize: vertical; min-height: 96px; line-height: 1.65; }
.textarea-mono { font-family: var(--font-mono); font-size: 13px; }

.select {
  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='%238a909c' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* 小尺寸：卡片头部里的搜索框/筛选下拉（跟按钮同一行，不能撑高） */
.input-sm, .select-sm { padding: 7px 11px; font-size: 13px; }
.select-sm { padding-right: 30px; background-position: right 9px center; }

.input-hint { margin-top: 5px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.input-error { margin-top: 5px; font-size: 12px; color: var(--danger); }

/*
 * 分段选择：把「单选」从下拉框改成按钮组。
 * 选项全部摊开，少一次点击，也不用点开才知道有哪些选项。
 * 用原生 radio 实现，无 JS，禁用时的降级也正常。
 */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.segmented label {
  padding: 7px 14px;
  border-radius: calc(var(--r-md) - 3px);
  font-size: 13px;
  font-weight: 550;
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented label:hover { color: var(--text); }
.segmented input:checked + label {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}
.segmented input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.segmented input:disabled + label {
  cursor: not-allowed;
  color: var(--text-muted);
  opacity: .6;
}
/* 未确定可用范围前整组隐藏；JS 通过 hidden 属性逐个控制 */
.segmented[hidden],
.segmented [hidden] { display: none !important; }

/* 标签行右侧的小计数器（如标题字数） */
.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.field-head .label { margin-bottom: 0; }
.char-count { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.char-count.is-over { color: var(--danger); font-weight: 600; }

/* 输入框内嵌前缀/后缀 */
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 40px; }
.input-group .input-icon {
  position: absolute;
  left: 13px;
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

/* 复选框 */
.checkbox {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
}
.checkbox input {
  width: 16px; height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.checkbox a { font-weight: 500; }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 42px; height: 24px;
  background: var(--border-strong);
  border-radius: var(--r-full);
  position: relative;
  transition: background .2s var(--ease);
  flex-shrink: 0;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform .2s 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: 0 0 0 3px var(--accent-ring); }
.switch-label { font-size: 13px; font-weight: 500; }

/* 表单网格 */
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .field-full { grid-column: 1 / -1; }

/* ==========================================================================
   徽标 / 状态
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-neutral { background: var(--brand-soft);   color: var(--text-soft); }

/* ==========================================================================
   提示条
   ========================================================================== */

/*
 * hidden 属性必须真的藏住 —— 浏览器默认的 `[hidden]{display:none}` 是**元素选择器**，
 * 优先级低于任何类选择器，所以 `.alert{display:flex}` 会把它盖掉：页面上就会出现
 * 一条空的粉色/黄色色块（本项目的错误提示都是 `<div class="alert" hidden>`，
 * 实测每个页面都中招）。这里用 !important 兜底，别再逐个类去加 [hidden] 规则。
 */
[hidden] { display: none !important; }

/*
 * ⚠️⚠️ `display:flex` 是给**图标 + 文字**对齐用的，代价是：**文字里不能有裸的行内元素**。
 * 直接写 `<div class="alert">文字<b>加粗</b>文字</div>` 时，`<b>` 会变成一个 flex item、
 * 和文字并排成两列 —— 实测「真的生效」这种加粗短语会被甩到行尾，看着像排版坏了
 * （2026-09-28 一次修了 6 个页面：头像/认证/采集设置、采集出口、转发批次、转发）。
 * **写法：整段文字包一个 `<span>`，`<b>`/`<code>`/`<a>` 放在 span 里面。**
 */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-soft); color: #0b6b35; border-color: #bfe6cd; }
.alert-danger  { background: var(--danger-soft);  color: #9c1f16; border-color: #f6c9c4; }
.alert-warning { background: var(--warning-soft); color: #8a5a0b; border-color: #f0dfae; }
.alert-info    { background: var(--info-soft);    color: #1a4fa8; border-color: #c7dbfb; }

/* 浮动提示（由 JS 注入） */
.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 380px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in .25s var(--ease);
}
.toast.is-out { animation: toast-out .2s var(--ease) forwards; }
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

@keyframes toast-in  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ==========================================================================
   表格
   ========================================================================== */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .td-nowrap { white-space: nowrap; }
.table .td-right { text-align: right; }
.table .td-mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-soft); }

.table-empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-muted);
}
.table-empty svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .4; }
.table-empty p { font-size: 14px; margin-bottom: 4px; color: var(--text-soft); font-weight: 500; }
.table-empty span { font-size: 13px; }

/* ==========================================================================
   分页
   ========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pagination-info { font-size: 13px; color: var(--text-muted); }
.pagination-links { display: flex; gap: 6px; }

.pagination-links a, .pagination-links span {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface);
}
.pagination-links a:hover { border-color: var(--text-muted); color: var(--text); }
.pagination-links .is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination-links .is-disabled { opacity: .45; pointer-events: none; }

/* ==========================================================================
   统计卡片
   ========================================================================== */

.stat-grid {
  display: grid;
  /*
   * 必须是 auto-fit 而不是 auto-fill：
   * auto-fill 会保留空轨道 —— 5 个卡片放在能容纳 6 列的容器里时，
   * 会多出一条空轨道，卡片各占 1/6 宽，右侧就空出一截。
   * auto-fit 会把没有内容的轨道收起来，卡片自动撑满整行。
   */
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

/* 固定六列：一屏铺满一行，窄屏逐级回落 */
.stat-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1200px) { .stat-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .stat-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 八列（采集页：总数/待提取/成功 + 五种结果逐类一张卡） */
.stat-grid-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
@media (max-width: 1500px) { .stat-grid-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .stat-grid-8 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .stat-grid-8 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==========================================================================
   团队页（/users）：权限矩阵 + 口令弹窗
   ========================================================================== */
.perm-matrix td, .perm-matrix th { padding: 9px 12px; }
.perm-matrix tbody tr:hover { background: var(--surface-2); }
.perm-matrix input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
/* 锁定的 admin 列：灰掉但**不隐藏** —— 让人看得见「它确实有全部权限」 */
.perm-matrix input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .45; }
.perm-matrix tfoot td { border-top: 1px solid var(--border); padding-top: 12px; }

.pw-box {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
}
.pw-box code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
  word-break: break-all;
  user-select: all;          /* 点一下就能全选，方便手抄 */
}

/* ==========================================================================
   运行日志（/logs）
   三件必须做对的事（见 app/engine/logs.py 的注释）：折叠连续重复、默认藏掉空闲心跳、
   增量追加而不是整页重渲染。这里是纯展示层。
   ========================================================================== */
.lg-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
/* ---- 顶部健康概览：一张卡一个分类（点一下只看这一家） ---- */
.lg-ov { margin-bottom: 16px; }
button.stat.lg-ov-card {                 /* .stat 原本是给 div 写的，button 要重置一下 */
  width: 100%; text-align: left; font: inherit; cursor: pointer;
  min-width: 0;                          /* 窄屏允许收缩，否则网格被撑破 */
}
.lg-ov-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.lg-ov-card .stat-foot { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 「最后一条错误」——这一行是「一眼看出谁有问题」的关键，不用翻日志 */
.lg-ov-err {
  margin-top: 8px; padding-top: 7px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px; line-height: 1.45;
  color: var(--danger);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
  cursor: pointer;
}
.lg-ov-err b { font-variant-numeric: tabular-nums; margin-right: 4px; }
.lg-ov-err.is-none { color: var(--text-muted); cursor: default; border-top-color: transparent; }
.lg-spark { width: 100%; height: 22px; display: block; margin-top: 8px; color: var(--text-muted); }
.lg-spark rect { fill: currentColor; }
.lg-spark rect.is-now { fill: var(--accent); }
/* 「这一格没读到」≠「这一格没活动」：空桶画成虚线，别让人读成 0 */
.lg-spark rect.is-unknown { fill: none; stroke: var(--border-strong); stroke-dasharray: 2 2; }
.lg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block;
          flex-shrink: 0; margin-right: 6px; }

/* ---- 卡片流 ---- */
.lg-body {
  max-height: calc(100vh - 330px); min-height: 260px;
  overflow-y: auto; overflow-x: hidden;
  overflow-anchor: none;      /* 不关的话浏览器滚动锚定会和"贴底自动滚"打架 */
  background: var(--surface);
}
.acc-body.lg-lines { padding: 2px 0 8px; }
.lg-card > .acc-sum { gap: 8px; }
.lg-card .acc-num { margin-left: auto; }
.lg-card .lg-more { flex-shrink: 0; }
.lg-line {
  display: flex; align-items: baseline; gap: 9px;
  padding: 2px 16px 2px 14px;
  border-left: 2px solid transparent;
  font-family: var(--font-mono);
  font-size: 12.5px; line-height: 1.65;
}
.lg-line:hover { background: var(--surface-2); }
.lg-line.is-new { animation: lg-in .45s var(--ease); }
/* 只闪左侧色条、不闪底色 —— 以前动画作用在 background 上，
   会把 ERROR/WARNING 的红黄底色盖掉 0.5 秒，而且重载时 500 行一起闪 */
@keyframes lg-in { from { box-shadow: inset 3px 0 0 var(--accent); } to { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .lg-line.is-new { animation: none; } }

/* 级别用左侧色条 + 字色区分：一眼扫出哪几行是 ERROR */
.lg-line.is-error, .lg-line.is-critical { border-left-color: var(--danger); background: var(--danger-soft); }
.lg-line.is-warning { border-left-color: var(--warning); background: var(--warning-soft); }
.lg-line.is-debug { opacity: .7; }
.lg-line .lg-dot { align-self: center; margin-right: 0; }

/* 时间列用 ch 而不是 px：`21:09:40.580` 要 12.5 个等宽字符，84px 装不下
   → 以前会溢出格子压到级别列上（且容器 overflow-x:hidden，直接被裁掉） */
.lg-ts {
  flex: 0 0 13ch; white-space: nowrap; overflow: hidden;
  color: var(--text-soft);            /* 原来用 --text-muted，白底对比度只有 3.2:1 */
  font-variant-numeric: tabular-nums;
}
.lg-lv { flex: 0 0 34px; font-weight: 700; font-size: 11px; letter-spacing: .02em; }
.lg-line.is-error .lg-lv, .lg-line.is-critical .lg-lv { color: var(--danger); }
.lg-line.is-warning .lg-lv { color: var(--warning); }
.lg-line.is-info .lg-lv { color: var(--text-soft); }
.lg-src { flex: 0 0 104px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-msg { flex: 1; min-width: 0; word-break: break-word; }
.lg-range { flex: 0 0 auto; color: var(--text-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.lg-count {
  margin-left: 8px; padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--brand-soft); color: var(--text-soft);
  font-size: 11px; font-weight: 700;
}
.lg-agg { cursor: pointer; }
.lg-agg:hover { background: var(--accent-soft); }
/* 点聚合行展开的原始逐条 */
.lg-kids { border-left: 2px solid var(--border-strong); margin: 2px 0 6px 14px; padding-left: 8px; }
.lg-kids-head { font-size: 11.5px; color: var(--text-muted); padding: 3px 6px; }
.lg-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); font-family: var(--font-sans); }
.lg-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
           padding: 10px 20px; border-top: 1px solid var(--border); font-size: 12.5px; }

@media (max-width: 900px) {
  .lg-src { display: none; }        /* 窄屏先保住时间与消息 */
  .lg-ts { flex-basis: 12ch; }
  .lg-line { padding: 2px 10px; }
  .lg-card .lg-more { display: none; }   /* 窄屏按钮挤不下，用卡头点开看 */
}

/* 企业证书缩略图（企业池列表）：证书是横版扫描件，用扁矩形比正方形好认 */
.cert-thumb {
  height: 44px;
  width: auto;
  max-width: 120px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: zoom-in;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.cert-thumb:hover { transform: scale(1.04); box-shadow: var(--shadow-sm); }

/* 素材缩略图（改头像页）：小圆角方图，鼠标变手型提示可点开原图 */
.asset-thumb {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: zoom-in;
  transition: transform .15s var(--ease);
}
.asset-thumb:hover { transform: scale(1.06); }

/* ==========================================================================
   风琴折叠列表（采集页分组）
   ========================================================================== */
/* 风琴上方的操作条（勾选计数 + 主操作按钮） */
.acc-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.acc-toolbar .btn:disabled { opacity: .5; }

.acc-list { padding: 6px 0; }
.acc { border-bottom: 1px solid var(--border); }
.acc:last-child { border-bottom: 0; }

.acc-sum {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  cursor: pointer;
  list-style: none;
  transition: background .15s var(--ease);
}
.acc-sum::-webkit-details-marker { display: none; }
.acc-sum:hover { background: var(--surface-2); }
.acc[open] > .acc-sum { background: var(--surface-2); }

.acc-chevron { display: flex; color: var(--text-muted); transition: transform .18s var(--ease); flex-shrink: 0; }
.acc[open] .acc-chevron { transform: rotate(90deg); }
.acc-seq { color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.acc-name { font-weight: 600; font-size: 13.5px; min-width: 120px; flex: 1 1 200px; }
.acc-bar { display: flex; align-items: center; gap: 7px; flex: 0 0 160px; }
.acc-bar .progress { flex: 1; height: 6px; }
.acc-pct { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.acc-nums { display: flex; gap: 12px; flex-shrink: 0; }
.acc-num { font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc-num .k { color: var(--text-muted); font-size: 11px; margin-right: 2px; }
.acc-num.is-warn { color: var(--warning); }
.acc-num.is-ok { color: var(--success); }
.acc-num.is-bad { color: var(--danger); }
.acc-time { color: var(--text-muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.acc-ops { display: flex; gap: 2px; flex-shrink: 0; }
.acc-ops .btn { padding: 4px 8px; font-size: 12px; }
.acc-ops .js-gdel:hover { color: var(--danger); background: var(--danger-soft); }

.acc-body { padding: 4px 20px 18px; background: var(--surface); }
.acc-stats {
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 14px;
}
.acc-stat { font-size: 12.5px; color: var(--text-muted); }
.acc-stat .k { margin-right: 5px; }
.acc-stat b { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text); }
.acc-stat b.is-warn { color: var(--warning); }
.acc-stat b.is-ok { color: var(--success); }
.acc-stat b.is-bad { color: var(--danger); }
.acc-more { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); }

@media (max-width: 900px) {
  .acc-bar { display: none; }        /* 窄屏优先保住名称与计数 */
  .acc-time { display: none; }
  .acc-sum { gap: 8px; padding: 12px 14px; }
}

/* ==========================================================================
   启用开关（采集代理池用）
   ========================================================================== */
.pp-switch { display: inline-flex; align-items: center; cursor: pointer; }
.pp-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.pp-switch-track {
  width: 34px; height: 19px;
  border-radius: var(--r-full);
  background: var(--border-strong);
  transition: background .16s var(--ease);
  position: relative;
  display: inline-block;
}
.pp-switch-dot {
  position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform .16s var(--ease);
}
.pp-switch input:checked + .pp-switch-track { background: var(--success); }
.pp-switch input:checked + .pp-switch-track .pp-switch-dot { transform: translateX(15px); }
.pp-switch input:focus-visible + .pp-switch-track { box-shadow: 0 0 0 3px var(--accent-ring); }
.pp-switch input:disabled + .pp-switch-track { opacity: .5; cursor: not-allowed; }

/* ==========================================================================
   采集分组表：计数格可点筛选 + 行内展开
   （转发页的链接池还在用上面那套 .acc-* 风琴，两套并存，别互相删）
   ========================================================================== */

.g-chevron {
  display: inline-flex;
  color: var(--text-muted);
  vertical-align: -2px;
  margin-right: 5px;
  transition: transform .18s var(--ease);
}
.js-grow { cursor: pointer; }
.js-grow.is-open { background: var(--surface-2); }
.js-grow.is-open .g-chevron { transform: rotate(90deg); }

/* 计数列：**表头和数据必须同一个对齐**，否则看着就是错位的。
   ⚠️⚠️ 这里的选择器不能简写成 `.g-numcol` —— 本项目实测踩过：
     `.table th { text-align: left }` 的优先级是 (0,1,1)，
     而 `.g-numcol { text-align: right }` 只有 (0,1,0)，**输给前者** →
     结果**表头左对齐、数据右对齐**，两边错开（用户报「表头要和下面的数据居中对齐」）。
   写成 `.table th.g-numcol` (0,2,1) 才压得住。加对齐规则时先数一遍优先级。 */
.table th.g-numcol, .table td.g-numcol { text-align: center; }
.g-num {
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
}
.g-num:hover { color: var(--accent); text-decoration: underline; }
/* 0 值淡化：一眼看过去先看到有数的那些 */
.g-num.is-zero { color: var(--text-muted); }
.g-num.is-ok { color: var(--success); }
.g-num.is-warn { color: var(--warning); }
.g-num.is-bad { color: var(--danger); }
/* 当前正被筛的那一格 */
.g-num.is-on { color: var(--accent); font-weight: 700; }
.g-num.is-on::after { content: " ▾"; font-size: 10px; }

/* 行内展开：明细整块塞进一个跨列单元格，不另起卡片 */
.g-detail-cell { padding: 0 !important; background: var(--surface-2); }
.g-detail { padding: 14px 18px 18px; }
.g-detail-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px; font-size: 12.5px; color: var(--text-muted);
}
.g-detail-head .badge { font-weight: 600; }
.g-detail table.table { background: var(--surface); }
.g-detail-empty { padding: 18px; text-align: center; color: var(--text-muted); font-size: 13px; }
.g-loading { padding: 18px; text-align: center; color: var(--text-muted); font-size: 13px; }

@media (max-width: 1100px) {
  /* 12 列在窄屏必然挤，把「需登录可见」和「创建时间」先让出去 */
  #g-table th:nth-child(10), #g-table td:nth-child(10),
  #g-table th:nth-child(13), #g-table td:nth-child(13) { display: none; }
}

.stat {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.stat:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.stat-label { font-size: 13px; color: var(--text-soft); font-weight: 500; }
.stat-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--text-soft);
  flex-shrink: 0;
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.is-accent  { background: var(--accent-soft);  color: var(--accent); }
.stat-icon.is-success { background: var(--success-soft); color: var(--success); }
.stat-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.is-danger  { background: var(--danger-soft);  color: var(--danger); }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-foot { margin-top: 6px; font-size: 12px; color: var(--text-muted); }

/* ==========================================================================
   用户中心布局（侧边栏）
   ========================================================================== */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-head {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.sidebar-section {
  padding: 14px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all .15s var(--ease);
}
.sidebar-link:hover { background: var(--brand-soft); color: var(--text); }
.sidebar-link.is-active { background: var(--brand); color: #fff; }
.sidebar-link.is-active:hover { background: var(--brand); color: #fff; }
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-link .count {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--text-soft);
}
.sidebar-link.is-active .count { background: rgba(255,255,255,.2); color: #fff; }

/* ---- 二级菜单（一级类目点开才展开）------------------------------------ */
.sidebar-group-toggle {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.sidebar-group-toggle .sidebar-caret {
  margin-left: auto;
  display: flex;
  color: currentColor;
  opacity: .55;
  transition: transform .18s var(--ease);
}
.sidebar-group-toggle .sidebar-caret svg { width: 15px; height: 15px; }
.sidebar-group.is-open > .sidebar-group-toggle { color: var(--text); }
.sidebar-group.is-open > .sidebar-group-toggle .sidebar-caret { transform: rotate(180deg); }

.sidebar-sub {
  display: none;
  margin: 0 0 4px 17px;       /* 左边缩进对齐一级项的图标 */
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.sidebar-group.is-open > .sidebar-sub { display: block; }
.sidebar-sublink {
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 400;
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13px;
}
.sidebar-user:hover { background: var(--brand-soft); color: var(--text); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-soft);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-soft);
  overflow: hidden;
}
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }

/* 主内容区 */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main-head {
  padding: 22px 28px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.main-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.main-title { font-size: 20px; font-weight: 700; letter-spacing: -.015em; }
.main-subtitle { margin-top: 3px; font-size: 13.5px; color: var(--text-muted); }
.main-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.main-body { padding: 22px 28px 40px; flex: 1; }

/* ==========================================================================
   首页英雄区
   ========================================================================== */

.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

/* 背景装饰：极淡的双色光斑，暗示品牌色但不喧宾夺主 */
.hero::before,
.hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}
.hero::before {
  width: 460px; height: 460px;
  background: rgba(37, 244, 238, .10);
  top: -180px; right: 8%;
}
.hero::after {
  width: 380px; height: 380px;
  background: rgba(254, 44, 85, .07);
  bottom: -200px; right: 26%;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 56px;
  align-items: center;
  padding: 64px 0 72px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 20px;
}
.hero-badge svg { width: 14px; height: 14px; }

.hero-title {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.03em;
  margin-bottom: 18px;
}

.hero-subtitle {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-soft);
  margin-bottom: 28px;
  max-width: 540px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 34px; }

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.hero-points li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--text-soft);
  font-weight: 500;
}
.hero-points svg { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }

/* 右侧登录卡片 */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  padding: 30px;
  position: relative;
  z-index: 2;
}
.auth-card-head { margin-bottom: 22px; text-align: center; }
.auth-card-title { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.auth-card-sub { margin-top: 6px; font-size: 13.5px; color: var(--text-muted); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all .15s var(--ease);
  text-decoration: none;
}
.btn-google:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.btn-google svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ==========================================================================
   首页区块
   ========================================================================== */

.section { padding: 72px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }

.section-head { text-align: center; max-width: 640px; margin: 0 auto 46px; }
.section-title { font-size: 30px; font-weight: 700; letter-spacing: -.025em; margin-bottom: 12px; }
.section-desc { font-size: 15px; color: var(--text-soft); line-height: 1.7; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.feature {
  padding: 26px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: all .2s var(--ease);
}
.feature:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 16px;
}
.feature-icon svg { width: 21px; height: 21px; }
.feature-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feature-desc { font-size: 13.5px; line-height: 1.7; color: var(--text-soft); }

/* 步骤 */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px; }
.step { position: relative; padding-left: 0; }
.step-num {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 14px;
}
.step-title { font-size: 16px; font-weight: 600; margin-bottom: 7px; }
.step-desc { font-size: 13.5px; line-height: 1.7; color: var(--text-soft); }

/* 数据统计条 */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 24px;
  padding: 32px 0;
}
.stats-bar-item { text-align: center; }
.stats-bar-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stats-bar-label { margin-top: 5px; font-size: 13px; color: var(--text-muted); }

/* 「全局资源」卡：值可能是一句话（无活动桶 / 各模块租约清单），得缩号 */
.stats-bar-note { font-size: 19px; font-weight: 700; }
.stats-bar-sub  { font-size: 18px; font-weight: 600; color: var(--text-muted); }
.stats-bar-foot { margin-top: 5px; font-size: 12px; color: var(--text-muted); }
.stats-bar .sep { margin: 0 5px; color: var(--text-soft); font-weight: 600; }

/* FAQ */
.faq-list { max-width: 780px; margin: 0 auto; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-q {
  width: 100%;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  font-family: inherit;
}
.faq-q:hover { background: var(--surface-2); }
.faq-q svg {
  width: 18px; height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform .2s var(--ease);
}
.faq-item.is-open .faq-q svg { transform: rotate(180deg); }
.faq-a {
  display: none;
  padding: 0 20px 18px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-soft);
}
.faq-item.is-open .faq-a { display: block; }

/* ==========================================================================
   页脚
   ========================================================================== */

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 44px 0 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(2, 1fr);
  gap: 40px;
  margin-bottom: 32px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 700; }
.footer-desc { font-size: 13px; color: var(--text-muted); line-height: 1.7; max-width: 320px; }
.footer-col h4 { font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { font-size: 13px; color: var(--text-soft); }
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}
.footer-disclaimer { font-size: 12px; color: var(--text-muted); line-height: 1.6; max-width: 620px; }

/* ==========================================================================
   内容页（条款/隐私/联系）
   ========================================================================== */

.page-head {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 44px 0 36px;
}
.page-head h1 { font-size: 32px; font-weight: 700; letter-spacing: -.025em; }
.page-head p { margin-top: 10px; font-size: 14.5px; color: var(--text-soft); }

.prose { font-size: 14.5px; line-height: 1.85; color: var(--text-soft); }
.prose h2 {
  font-size: 19px;
  font-weight: 650;
  color: var(--text);
  margin: 34px 0 12px;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 16px; font-weight: 600; color: var(--text); margin: 24px 0 10px; }
.prose p { margin-bottom: 14px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 7px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

/* ==========================================================================
   空状态
   ========================================================================== */

.empty {
  text-align: center;
  padding: 72px 24px;
}
.empty-icon {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--text-muted);
}
.empty-icon svg { width: 26px; height: 26px; }
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 7px; }
.empty-desc { font-size: 13.5px; color: var(--text-muted); max-width: 400px; margin: 0 auto 20px; line-height: 1.7; }

/* ==========================================================================
   账号卡片
   ========================================================================== */

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: all .2s var(--ease);
}
.account-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

.account-top { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.account-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-soft);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  color: var(--text-soft);
  overflow: hidden;
}
.account-meta { min-width: 0; flex: 1; }
.account-name {
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-name svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.account-id {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px 0;
  border-block: 1px solid var(--border);
  margin-bottom: 14px;
}
.account-stat { text-align: center; }
.account-stat-value {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.account-stat-label { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.account-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ==========================================================================
   进度条
   ========================================================================== */

.progress {
  height: 5px;
  background: var(--brand-soft);
  border-radius: var(--r-full);
  overflow: hidden;
  min-width: 60px;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width .4s var(--ease);
}
.progress-bar.is-success { background: var(--success); }
.progress-bar.is-danger  { background: var(--danger); }

/* 不确定进度：服务端**处理完才返回**、中途不回报百分比的活儿（导入账号/新增链接/
   添加企业）用它，走一条来回扫的光带。配合 app.js 的 window.workProgress() 使用，
   它同时显示「已等待 N 秒」—— 光带只说明还活着，秒数才说明等了多久。
   ⚠️ 别再在这类流程里画假百分比（曾经爬到 88% 就停住等后端，用户看到的是「卡住」）。 */
.progress-bar.is-indeterminate {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 40%, transparent 60%);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  animation: progress-sweep 1.15s linear infinite;
}
@keyframes progress-sweep {
  0%   { background-position: -45% 0; }
  100% { background-position: 145% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-bar.is-indeterminate { animation: none; background-position: 0 0; }
}

/* ==========================================================================
   图表（纯 CSS/SVG 实现，不依赖图表库）
   ========================================================================== */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding: 16px 0 0;
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  min-width: 0;
  position: relative;
}
.chart-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: opacity .15s var(--ease);
}
.chart-bar-ok { background: var(--accent); }
.chart-bar-fail { background: #f5b5ae; }
.chart-col:hover .chart-bar { opacity: .78; }

.chart-labels {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.chart-labels span {
  flex: 1;
  text-align: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 14px;
}
.chart-legend-item { display: flex; align-items: center; gap: 6px; }
.chart-legend-dot { width: 9px; height: 9px; border-radius: 2px; }

/* 迷你趋势条 */
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 32px; }
.sparkline span {
  flex: 1;
  background: var(--accent);
  border-radius: 2px;
  min-height: 2px;
  opacity: .75;
}

/* ==========================================================================
   标签页
   ========================================================================== */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

/*
 * 换行变体：标签数量多、且右侧还要放搜索框时用这个。
 * 光写 flex-wrap:wrap 不够 —— 基类的 overflow-x:auto 会让另一轴自动变成 auto，
 * 标签一换行就顶出一条纵向滚动条。所以这里必须把两轴都放开。
 */
.tabs-wrap {
  flex-wrap: wrap;
  overflow: visible;
  row-gap: 4px;
}
.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 550;
  color: var(--text-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count {
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--brand-soft);
  font-size: 11px;
  font-weight: 700;
}
.tab.is-active .count { background: var(--accent-soft); color: var(--accent); }

/* ==========================================================================
   右下角悬浮联系方式（Telegram / WhatsApp）
   由后台「系统设置 → 站点设置」开关控制，未开启时不渲染
   ========================================================================== */

.contact-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-fab-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .18);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
  position: relative;
}
.contact-fab-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 26px rgba(16, 24, 40, .26);
  color: #fff;
}
.contact-fab-btn svg { width: 24px; height: 24px; }

.contact-fab-telegram { background: #229ED9; }
.contact-fab-telegram:hover { background: #1d8bbe; }
.contact-fab-whatsapp { background: #25D366; }
.contact-fab-whatsapp:hover { background: #1eb958; }

/* 悬停时浮出的文字标签 */
.contact-fab-btn::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 11px;
  background: var(--brand);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--r-md);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s var(--ease);
}
.contact-fab-btn:hover::after { opacity: 1; }

@media (max-width: 560px) {
  .contact-fab { right: 14px; bottom: 14px; gap: 10px; }
  .contact-fab-btn { width: 44px; height: 44px; }
  .contact-fab-btn svg { width: 22px; height: 22px; }
  .contact-fab-btn::after { display: none; }
}

/* ==========================================================================
   悬浮窗（Modal）
   带入场动效：遮罩淡入 + 卡片轻微上浮缩放。
   尊重 prefers-reduced-motion —— 用户系统里关了动画就不播。
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: grid;
  place-items: center;
  padding: 20px;
  /*
   * 遮罩层自己不滚动。若在这里开 overflow:auto，内容超高时滚动条会贴在
   * 屏幕最右边缘，看着像页面出问题了。改成卡片内部滚动（见 .modal-body），
   * 头部与底部固定，滚动条落在卡片内，视觉上才是"弹窗在滚"。
   */
  overflow: hidden;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  backdrop-filter: blur(2px);
  animation: modal-fade .18s var(--ease);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  animation: modal-pop .22s var(--ease);
  overflow: hidden;   /* 让圆角裁住内部滚动区，滚动条不会盖住圆角 */
}

@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal-card { animation: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 650; }
.modal-sub { margin-top: 3px; font-size: 13px; color: var(--text-muted); }

.modal-close {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  border-radius: var(--r-md);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s var(--ease);
}
.modal-close:hover { background: var(--brand-soft); color: var(--text); }

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;   /* flex 子项默认 min-height:auto，不加这行内容超高时不会收缩滚动 */
}

/* 弹窗内的滚动条收窄、淡化，不抢视觉 */
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 2px solid var(--surface);
}
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.modal-body { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  flex-shrink: 0;
}

/* 拖拽上传区 */
.dropzone {
  /*
   * ⚠️⚠️ `display: block` **不能删**（2026-09-30 修，用户报的「只能拖到左侧」）。
   *
   * 这个类是挂在 `<label>` 上的，而 **label 默认是 `display: inline`**。
   * 它里面装的又全是块级 `<div>`（图标/标题/提示），于是：
   *   · 行内盒被块级子元素**打碎**，自身基本是空的；
   *   · 而边框与背景**只围绕行内盒片段绘制** → 整圈虚线只剩**最左边一条竖线**，
   *     背景也不铺开。看上去"框"只有左边那一窄条。
   * 用户于是只能把文件拖到左边 —— 中间和右边**既没有视觉提示，也不是有效的投放目标**。
   *
   * 实测（Playwright 截图 + `getComputedStyle`）：修之前 `.dropzone` 的
   * `computed display = inline`，虚框只画在左边缘；全站 4 个拖拽区（账号导入 /
   * 头像素材 / 转发链接 / 发布素材）**全部如此**，所以修这一处是全站生效。
   */
  display: block;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .15s var(--ease);
  background: var(--surface-2);
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}
.dropzone-icon {
  width: 44px; height: 44px;
  margin: 0 auto 12px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-xs);
}
.dropzone-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.dropzone-hint { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }

/* 上传进度 */
.upload-progress { margin-top: 14px; }
.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  font-size: 12.5px;
}
.upload-progress-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-progress-pct {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}
.upload-progress .progress { height: 6px; }

/* ==========================================================================
   时间轴
   用于「运行日志」页：左侧定宽时间列 + 中间竖线圆点 + 右侧卡片。
   时间用 tabular-nums 等宽数字，保证不同时刻的秒数纵向对齐、一眼可扫。
   ========================================================================== */

.tl-row { display: flex; align-items: stretch; }

.tl-time {
  flex: 0 0 92px;
  width: 92px;
  padding-right: 14px;
  text-align: right;
}
.tl-day {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tl-clock {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.tl-rail {
  position: relative;
  flex: 0 0 18px;
  width: 18px;
  display: flex;
  justify-content: center;
}
.tl-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* 竖线从圆点下沿连到下一条的圆点上沿（-6px 正好补上下一行圆点的上边距） */
.tl-line {
  position: absolute;
  left: 50%;
  width: 1px;
  margin-left: -.5px;
  top: 16px;
  bottom: -6px;
  background: var(--border);
}

.tl-main { flex: 1; min-width: 0; padding-bottom: 14px; }
.tl-row:last-child .tl-main { padding-bottom: 0; }

@media (max-width: 560px) {
  .tl-time { flex-basis: 64px; width: 64px; padding-right: 9px; }
  .tl-clock { font-size: 13.5px; }
  .tl-rail { flex-basis: 14px; width: 14px; }
}

/* ==========================================================================
   工具类
   ========================================================================== */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* 表格里的小头像 */
.cell-user { display: flex; align-items: center; gap: 9px; min-width: 0; }

/*
 * 表格头像。必须显式写 max-width:none ——
 * 全局重置里有 img{max-width:100%}，当单元格比图片窄时浏览器会只压缩宽度、
 * 高度不变，圆头像就被拉成竖长的椭圆。这里锁死宽高比。
 */
.avatar-img {
  width: 40px;
  height: 40px;
  max-width: none;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin-inline: auto;
  background: var(--brand-soft);
}
.avatar-md { width: 40px; height: 40px; font-size: 15px; }

/* ==========================================================================
   自定义下拉框
   原生 <select> 展开后的选项面板由浏览器绘制，CSS 几乎无法干预，
   浅色主题下会显得突兀。这里用 button + 浮层自己实现，外观完全可控。
   键盘支持：Enter/Space 展开，↑↓ 移动，Enter 选中，Esc 关闭。
   ========================================================================== */

.dropdown { position: relative; display: inline-block; }

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 132px;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.dropdown-toggle:hover { border-color: var(--text-muted); }

/*
 * 小尺寸：卡片头部筛选条里用的（跟 .input-sm / .select-sm 同一行，不能撑高）。
 * 不能直接复用 .select-sm —— 两者都是单类选择器，.dropdown-toggle 在文件里
 * 靠后，padding 会盖掉 .select-sm 的，得单独写一条。
 */
.dropdown-toggle-sm { min-width: 0; padding: 7px 11px; font-size: 13px; font-weight: 500; }
.dropdown-toggle-sm svg { width: 13px; height: 13px; }
.dropdown.is-open .dropdown-toggle {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.dropdown-toggle svg {
  width: 15px; height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform .18s var(--ease);
}
.dropdown.is-open .dropdown-toggle svg { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 100%;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: dropdown-in .14s var(--ease);
}
.dropdown.is-open .dropdown-menu { display: block; }

/*
 * 展开时 JS 会把它改成 position:fixed 并按触发按钮定位（见 app.js 的 place()）。
 *
 * 为什么必须 fixed：弹窗正文 .modal-body 是 overflow:auto 的滚动区，它会给
 * 绝对定位的后代**建裁剪区** —— 菜单向下展开被底边裁、翻到上方又被顶边裁，
 * 翻转不解决问题，因为裁剪的是容器本身。fixed 直接脱离所有祖先的裁剪。
 * 代价是坐标会随滚动/改变窗口失效，所以打开期间监听 scroll/resize 直接关掉。
 */
.dropdown-menu.is-floating { position: fixed; top: auto; bottom: auto; left: auto; right: auto; }

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dropdown-menu { animation: none; }
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: none;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--text-soft);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.dropdown-item:hover { background: var(--brand-soft); color: var(--text); }
.dropdown-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dropdown-item .check { opacity: 0; flex-shrink: 0; }
.dropdown-item.is-active .check { opacity: 1; }

/* 单元格与表头的居中对齐（表头跟着数据一起居中） */
.table .td-center { text-align: center; }

/*
 * 简介单元格：把整列宽度用满，不做 max-width 限制。
 * TikTok 的简介上限就是 160 字符，正常两三行内一定放得下，
 * 行数上限只是防御历史脏数据（早期可能存了超长内容）。
 */
.bio-cell {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-soft);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/*
 * 表格里「被表单包住的按钮」。
 * form 默认是块级元素，放进 flex 容器会被 align-items:stretch 拉满高度，
 * 里面的按钮看起来就比旁边直接放的 <a>/<button> 低一截。
 * 让 form 自己也成为一条 flex 线，并把外边距清零，就能对齐了。
 */
.table form {
  display: flex;
  margin: 0;
}
.table td .flex,
.table td [class*="flex"] {
  align-items: center;
}

/* 危险动作但保留按钮边框，与相邻按钮视觉一致 */
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.cell-user-text { min-width: 0; }
.cell-user-name { font-weight: 600; font-size: 13.5px; }
.cell-user-sub { font-size: 12px; color: var(--text-muted); }

/* 代码块 */
.code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 2px 6px;
  background: var(--brand-soft);
  border-radius: var(--r-sm);
  color: var(--text-soft);
  word-break: break-all;
}
.code-block {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow-x: auto;
  line-height: 1.65;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ==========================================================================
   响应式
   ========================================================================== */

@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; padding: 48px 0 56px; }
  .hero-title { font-size: 36px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}

@media (max-width: 860px) {
  /* 侧边栏改为抽屉式 */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.is-open { transform: none; }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .4);
    z-index: 199;
  }
  .sidebar-backdrop.is-open { display: block; }

  .main-head, .main-body { padding-inline: 18px; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 18px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    margin: 0;
  }
  .nav-links.is-open { display: flex; }
  .nav-toggle { display: grid; }

  .navbar-inner { gap: 12px; }

  .form-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 30px; }
  .section { padding: 52px 0; }
  .section-title { font-size: 24px; }

  .stats-bar-value { font-size: 26px; }
  .stat-value { font-size: 22px; }

  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 560px) {
  .container { padding-inline: 16px; }
  .hero-inner { padding: 36px 0 44px; }
  .hero-title { font-size: 26px; }
  .hero-subtitle { font-size: 15px; }
  .auth-card { padding: 22px 18px; }
  .main-head, .main-body { padding-inline: 14px; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .account-grid { grid-template-columns: 1fr; }
  .toast-stack { left: 14px; right: 14px; top: 14px; }
  .toast { max-width: none; min-width: 0; }
  .hero-actions .btn { flex: 1; }
}

/* 打印：隐藏导航和操作按钮 */
@media print {
  .navbar, .sidebar, .main-actions, .footer, .toast-stack { display: none !important; }
  body { background: #fff; }
  .card { border-color: #ddd; box-shadow: none; }
}
