/* ============================================================
 * 千川投放优化系统 · SHA 设计规范 v2.3（严格对齐定稿 demo）
 * 参考：/root/.openclaw/workspace/image-page-sha-demo-approved-20260629.html
 * 基于 shadcn/ui v4：OKLCH 变量 · radius=0.625rem · Microsoft YaHei
 * ============================================================ */

:root {
  --font-sans-en: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  --font-sans-cn: "Microsoft YaHei", "微软雅黑", sans-serif;
  --font-number: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  /* ─── 基础色（严格对齐定稿 demo） ─── */
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.32 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(0.985 0 0);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --radius: 0.625rem;
  --success: oklch(0.62 0.18 145);
  --success-bg: oklch(0.97 0.035 145);
  --success-border: oklch(0.9 0.06 145);
  --warning: oklch(0.72 0.15 75);
  --warning-bg: oklch(0.98 0.04 85);
  --warning-border: oklch(0.92 0.08 85);
  --info: oklch(0.55 0.14 250);
  --info-bg: oklch(0.97 0.025 250);
  --info-border: oklch(0.91 0.04 250);
  --destructive-bg: oklch(0.97 0.018 25);
  --destructive-border: oklch(0.93 0.035 25);
  --surface: oklch(0.992 0 0);
  --surface-foreground: oklch(0.145 0 0);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  /* ─── 阴影 ─── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 2px 6px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 24px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans-en), var(--font-sans-cn);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  font-size: 14px;
}
button, input, textarea, select { font: inherit; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { font-weight: 600; letter-spacing: -0.015em; color: var(--foreground); }

/* ============================================================
 * 页面骨架：Sidebar + Main（内含 Topbar + Content）
 * ============================================================ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--surface);
}
.app.collapsed .sidebar { width: 56px; }

/* ─── Sidebar ─── */
/* ═══════════ Sidebar SHA v3 (1:1 from qianchuan-sidebar-sha-demo.html) ═══════════ */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease;
  min-height: 0;
}

/* ─── Brand ─── */
.sidebar-brand {
  padding: 14px 14px 12px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
  background: var(--card);
  flex-shrink: 0;
}
.sidebar-brand .brand-avatar {
  width: 36px; height: 36px;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary); color: var(--primary-foreground);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.sidebar-brand .brand-text { min-width: 0; flex: 1; }
.sidebar-brand .brand-name {
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--foreground);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand .brand-badge {
  display: inline-flex; align-items: center;
  height: 17px; padding: 0 6px;
  border-radius: 999px;
  background: var(--success-bg); color: var(--success);
  border: 1px solid var(--success-border);
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
  flex-shrink: 0;
}
.sidebar-brand .brand-desc {
  font-size: 11px; color: var(--muted-foreground); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand .brand-collapse {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: calc(var(--radius) - 4px);
  color: var(--muted-foreground); cursor: pointer;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.sidebar-brand .brand-collapse:hover {
  background: var(--accent); color: var(--foreground);
}

/* ─── Search ─── */
.sidebar-search { padding: 10px 12px 4px; flex-shrink: 0; }
.sidebar-search-input { position: relative; }
.sidebar-search input {
  width: 100%; height: 32px;
  padding: 0 34px 0 30px;
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
  font-size: 12px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.sidebar-search input::placeholder { color: var(--muted-foreground); }
.sidebar-search input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 20%, transparent);
}
.sidebar-search .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--muted-foreground); pointer-events: none;
  display: grid; place-items: center;
}
.sidebar-search .kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center;
  border-radius: 4px;
  border: 1px solid var(--border); background: var(--secondary);
  color: var(--muted-foreground);
  font-size: 10px; font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ─── Scroll region (menu) ─── */
.sidebar-scroll, .sidebar .menu {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0 12px;
}
.sidebar-scroll::-webkit-scrollbar,
.sidebar .menu::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb,
.sidebar .menu::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─── Group header ─── */
.menu-group {
  padding: 14px 18px 6px;
  font-size: 10.5px; font-weight: 600;
  color: var(--muted-foreground);
  letter-spacing: 0.08em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between;
}
.menu-group .group-count {
  font-size: 10px; color: var(--muted-foreground); opacity: 0.65;
  font-weight: 500;
}
.menu-group:first-of-type { margin-top: 0; }

/* ─── Menu item ─── */
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin: 1px 8px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
  font-size: 13px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background .12s, color .12s;
  position: relative;
  white-space: nowrap;
}
.menu-item:hover { background: var(--accent); }
.menu-item .icon {
  width: 22px; height: 22px;
  border-radius: calc(var(--radius) - 4px);
  display: grid; place-items: center;
  color: var(--muted-foreground);
  background: transparent;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.menu-item .label {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-item .badge {
  height: 18px; padding: 0 6px;
  display: inline-flex; align-items: center;
  border-radius: 999px;
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.menu-item .badge.success {
  background: var(--success-bg); color: var(--success); border-color: var(--success-border);
}
.menu-item .badge.warning {
  background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border);
}
.menu-item .badge.info {
  background: var(--info-bg); color: var(--info); border-color: var(--info-border);
}
.menu-item .badge.destructive {
  background: oklch(0.97 0.018 25);
  color: var(--destructive);
  border-color: oklch(0.93 0.035 25);
}
.menu-item .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--success) 22%, transparent);
}

/* ─── Active ─── */
.menu-item.active {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-sm);
}
.menu-item.active .icon {
  color: var(--primary-foreground);
  background: rgba(255,255,255,0.10);
}
.menu-item.active .badge {
  background: rgba(255,255,255,0.14);
  color: var(--primary-foreground);
  border-color: rgba(255,255,255,0.18);
}

/* ─── Footer status ─── */
.sidebar-footer {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  background: var(--card);
  flex-shrink: 0;
}
.sidebar-status {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: calc(var(--radius) - 2px);
  background: var(--secondary);
  border: 1px solid var(--border);
}
.sidebar-status .status-avatar {
  width: 30px; height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, oklch(0.62 0.18 250), oklch(0.55 0.18 320));
  color: white;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.sidebar-status .status-text { min-width: 0; flex: 1; }
.sidebar-status .status-title {
  font-size: 12px; font-weight: 600; color: var(--foreground);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-status .status-sub {
  font-size: 11px; color: var(--muted-foreground);
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-status .status-action {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: calc(var(--radius) - 4px);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sidebar-status .status-action:hover {
  background: var(--accent); color: var(--foreground);
}

/* ─── Collapsed state ─── */
.app.collapsed .sidebar { width: 64px; }
.app.collapsed .sidebar .brand-text,
.app.collapsed .sidebar .brand-collapse,
.app.collapsed .sidebar .sidebar-search,
.app.collapsed .sidebar .menu-group,
.app.collapsed .sidebar .menu-item .label,
.app.collapsed .sidebar .menu-item .badge,
.app.collapsed .sidebar .menu-item .dot,
.app.collapsed .sidebar .sidebar-status .status-text,
.app.collapsed .sidebar .sidebar-status .status-action { display: none; }
.app.collapsed .sidebar-brand { justify-content: center; padding: 14px 12px; }
.app.collapsed .menu-item { justify-content: center; padding: 8px 0; margin: 2px 8px; }
.app.collapsed .menu-item .icon { width: 26px; height: 26px; }
.app.collapsed .sidebar-status { justify-content: center; padding: 8px; }
/* ─── Main wrap ─── */
.main-wrap {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.main-wrap::-webkit-scrollbar { width: 8px; }
.main-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* ─── Topbar (sticky inside main-wrap) ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  flex-shrink: 0;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.collapse-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.collapse-btn:hover { background: var(--accent); color: var(--foreground); }

.breadcrumb {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.01em;
}
.topbar-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--secondary);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted-foreground);
  white-space: nowrap;
  transition: background .12s;
}
.topbar-chip b { color: var(--foreground); font-weight: 600; }
.topbar-chip .dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--muted-foreground);
  opacity: 0.72;
}
.topbar-chip.ok {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}
.topbar-chip.ok b { color: var(--success); }
.topbar-chip.ok .dot { background: var(--success); opacity: 1; }
.topbar-chip.warn {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}
.topbar-chip.warn b { color: var(--warning); }
.topbar-chip.err {
  background: oklch(0.97 0.018 25);
  border-color: oklch(0.93 0.035 25);
  color: var(--destructive);
}

/* ─── Content ─── */
main.content {
  flex: 1;
  padding: 28px 32px 80px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}
.pane { display: none; }
.pane.active { display: block; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head h2 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.02em;
}
.page-head .hint,
.page-head p {
  font-size: 13px;
  color: var(--muted-foreground);
  margin-top: 6px;
}
.page-head .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hint { font-size: 12px; color: var(--muted-foreground); line-height: 1.6; }

/* ============================================================
 * 卡片系统（分层圆角）
 * ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}
.card > .card-title,
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card > .card-title small,
.card-title small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-foreground);
}
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row + .row { margin-top: 10px; }

/* ─── Grid 布局 ─── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ============================================================
 * Overview SHA v1 · Stat / Alert / Tile / Task / Dl / Progress
 * ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: border-color .12s, box-shadow .12s;
  position: relative; overflow: hidden;
}
.stat-card:hover { border-color: oklch(0.88 0 0); box-shadow: var(--shadow-sm); }
.stat-head-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.stat-label {
  font-size: 11.5px; font-weight: 600;
  color: var(--muted-foreground);
  letter-spacing: 0.02em; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.stat-label svg { width: 13px; height: 13px; }
.stat-badge {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 7px;
  border-radius: 999px;
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 10.5px; font-weight: 600; gap: 3px;
}
.stat-badge svg { width: 11px; height: 11px; }
.stat-badge.up   { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.stat-badge.down { background: var(--destructive-bg); color: var(--destructive); border-color: var(--destructive-border); }
.stat-badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.stat-badge.warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }

.stat-value {
  font-size: 30px; font-weight: 600; line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
  display: flex; align-items: baseline; gap: 6px;
}
.stat-value .unit { font-size: 14px; font-weight: 500; color: var(--muted-foreground); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.destructive { color: var(--destructive); }

.stat-foot {
  margin-top: 10px;
  font-size: 12px; color: var(--muted-foreground);
  display: flex; align-items: center; gap: 6px; min-height: 18px;
  flex-wrap: wrap;
}
.stat-foot .chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px;
  border-radius: 4px;
  background: var(--secondary); border: 1px solid var(--border);
  font-size: 10.5px; font-weight: 500;
  color: var(--muted-foreground);
  font-family: 'JetBrains Mono', monospace;
}

.stat-spark {
  position: absolute; right: 12px; top: 40px;
  width: 60px; height: 22px; opacity: 0.85;
}
.stat-spark path { fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.row-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.row-2b {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .row-2, .row-2b { grid-template-columns: 1fr; }
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.tile {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 14px 14px 12px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card);
  text-align: left;
  font-family: inherit;
}
.tile:hover { background: var(--accent); border-color: oklch(0.86 0 0); }
.tile .tile-icon {
  width: 32px; height: 32px;
  border-radius: calc(var(--radius) - 4px);
  background: var(--secondary);
  color: var(--foreground);
  display: grid; place-items: center;
}
.tile .tile-icon svg { width: 16px; height: 16px; }
.tile.info .tile-icon    { background: var(--info-bg);    color: var(--info); }
.tile.success .tile-icon { background: var(--success-bg); color: var(--success); }
.tile.warning .tile-icon { background: var(--warning-bg); color: var(--warning); }
.tile.primary .tile-icon { background: var(--primary);    color: var(--primary-foreground); }
.tile .tile-title { font-size: 13px; font-weight: 600; color: var(--foreground); }
.tile .tile-sub { font-size: 11.5px; color: var(--muted-foreground); }


/* ─── Alert ─── */
.alert {
  display: flex; gap: 12px;
  padding: 12px 14px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--card);
  align-items: flex-start;
  margin-bottom: 20px;
}
.alert.warning { background: var(--warning-bg); border-color: var(--warning-border); }
.alert.info    { background: var(--info-bg);    border-color: var(--info-border);    }
.alert.success { background: var(--success-bg); border-color: var(--success-border); }
.alert .alert-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--warning);
}
.alert.info .alert-icon    { color: var(--info); }
.alert.success .alert-icon { color: var(--success); }
.alert .alert-icon svg { width: 16px; height: 16px; }
.alert .alert-text {
  flex: 1;
  font-size: 12.5px;
  color: var(--foreground);
  line-height: 1.55;
}
.alert.warning .alert-text { color: oklch(0.42 0.14 65); }
.alert.info    .alert-text { color: oklch(0.35 0.12 250); }
.alert.success .alert-text { color: oklch(0.36 0.14 145); }
.alert .alert-text b { font-weight: 600; }
.alert .alert-action { flex-shrink: 0; }

/* ─── Task row (inside card) ─── */
.task-list {
  display: flex; flex-direction: column;
}
.task-row {
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.task-row:last-child { border-bottom: none; }
.task-row .task-icon {
  width: 34px; height: 34px;
  border-radius: calc(var(--radius) - 4px);
  background: var(--secondary);
  color: var(--muted-foreground);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.task-row .task-icon svg { width: 16px; height: 16px; }
.task-row .task-icon.success { background: var(--success-bg); color: var(--success); }
.task-row .task-icon.warn    { background: var(--warning-bg); color: var(--warning); }
.task-row .task-icon.info    { background: var(--info-bg);    color: var(--info); }
.task-row .task-icon.destructive { background: var(--destructive-bg); color: var(--destructive); }
.task-row .task-main { flex: 1; min-width: 0; }
.task-row .task-title {
  font-size: 13px; font-weight: 500;
  color: var(--foreground);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-row .task-sub {
  font-size: 11.5px; color: var(--muted-foreground);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}
.task-row .task-status {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 11px; font-weight: 500;
  flex-shrink: 0;
}
.task-row .task-status.ok    { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.task-row .task-status.err   { background: var(--destructive-bg); color: var(--destructive); border-color: var(--destructive-border); }
.task-row .task-status.warn  { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.task-row .task-status .dot {
  width: 5px; height: 5px; border-radius: 999px;
  background: currentColor;
}
.task-row .task-time {
  font-size: 11px; color: var(--muted-foreground);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

/* ─── Links / more btn ─── */
.card-head .link-btn {
  font-size: 12px; color: var(--muted-foreground);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 3px;
  transition: color .12s;
}
.card-head .link-btn:hover { color: var(--foreground); }
.card-head .link-btn svg { width: 12px; height: 12px; }

/* ─── Progress ─── */
.progress {
  height: 6px;
  background: var(--secondary);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.progress > .bar {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width .3s ease;
}
.progress > .bar.success { background: var(--success); }
.progress > .bar.warning { background: var(--warning); }
.progress > .bar.destructive { background: var(--destructive); }

/* ─── Dl / detail rows ─── */
.dl {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.dl-row {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.dl-row:last-child { border-bottom: none; padding-bottom: 0; }
.dl-row .dl-label {
  font-size: 12.5px; color: var(--muted-foreground);
  display: flex; align-items: center; gap: 6px;
}
.dl-row .dl-label svg { width: 13px; height: 13px; }
.dl-row .dl-value {
  font-size: 13px; font-weight: 500;
  color: var(--foreground);
  display: flex; align-items: center; gap: 6px;
  font-variant-numeric: tabular-nums;
}
.dl-row .dl-value.mono { font-family: 'JetBrains Mono', monospace; }


/* 老 markup 兼容（.stat-card .label/.value/small/.footer） */
.stat-card > .label {
  font-size: 11.5px; font-weight: 600;
  color: var(--muted-foreground);
  letter-spacing: 0.02em; text-transform: uppercase;
  margin-bottom: 8px;
}
.stat-card > .value {
  font-size: 30px; font-weight: 600; line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}
.stat-card > .value.ok { color: var(--success); }
.stat-card > .value.warn { color: var(--warning); }
.stat-card > .value.err { color: var(--destructive); }
.stat-card small,
.stat-card > .footer {
  display: block; margin-top: 8px;
  font-size: 12px; color: var(--muted-foreground);
}

/* Row layout */
.row-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; }
.row-2b { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .row-2, .row-2b { grid-template-columns: 1fr; }
}

/* card-modern 内联头/身样式（原 .card 是 padding:20/22，加 -modern 变体不破坏其他页） */
.card.card-modern { padding: 0; overflow: hidden; }
.card.card-modern .card-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card.card-modern .card-head-text h3 {
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  margin: 0;
}
.card.card-modern .card-head-text h3 svg { width: 15px; height: 15px; color: var(--muted-foreground); }
.card.card-modern .card-head-text .subtitle {
  font-size: 12px; color: var(--muted-foreground); margin-top: 3px;
}
.card.card-modern .card-body { padding: 20px; }
.card.card-modern .card-body.flush { padding: 0 20px 8px; }
.card.card-modern .link-btn {
  font-size: 12px; color: var(--muted-foreground);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 3px;
  transition: color .12s;
  background: none; border: none; font-family: inherit; padding: 0;
}
.card.card-modern .link-btn:hover { color: var(--foreground); }
.card.card-modern .link-btn svg { width: 12px; height: 12px; }

/* ============================================================
 * AI Hero（各 AI 任务顶部说明块）
 * ============================================================ */
.ai-hero {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border-radius: calc(var(--radius) + 4px);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  margin-bottom: 20px;
}
.ai-hero h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 4px;
}
.ai-hero p {
  font-size: 13px;
  color: color-mix(in oklab, var(--info) 68%, var(--foreground));
  line-height: 1.6;
}

/* ============================================================
 * 场景 Switch（直播/商品卡/全域）
 * ============================================================ */
.scene-switch {
  display: inline-flex;
  padding: 3px;
  background: var(--muted);
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  gap: 2px;
}
.scene-switch label {
  padding: 6px 14px;
  border-radius: calc(var(--radius) - 4px);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  user-select: none;
  transition: background .12s, color .12s, box-shadow .12s;
}
.scene-switch label:hover { color: var(--foreground); }
.scene-switch input:checked + label,
.scene-switch label.active {
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}
.scene-switch input { display: none; }

/* ============================================================
 * 输入 / 表单
 * ============================================================ */
input:not([type]), input[type=text], input[type=number], input[type=date],
input[type=password], input[type=email], input[type=search], input[type=tel],
input[type=url], textarea, select {
  height: 38px;
  padding: 0 12px;
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
  font-size: 13px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
  min-width: 0;
}
textarea {
  height: auto; padding: 10px 12px;
  min-height: 88px;
  resize: vertical;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 22%, transparent);
}
input[type=checkbox], input[type=radio] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  vertical-align: -3px;
}
label {
  font-size: 12px;
  color: var(--muted-foreground);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
label input, label textarea, label select {
  margin-left: 2px;
}

/* ============================================================
 * 按钮系统（严格对齐 SHA 定稿 demo）
 * ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  height: 36px;
  padding: 0 14px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  font-size: 13px;
  font-weight: 500;
  transition: background .12s, color .12s, border-color .12s, opacity .12s, box-shadow .12s;
  outline: none;
  user-select: none;
}
.btn:hover { background: var(--accent); }
.btn:focus-visible {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Primary（默认 SHA 主按钮） */
.btn.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  box-shadow: var(--shadow-xs);
}
.btn.primary:hover {
  background: oklch(0.27 0 0);
  border-color: oklch(0.27 0 0);
}

/* Secondary */
.btn.secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}
.btn.secondary:hover {
  background: color-mix(in oklab, var(--secondary) 80%, var(--foreground) 4%);
}

/* Info（浅蓝） */
.btn.info {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}
.btn.info:hover {
  background: color-mix(in oklab, var(--info-bg) 88%, var(--info) 6%);
}

/* Success（浅绿） */
.btn.ok, .btn.success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.btn.ok:hover, .btn.success:hover {
  background: color-mix(in oklab, var(--success-bg) 88%, var(--success) 6%);
}

/* Danger（浅红） */
.btn.danger {
  background: oklch(0.97 0.018 25);
  color: var(--destructive);
  border-color: oklch(0.93 0.035 25);
}
.btn.danger:hover {
  background: oklch(0.945 0.035 25);
}

/* Ghost（透明） */
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted-foreground);
}
.btn.ghost:hover {
  background: var(--accent);
  color: var(--foreground);
}

/* Small size */
.btn.sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: calc(var(--radius) - 4px);
  gap: 4px;
}
.btn.xs {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: calc(var(--radius) - 4px);
}

/* ============================================================
 * 表格
 * ============================================================ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.data thead th {
  background: var(--secondary);
  color: var(--muted-foreground);
  font-weight: 600;
  font-size: 11px;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
  vertical-align: middle;
  font-size: 13px;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--accent); }
table.data tbody td b { font-weight: 600; }
table.data tbody td small { color: var(--muted-foreground); font-size: 11px; }

/* ============================================================
 * Badge / Status tag（严格对齐定稿 demo）
 * ============================================================ */
.tag, .status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--muted-foreground);
  line-height: 1.4;
  white-space: nowrap;
}
.status-tag.enabled, .status-tag.success, .status-tag.ok {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.status-tag.disabled, .status-tag.paused {
  background: var(--muted);
  color: var(--muted-foreground);
  border-color: var(--border);
}
.status-tag.warning, .status-tag.warn {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}
.status-tag.failed, .status-tag.error, .status-tag.err {
  background: oklch(0.97 0.018 25);
  color: var(--destructive);
  border-color: oklch(0.93 0.035 25);
}
.status-tag.info, .tag.info {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}
.tag.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

/* ============================================================
 * Empty State
 * ============================================================ */
.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 13px;
}

/* ============================================================
 * Modal（弹窗）
 * ============================================================ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-mask.active,
.modal-mask.show { display: flex; }
.modal {
  background: var(--card);
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 24px 26px;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal form { display: flex; flex-direction: column; gap: 12px; }
.modal form > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted-foreground);
  font-weight: 500;
}
.modal form > label input,
.modal form > label textarea,
.modal form > label select {
  margin-left: 0;
  width: 100%;
}
.modal-footer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================================================
 * 输出灰盒（JSON pre 展示）
 * ============================================================ */
.output, pre.output,
#cg-output, #rp-output, #fb-output,
#ai-output, #an-output, #ex-output, #op-output,
#pd-output, #pd-ex-output, #sdk-output {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 14px 16px;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 12px;
  color: var(--foreground);
  overflow: auto;
  max-height: 400px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
}

/* ============================================================
 * Toast（覆盖 app.js 内联样式）
 * ============================================================ */
#toast-box {
  position: fixed;
  top: 68px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
#toast-box > div {
  border-radius: calc(var(--radius) - 2px) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  padding: 10px 14px !important;
}

/* ============================================================
 * Drawer（右侧抽屉）
 * ============================================================ */
#drawer-panel {
  border-left: 1px solid var(--border);
  background: var(--card) !important;
}
#drawer-panel h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
}
#drawer-panel .status-tag {
  font-size: 11px;
}

/* ============================================================
 * 其它辅助
 * ============================================================ */
.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.footer {
  text-align: center;
  color: var(--muted-foreground);
  font-size: 11px;
  padding: 24px 0 8px;
}

/* ============================================================
 * 响应式
 * ============================================================ */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .sidebar .logo-text,
  .sidebar .menu-group,
  .sidebar .menu-item .label { display: none; }
  .sidebar .menu-item { justify-content: center; padding: 8px; margin: 1px 6px; }
  .grid-4, .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  main.content { padding: 20px 16px 60px; }
}

/* ============================================================
 * Campaigns SHA v1 · Filter / Batch / Result / Table / Badge
 * ========================================================== */
.cg-card { overflow: hidden; }

/* Filter bar */
.filter-bar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
  background: var(--surface, oklch(0.992 0 0));
}
.filter-bar .field { display: flex; flex-direction: column; gap: 6px; }
.filter-bar .field-label {
  font-size: 11.5px; font-weight: 500;
  color: var(--muted-foreground);
}
.filter-bar .input {
  height: 32px; padding: 0 10px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px; font-family: inherit;
  color: var(--foreground);
  transition: border-color .12s, box-shadow .12s;
  min-width: 140px;
}
.filter-bar .input:focus {
  outline: none; border-color: var(--ring);
  box-shadow: 0 0 0 3px oklch(0.708 0 0 / 0.15);
}
.filter-bar .input.search {
  padding-left: 30px; min-width: 220px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14' fill='none' stroke='%238C8C8C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
  background-repeat: no-repeat; background-position: 9px center;
}
.filter-bar .select {
  height: 32px; padding: 0 26px 0 10px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='12' height='12' fill='none' stroke='%238C8C8C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 8px center;
  font-size: 13px; font-family: inherit;
  color: var(--foreground);
  cursor: pointer; appearance: none;
  min-width: 110px;
}
.filter-bar .spacer { flex: 1; }
.filter-bar .btn { height: 32px; }

/* Batch action bar */
.batch-bar {
  padding: 10px 20px;
  background: var(--primary); color: var(--primary-foreground);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13px;
  animation: cgSlideDown .18s ease;
}
@keyframes cgSlideDown { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.batch-bar .selected-count b { font-weight: 600; font-variant-numeric: tabular-nums; }
.batch-bar .batch-actions { display: flex; gap: 6px; }
.batch-bar .btn {
  background: var(--card); color: var(--foreground);
  border-color: transparent;
  height: 28px; padding: 0 10px; font-size: 12px;
}
.batch-bar .btn:hover { background: color-mix(in oklab, var(--card) 92%, transparent); }
.batch-bar .btn.ghost {
  background: transparent; color: var(--primary-foreground);
  border: 1px solid oklch(1 0 0 / 0.22);
}
.batch-bar .btn.ghost:hover { background: oklch(0.985 0 0 / 0.15); }

/* Result summary bar */
.result-bar {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12.5px; color: var(--muted-foreground);
  background: var(--card);
}
.result-bar .count-text b {
  color: var(--foreground); font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Data table · SHA v1 */
.cg-card .table-wrap { overflow-x: auto; }
.cg-card table.data {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px;
}
.cg-card table.data thead th {
  background: var(--secondary, oklch(0.97 0 0));
  color: var(--muted-foreground);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.03em; text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.cg-card table.data thead th:first-child { padding-left: 20px; padding-right: 8px; width: 32px; }
.cg-card table.data thead th:last-child { padding-right: 20px; }
.cg-card table.data thead th.sortable { cursor: pointer; user-select: none; }
.cg-card table.data thead th.sortable:hover { color: var(--foreground); }
.cg-card table.data thead th.sortable .sort-ico {
  display: inline-block; width: 10px; height: 10px; margin-left: 3px;
  vertical-align: middle; opacity: .5;
}
.cg-card table.data thead th.sorted .sort-ico { opacity: 1; color: var(--foreground); }
.cg-card table.data thead th.num,
.cg-card table.data tbody td.num {
  text-align: right; font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.cg-card table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
  vertical-align: middle;
}
.cg-card table.data tbody td:first-child { padding-left: 20px; padding-right: 8px; }
.cg-card table.data tbody td:last-child { padding-right: 20px; }
.cg-card table.data tbody tr:last-child td { border-bottom: none; }
.cg-card table.data tbody tr { transition: background .1s; cursor: pointer; }
.cg-card table.data tbody tr:hover { background: color-mix(in oklab, var(--accent) 60%, transparent); }
.cg-card table.data tbody tr.selected { background: var(--info-bg, oklch(0.97 0.025 250)); }
.cg-card table.data tbody tr.selected:hover { background: color-mix(in oklab, var(--info-bg) 88%, transparent); }

/* Row primary cell (name + id) */
.cell-main { display: flex; flex-direction: column; gap: 3px; min-width: 180px; }
.cell-main .name {
  font-weight: 500; color: var(--foreground);
  max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-main .id {
  font-size: 11px; color: var(--muted-foreground);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Badge (通用) */
.cg-card .badge {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  background: var(--secondary); border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 11px; font-weight: 500;
  gap: 4px;
}
.cg-card .badge .dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; }
.cg-card .badge.ok   { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.cg-card .badge.warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.cg-card .badge.err  { background: var(--destructive-bg); color: var(--destructive); border-color: var(--destructive-border); }
.cg-card .badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }

/* Checkbox · SHA v1 */
.cg-card .cb {
  appearance: none; -webkit-appearance: none;
  width: 15px; height: 15px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  position: relative;
  transition: background .12s, border-color .12s;
  margin: 0;
}
.cg-card .cb:hover { border-color: var(--muted-foreground); }
.cg-card .cb:checked {
  background: var(--primary); border-color: var(--primary);
}
.cg-card .cb:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid var(--primary-foreground);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Actions cell */
.actions-cell { display: flex; gap: 4px; align-items: center; }

/* Empty state */
.cg-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted-foreground);
}
.cg-empty .empty-icon {
  width: 48px; height: 48px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
  display: grid; place-items: center;
  margin: 0 auto 12px;
}
.cg-empty .empty-icon svg { width: 22px; height: 22px; }
.cg-empty h4 {
  font-size: 15px; font-weight: 600;
  color: var(--foreground); margin-bottom: 4px;
}
.cg-empty p {
  font-size: 12.5px; line-height: 1.6;
  margin: 0 auto 16px; max-width: 360px;
}
.cg-empty .cta { display: inline-flex; gap: 8px; }
.cg-empty.err  .empty-icon { background: var(--destructive-bg); color: var(--destructive); }
.cg-empty.warn .empty-icon { background: var(--warning-bg); color: var(--warning); }

/* ============================================================
 * Reports SHA v1 · Microsoft YaHei typography
 * ========================================================== */
.rp-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.rp-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-xs);
  padding: 16px 18px;
  min-width: 0;
}
.rp-stat-label {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 6px;
  font-weight: 500;
}
.rp-stat-value {
  font-family: var(--font-number);
  font-size: 24px;
  line-height: 1.18;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.rp-stat-value.ok { color: var(--success); }
.rp-stat-value.warn { color: var(--warning); }
.rp-stat-value.err { color: var(--destructive); }
.rp-stat-foot {
  font-size: 11px;
  color: var(--muted-foreground);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-card { overflow: hidden; }
.rp-filter-card { margin-bottom: 20px; overflow: visible; }
.rp-table-card .table-wrap { overflow-x: auto; }
.rp-table-card table.data thead th.num,
.rp-table-card table.data tbody td.num,
.rp-table-card .mono,
#rp-output .num,
#rp-output .mono {
  font-family: var(--font-number) !important;
  font-variant-numeric: tabular-nums;
}
.rp-table-card table.data tbody td {
  vertical-align: middle;
}
.rp-table-card table.data tbody tr:hover {
  background: color-mix(in oklab, var(--accent) 60%, transparent);
}
.rp-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted-foreground);
}
.rp-empty .empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
}
.rp-empty.err .empty-icon { background: var(--destructive-bg); color: var(--destructive); }
.rp-empty .empty-icon svg { width: 22px; height: 22px; }
.rp-empty h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 4px;
}
.rp-empty p {
  font-size: 12.5px;
  line-height: 1.6;
  margin: 0 auto 16px;
  max-width: 420px;
}
.rp-empty .cta { display: inline-flex; gap: 8px; }
@media (max-width: 1280px) {
  .rp-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .rp-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
 * AI Tasks SHA v1 · Hero / Scene Tabs / Task Card / Batch Bar
 * ========================================================== */

/* Scene Tabs */
.scene-tabs {
  display: flex; gap: 4px;
  background: var(--secondary);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.scene-tabs .tab {
  height: 28px; padding: 0 14px;
  border-radius: 6px;
  border: none; background: none;
  font-family: inherit; font-size: 12.5px;
  color: var(--muted-foreground); cursor: pointer;
  font-weight: 500;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.scene-tabs .tab.active {
  background: var(--card); color: var(--foreground);
  box-shadow: var(--shadow-xs);
}
.scene-tabs .tab:hover:not(.active) { color: var(--foreground); }

/* AI Hero */
.ai-hero-card { margin-bottom: 20px; }
.ai-hero {
  padding: 20px 24px;
  background: var(--secondary);
  display: flex; align-items: flex-start; gap: 16px;
}
.ai-hero .hero-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.ai-hero .hero-body { flex: 1; min-width: 0; }
.ai-hero .hero-body h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.ai-hero .hero-body p { font-size: 13px; color: var(--muted-foreground); line-height: 1.6; max-width: 640px; }

/* AI Task Card */
.ai-task-card .card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ai-task-card .card-head h3 { font-size: 14px; font-weight: 600; }
.ai-task-card .card-head .badge { font-variant-numeric: tabular-nums; }

/* Checkbox · 通用扩展（AI 表格） */
.ai-task-card .cb,
.cg-card .cb {
  appearance: none; -webkit-appearance: none;
  width: 15px; height: 15px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  position: relative;
  transition: background .12s, border-color .12s;
  margin: 0;
}
.ai-task-card .cb:hover,
.cg-card .cb:hover { border-color: var(--muted-foreground); }
.ai-task-card .cb:checked,
.cg-card .cb:checked {
  background: var(--primary); border-color: var(--primary);
}
.ai-task-card .cb:checked::after,
.cg-card .cb:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid var(--primary-foreground);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* AI Empty */
.ai-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted-foreground);
}
.ai-empty .empty-icon {
  width: 48px; height: 48px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
  display: grid; place-items: center;
  margin: 0 auto 12px;
  font-size: 22px;
}
.ai-empty h4 { font-size: 15px; font-weight: 600; color: var(--foreground); margin-bottom: 4px; }
.ai-empty p { font-size: 12.5px; line-height: 1.6; margin: 0 auto 16px; max-width: 360px; }

/* Cell main · note variant */
.cell-main .note { font-size: 11.5px; color: var(--muted-foreground); margin-top: 2px; }

/* Mono · 时间戳用 */
.mono { font-family: var(--font-number); font-size: 12px; color: var(--muted-foreground); }

/* AI Batch Bar */
.ai-batch-bar {
  padding: 10px 20px;
  background: var(--primary); color: var(--primary-foreground);
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
  animation: slideDown .18s ease;
}
.ai-batch-bar .selected-count b { font-weight: 600; font-variant-numeric: tabular-nums; }
.ai-batch-bar .batch-actions { display: flex; gap: 6px; }
.ai-batch-bar .btn {
  background: var(--card); color: var(--foreground); border-color: transparent;
  height: 28px; padding: 0 10px; font-size: 12px;
}
.ai-batch-bar .btn:hover { background: color-mix(in oklab, var(--card) 92%, transparent); }
.ai-batch-bar .btn.ghost {
  background: transparent; color: var(--primary-foreground);
  border: 1px solid oklch(1 0 0 / 0.22);
}
.ai-batch-bar .btn.ghost:hover { background: oklch(0.985 0 0 / 0.15); }
.ai-batch-bar .btn.destructive {
  background: var(--destructive-bg); color: var(--destructive); border-color: var(--destructive-border);
}
.ai-batch-bar .btn.destructive:hover { background: color-mix(in oklab, var(--destructive-bg) 88%, transparent); }

/* ============================================================
 * Peak / Chart / Timeline SHA v1
 * ========================================================== */

/* Chart card */
.chart-card { padding: 20px; }
.chart-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.chart-head h3 { font-size: 14px; font-weight: 600; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted-foreground); }
.chart-legend .dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; margin-right: 4px; }
.chart-svg { width: 100%; height: 220px; }

/* Timeline */
.timeline { padding: 0 20px 20px; }
.timeline-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--info);
  margin-top: 4px;
  flex-shrink: 0;
}
.timeline-dot.boost { background: var(--success); }
.timeline-dot.warn { background: var(--warning); }
.timeline-dot.err { background: var(--destructive); }
.timeline-content { flex: 1; min-width: 0; }
.timeline-time { font-size: 12px; color: var(--muted-foreground); font-family: var(--font-number); }
.timeline-title { font-size: 13px; font-weight: 500; margin-top: 2px; }
.timeline-desc { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.timeline-badge {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 6px;
  border-radius: 4px;
  background: var(--success-bg); color: var(--success);
  font-size: 11px; font-weight: 500;
  margin-top: 4px;
}

/* Peak stat grid override */
.peak-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) {
  .peak-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 多账户管理 */
.account-chip { gap: 6px; }
.account-switcher {
  border: 0;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-weight: 600;
  outline: none;
  max-width: 220px;
}
.account-switcher option { color: #111; }
.account-form .grid-3 { align-items: end; }
.data-table .mini-badge {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
}
.status-good { color: #15803d; font-weight: 600; }
.status-warn { color: #b45309; font-weight: 600; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.danger, .btn.ghost.danger { color: #dc2626; }

.oauth-warm-mask { align-items: center; justify-content: center; }
.oauth-warm-modal { width: 520px; max-width: calc(100vw - 48px); }
.oauth-warm-body { display: grid; gap: 14px; padding: 4px 0 2px; }
.oauth-warm-alert {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  border-radius: 12px;
  padding: 14px 16px;
  line-height: 1.7;
  font-size: 14px;
}
.oauth-check-row { display: flex; align-items: flex-start; gap: 10px; color: var(--foreground); font-size: 14px; }
.oauth-check-row input { margin-top: 3px; }
.oauth-manual-box { margin: 4px 0 12px; color: var(--muted-foreground); font-size: 13px; }
.oauth-manual-box summary { cursor: pointer; user-select: none; }
