/* ============================================================
   浸想开发工作台 · 设计系统 v4.0 —— 超级极简 · 苹果风
   Apple Design: #f5f5f7 灰底 / 纯白卡片 / #0071e3 蓝 / 毛玻璃
   iOS 系统色：绿 #34c759 橙 #ff9500 红 #ff3b30 灰 #8e8e93
   ============================================================ */

/* --- 设计令牌 --- */
:root {
  /* 品牌 */
  --primary: #0071e3;          /* Apple 蓝 */
  --primary-light: #0077ed;    /* hover */
  --primary-lighter: rgba(0, 113, 227, 0.10);
  --accent: #0071e3;
  --accent-light: rgba(0, 113, 227, 0.10);

  /* 中性 */
  --bg: #f5f5f7;
  --card: #ffffff;
  --panel: #ffffff;
  --border: rgba(0, 0, 0, 0.10);
  --border-light: rgba(0, 0, 0, 0.05);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #86868b;
  --input: rgba(0, 0, 0, 0.04);
  --fill: rgba(0, 0, 0, 0.04);

  /* iOS 系统色 */
  --success: #34c759;
  --warning: #ff9500;
  --danger: #ff3b30;
  --info: #007aff;
  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --purple: #af52de;
  --gray: #8e8e93;

  /* 排版 */
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 17px;
  --fs-xl: 22px;

  /* 间距 */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 14px;
  --sp-lg: 20px;
  --sp-xl: 28px;

  /* 圆角 */
  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 980px;

  /* 阴影（中性、极轻） */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.20);
  --shadow-card: var(--shadow-sm);
  --shadow-hover: var(--shadow-md);
  --shadow-pop: var(--shadow-xl);

  /* 过渡 */
  --transition: 200ms cubic-bezier(0.2, 0.8, 0.4, 1);
  --transition-slow: 320ms cubic-bezier(0.2, 0.8, 0.4, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.4, 1);

  /* 毛玻璃（侧边栏 / 顶栏） */
  --glass: rgba(251, 251, 253, 0.72);
  --sidebar-bg: var(--glass);
  --sidebar-text: #1d1d1f;
  --sidebar-active: rgba(0, 0, 0, 0.06);
  --sidebar-label: #6e6e73;
}

/* 柔光低对比模式（Soft Dim）：白天模式的低对比版，非纯黑暗色 */
[data-theme="dark"] {
  --bg: #e6e6e9;
  --card: #efeff2;
  --panel: #efeff2;
  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.05);
  --text: #4d4d54;
  --text-secondary: #7c7c84;
  --text-muted: #9898a0;
  --input: rgba(0, 0, 0, 0.05);
  --fill: rgba(0, 0, 0, 0.05);
  --primary: #0071e3;
  --primary-light: #0077ed;
  --primary-lighter: rgba(0, 113, 227, 0.10);
  --accent: #0071e3;
  --accent-light: rgba(0, 113, 227, 0.10);
  --success: #34c759;
  --warning: #ff9500;
  --danger: #ff3b30;
  --info: #007aff;
  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --purple: #af52de;
  --gray: #8e8e93;
  --glass: rgba(234, 234, 237, 0.78);
  --sidebar-bg: var(--glass);
  --sidebar-text: #4d4d54;
  --sidebar-active: rgba(0, 0, 0, 0.06);
  --sidebar-label: #7c7c84;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.16);
}

/* --- 基础重置 --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; font-size: var(--fs-base); }
::selection { background: rgba(0, 113, 227, 0.22); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== 布局：顶部信息栏 + 内容（无侧边栏） ===================== */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 3px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .sp { flex: 1; }

/* 顶部信息栏统计（主AI/子AI · 同步处理中 · 已完成 · 累计消耗 · 账户余额） */
.topstats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.topstats .stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  white-space: nowrap;
  user-select: none;
  transition: var(--transition);
}
/* 主AI/子AI 徽标（蓝底可点击，点击打开 AI 状态看板） */
.topstats .stat.ai-status {
  color: var(--primary-light);
  background: var(--primary-lighter);
}
/* 主 AI 在线状态点：绿=在线 · 灰=离线 */
.topstats .stat.ai-status::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.topstats .stat.ai-status.off::before { background: var(--gray); }
.topstats .stat.ai-status.off { color: var(--text-muted); }

/* 顶部导航（右上角分段控件） */
.topnav {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--sidebar-active);
  border-radius: var(--radius-sm);
}
.topnav .tab.nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  border-radius: 8px;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.topnav .tab.nav-item:hover { color: var(--text); }
.icon-nav { display: inline-flex; align-items: center; justify-content: center; }
.icon-nav svg { display: block; }
.icon-nav.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow-sm); }
.brand-ic { display: inline-flex; align-items: center; padding: 3px; border-radius: 8px; cursor: pointer; transition: var(--transition); }
.brand-ic:hover { background: var(--card); box-shadow: var(--shadow-sm); }
.brand-ic svg { display: block; }
.topnav .tab.nav-item.active { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

/* 顶栏对象筛选框（浸想OA / 浸想AI，本地过滤任务，无网络请求） */
.filterbox {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--sidebar-active);
  border-radius: var(--radius-sm);
}
.filterbox .filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.filterbox .filter-chip:hover { color: var(--text); }
.filterbox .filter-chip.active {
  background: var(--card);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* 顶栏搜索框（v4.9 新增：本地过滤任务/记忆，无网络请求；v4.13 起默认按钮态，点击展开） */
.searchbox[hidden] { display: none; }
.searchbox {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 220px;
  min-width: 0;
  padding: 6px 14px;
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  transition: all var(--transition);
}
.searchbox:focus-within {
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18);
}
.searchbox .search-ic { font-size: 12px; color: var(--text-muted); flex-shrink: 0; line-height: 1; }
.searchbox .search-ic svg, .search-toggle svg { display: block; pointer-events: none; }
.searchbox input[type="text"] {
  flex: 1;
  min-width: 0;
  width: auto;
  border: none;
  padding: 0;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  resize: none;
  border-radius: 0;
}
.searchbox input[type="text"]:focus { border: none; box-shadow: none; background: transparent; }
.searchbox .search-clear {
  flex-shrink: 0;
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: var(--sidebar-active);
  color: var(--text-secondary);
  font-size: 12px; line-height: 1;
  cursor: pointer;
  padding: 0;
}
.searchbox .search-clear:hover { color: var(--text); background: var(--border); }

/* 账户余额徽标（普通底可点击，点击前往充值） */
.topstats .stat.ds-balance {
  cursor: pointer;
}
.topstats .stat.ds-balance:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.topstats .stat.ds-balance.warn { color: var(--danger); border-color: var(--danger); background: rgba(220, 38, 38, 0.06); }
/* 服务器信息（顶栏徽标 + 看板弹窗） */
.topstats .stat.server-stat { cursor: pointer; display: inline-flex; align-items: center; }
.topstats .stat.server-stat:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.srv-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gray); margin-left: 4px; flex: none; }
.srv-dot.ok { background: var(--success); }
.srv-dot.bad { background: var(--danger); }
.sv-live { font-size: 11px; color: #1f9d4b; margin-left: 10px; letter-spacing: 0.2px; flex: 1; }
.sv-loading { padding: 28px 0; text-align: center; color: var(--text-muted); font-size: 13px; }
.sv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sv-card { display: flex; flex-direction: column; gap: 10px; }
.sv-card.sv-bad { border-color: rgba(255, 59, 48, 0.25); }
.sv-card .dash-card-h { margin-bottom: 0; }
.sv-sys { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.sv-url { margin-left: auto; font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
.sv-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 650; padding: 2px 9px; border-radius: var(--radius-pill); letter-spacing: 0.4px; }
.sv-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sv-badge.ok { color: #1f9d4b; background: rgba(52, 199, 89, 0.12); }
.sv-badge.bad { color: var(--danger); background: rgba(255, 59, 48, 0.10); }
.sv-badge.off { color: var(--text-muted); background: rgba(0, 0, 0, 0.06); }
.sv-host { font-size: 11px; color: var(--text-muted); }
.sv-offline { font-size: 12.5px; color: var(--danger); line-height: 1.6; }
.sv-services { display: flex; flex-direction: column; gap: 5px; background: var(--fill); border-radius: var(--radius); padding: 9px 12px; }
.sv-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.sv-row span { color: var(--text-muted); }
.sv-row b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.sv-state { font-weight: 650; font-variant-numeric: tabular-nums; }
.sv-state.ok { color: #1f9d4b; }
.sv-state.bad { color: var(--danger); }
.sv-state.off { color: var(--text-muted); }
.sv-disks { display: flex; flex-direction: column; gap: 6px; }
.sv-disk .progress { margin-bottom: 0; }
.sv-files { display: flex; flex-direction: column; gap: 4px; }
.progress.sv-bar { margin-bottom: 0; height: 4px; }
.progress.sv-warn > i { background: #ff9500; }
.progress.sv-danger > i { background: var(--danger); }



.content { flex: 1; padding: var(--sp-xl) var(--sp-lg); max-width: 1160px; width: 100%; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 240ms var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }

/* ===================== 按钮（苹果 pill） ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  transition: background var(--transition), transform var(--transition), color var(--transition);
  user-select: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-light); }
.btn-ghost { background: rgba(0, 0, 0, 0.05); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: rgba(0, 0, 0, 0.08); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #ff6259; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* 顶栏「新建」按钮：与顶栏图标按钮同尺寸（btn-sm），feather 加号图标 + 文案 */
#newTaskBtn { gap: 5px; }
#newTaskBtn svg { flex-shrink: 0; }

/* ===================== 任务栏四列 ===================== */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-xl); }
.column { min-width: 0; }
.col-head {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  letter-spacing: 0;
  padding: 2px 4px var(--sp-md);
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-gray { background: var(--gray); }
.dot-blue { background: var(--blue); animation: pulse 1.6s infinite; }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-orange { background: var(--orange); }
.card-star { color: var(--orange); font-size: 14px; margin-right: 5px; line-height: 1; flex: none; }
.card.starred { border-color: rgba(255, 159, 10, .45); box-shadow: 0 1px 6px rgba(255, 159, 10, .12); }
.qa-tip { font-size: var(--fs-xs); font-weight: 600; color: var(--orange); margin: 6px 0 2px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.count {
  margin-left: auto;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.col-body { display: flex; flex-direction: column; gap: var(--sp-md); min-height: 60px; }
.empty { text-align: center; color: var(--text-muted); font-size: var(--fs-sm); padding: 40px var(--sp-sm); }

/* ===================== 任务卡（白卡 · 大圆角 · 轻阴影） ===================== */
.card {
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 18px 18px 14px;
  cursor: pointer;
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card:active { transform: scale(0.985); }

/* 进行中卡片动效（呼吸光晕 + 进度条流动，避免“看起来卡住”） */
.card-working {
  border-color: rgba(0, 113, 227, 0.22);
  animation: workGlow 2.6s ease-in-out infinite;
}
@keyframes workGlow {
  0%, 100% { box-shadow: 0 1px 8px rgba(0, 113, 227, 0.05); }
  50% { box-shadow: 0 2px 18px rgba(0, 113, 227, 0.16); }
}
.card-working .progress { position: relative; }
.card-working .progress::after {
  content: "";
  position: absolute; inset: 0; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, transparent, rgba(0, 113, 227, 0.30), transparent);
  transform: translateX(-100%);
  animation: scanBar 1.8s ease-in-out infinite;
}
@keyframes scanBar { to { transform: translateX(100%); } }
.card-working .progress > i {
  background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.28) 0 6px, transparent 6px 12px);
  animation: stripesMove 1s linear infinite;
}
@keyframes stripesMove { from { background-position: 0 0; } to { background-position: 17px 0; } }
@media (prefers-reduced-motion: reduce) {
  .card-working, .card-working .progress::after, .card-working .progress > i { animation: none; }
}
.card-top { display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: 8px; }
.card-title {
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.tag-a { background: rgba(0, 113, 227, 0.10); color: var(--primary); }
.tag-b { background: rgba(52, 199, 89, 0.14); color: #1f9d4b; }
.tag-qa { background: rgba(175, 82, 222, 0.12); color: #8944ab; }
.tag-both { background: rgba(0, 0, 0, 0.06); color: var(--text-secondary); }
.tag-usage { background: rgba(142, 142, 147, 0.14); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.detail-usage { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.9; padding: 2px 0 var(--sp-md); }
.card-desc {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-md);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.ai-owner { margin-left: auto; flex: none; font-size: 10px; font-weight: 500; line-height: 1; padding: 3px 7px; border-radius: var(--radius-pill); background: rgba(0, 113, 227, 0.10); color: var(--primary); white-space: nowrap; }

/* 进度条（细线 · 圆角） */
.progress {
  height: 5px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--sp-md);
}
.progress > i {
  display: block; height: 100%; border-radius: var(--radius-pill);
  background: var(--primary);
  transition: width 600ms var(--ease);
}
.progress.done > i { background: var(--success); }

/* agent 状态 */
.agents { display: flex; flex-wrap: wrap; gap: var(--sp-md); }
.agent { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-muted); }
.agent .s { width: 6px; height: 6px; border-radius: 50%; }
.agent .s.idle { background: var(--gray); }
.agent .s.working { background: var(--blue); animation: pulse 1.4s infinite; }
.agent .s.done { background: var(--success); }

.card-log {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--fill);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-log.result { color: #1f9d4b; font-weight: 500; }
.card-log.cmd { color: var(--text-secondary); }
.card-log .lt { opacity: 0.5; margin-right: 6px; }
.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--fs-xs); color: var(--text-muted);
  margin-top: 10px;
}
.card-foot span:first-child { font-weight: 600; color: var(--primary); }

/* ===================== 分页 ===================== */
.pager { display: flex; justify-content: center; align-items: center; gap: var(--sp-sm); margin-top: var(--sp-md); }
.pager button {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.pager button:hover:not(:disabled) { background: var(--primary-lighter); border-color: transparent; }
.pager button:active { transform: scale(0.9); }
.pager button:disabled { opacity: 0.3; cursor: default; }
.pager span { color: var(--text-muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }

.failed-wrap { margin-top: var(--sp-xl); }

/* ===================== 待办列表 ===================== */
.pending-list, .memory-list { display: flex; flex-direction: column; gap: var(--sp-md); max-width: 720px; }
.pending-item {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
/* 待确认任务卡内嵌的问题区（问题+选项+回复框，一张卡搞定） */
.pending-ask {
  margin-top: var(--sp-md);
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border-light);
}
.pending-more { color: var(--text-secondary); font-size: 12px; margin-top: 6px; }
.pending-q { font-weight: 600; font-size: var(--fs-base); color: var(--text); letter-spacing: -0.01em; margin-bottom: 6px; }
.pending-s { color: var(--text-secondary); font-size: var(--fs-sm); margin-bottom: var(--sp-md); }
.pending-options { display: flex; flex-wrap: wrap; gap: var(--sp-sm); }
.pending-reply { display: flex; gap: var(--sp-sm); margin-top: var(--sp-md); align-items: center; }
.pending-reply .reply-input {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--fill);
  color: var(--text);
  font-size: var(--fs-sm);
  outline: none;
  transition: box-shadow 0.15s, background 0.15s;
}
.pending-reply .reply-input::placeholder { color: var(--text-secondary); opacity: 0.65; }
.pending-reply .reply-input:focus {
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.22);
}
@media (max-width: 640px) {
  .pending-reply { flex-wrap: wrap; }
  .pending-reply .reply-input { flex: 1 1 100%; }
}
.pending-answered { color: #1f9d4b; font-size: var(--fs-sm); }

/* ===================== 记忆列表 ===================== */
.mem-keys-card { margin-bottom: var(--sp-md); max-width: 720px; }
.mem-item {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-slow), transform var(--transition-slow);
}
.mem-item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mem-title { font-weight: 600; font-size: var(--fs-base); color: var(--text); margin-bottom: 4px; }
.mem-preview { color: var(--text-secondary); font-size: var(--fs-sm); }
.mem-content {
  white-space: pre-wrap; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px; margin-top: var(--sp-md); color: var(--text); line-height: 1.6;
  background: var(--fill);
  border-radius: var(--radius);
  padding: var(--sp-md);
}
.mem-file-content { margin-top: 0; max-height: 58vh; overflow-y: auto; }

/* ===================== 弹窗（苹果风格 v2） ===================== */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; padding: var(--sp-lg);
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
  animation: fadeIn 200ms ease;
}
.modal-mask[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--panel);
  border-radius: 24px;
  width: 100%; max-width: 560px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22), 0 4px 20px rgba(0, 0, 0, 0.10);
  animation: slideUp 320ms var(--ease);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(24px) scale(0.97); } }
.modal-wide { max-width: 860px; }
.modal-narrow { max-width: 380px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-md);
  padding: 22px 24px 18px;
  flex: none;
}
.modal-title {
  font-weight: 650; font-size: 19px; line-height: 1.3;
  color: var(--text); letter-spacing: -0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.modal-close {
  flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.06); color: var(--text-secondary);
  font-size: 16px; line-height: 1; font-weight: 400;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: rgba(0, 0, 0, 0.12); color: var(--text); transform: scale(1.06); }
.modal-body {
  padding: 4px 24px 8px;
  overflow-y: auto;
}
.modal-foot {
  flex: none;
  display: flex; justify-content: flex-end; gap: var(--sp-sm);
  padding: 16px 24px 20px;
  margin-top: var(--sp-sm);
  border-top: 1px solid var(--border-light);
}
.modal-foot .btn { min-width: 88px; }

/* ===================== 表单（苹果填充式输入） ===================== */
.field-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: var(--sp-lg) 0 var(--sp-sm); }

/* --- 弹窗表单分组卡片 --- */
.form-group {
  background: var(--fill);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  margin-bottom: var(--sp-md);
}
.form-group .field-label { margin: 0 0 10px; }
.form-group textarea,
.form-group input[type="text"],
.form-group input[type="password"] {
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.form-group textarea:hover,
.form-group input[type="text"]:hover,
.form-group input[type="password"]:hover { border-color: var(--border); }
.form-group .hint { margin-bottom: 0; }
textarea, input[type="text"], input[type="password"] {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: var(--fs-base);
  background: var(--fill);
  color: var(--text);
  resize: vertical;
  -webkit-appearance: none;
  transition: all var(--transition);
}
textarea::placeholder, input::placeholder { color: var(--text-muted); opacity: 1; }
textarea:focus, input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18);
}

/* ===================== chips（pill 选择） ===================== */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-sm); }
.chip {
  padding: 7px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 400;
  transition: all var(--transition);
  user-select: none;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip:active { transform: scale(0.96); }
.chip.active, .chip.on {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 500;
  box-shadow: none;
}

.upload-row { display: flex; flex-direction: column; gap: var(--sp-sm); }
.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: center;
  background: var(--fill);
  color: var(--primary) !important;
  border: 1px dashed var(--border) !important;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all var(--transition);
}
.upload-btn:hover { border-color: var(--primary) !important; background: var(--primary-lighter); }
.img-previews { display: flex; flex-wrap: wrap; gap: var(--sp-sm); }
.img-previews img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
.hint { color: var(--text-muted); font-size: 12px; line-height: 1.55; margin-top: var(--sp-sm); }

/* ===================== 任务详情 ===================== */
.detail-meta { display: flex; flex-wrap: wrap; gap: var(--sp-sm); margin-bottom: var(--sp-md); }
.detail-block {
  background: var(--fill);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  margin-bottom: var(--sp-md);
}
.detail-block:last-child { margin-bottom: 4px; }
.detail-desc {
  white-space: pre-wrap;
  background: var(--fill);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: var(--sp-md);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
.detail-block .detail-desc { background: transparent; padding: 0; margin: 0; }
.detail-section {
  display: flex; align-items: center;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  letter-spacing: 0.5px;
  margin: var(--sp-lg) 0 var(--sp-sm);
}
.detail-section::before {
  content: ''; flex: none;
  width: 3px; height: 12px; border-radius: 2px;
  background: var(--primary); opacity: 0.55;
  margin-right: 7px;
}
.detail-block .detail-section { margin: 0 0 10px; }
.detail-block .log-list { max-height: 300px; }
.detail-block .detail-usage { padding-bottom: 0; }
.detail-imgs { display: flex; flex-wrap: wrap; gap: var(--sp-sm); }
.detail-imgs img {
  width: 80px; height: 80px; object-fit: cover;
  border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
.log-list { display: flex; flex-direction: column; gap: var(--sp-sm); max-height: 260px; overflow-y: auto; }
.log-item { font-size: var(--fs-sm); color: var(--text-secondary); padding-left: var(--sp-md); position: relative; line-height: 1.6; }
.log-item::before {
  content: ''; position: absolute; left: 2px; top: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gray); opacity: 0.55;
}
.log-item .t { opacity: 0.5; margin-right: 4px; font-variant-numeric: tabular-nums; }
.log-filter-note { font-size: var(--fs-sm); color: var(--text-secondary); padding: 4px 10px; border-radius: 8px; background: var(--bg); }
.log-item summary { cursor: pointer; list-style: none; }
.log-item summary::-webkit-details-marker { display: none; }
.cmd-badge {
  display: inline-block;
  background: var(--fill);
  border-radius: var(--radius-pill);
  padding: 0 8px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 0 6px;
  vertical-align: 1px;
}
.cmd-prev { color: var(--text-muted); font-size: 12px; }
.cmd-full {
  margin-top: 8px;
  background: var(--fill);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-secondary);
}
.detail-result {
  white-space: pre-wrap;
  background: rgba(52, 199, 89, 0.12);
  border: 1px solid rgba(52, 199, 89, 0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: var(--fs-sm);
  color: #1f9d4b;
  line-height: 1.7;
}

/* ===== 任务详情 · 多维度看板（v5 看板化） ===== */
.modal-dash { max-width: 960px; }
.dash-hero {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px 14px;
  margin-bottom: var(--sp-md);
}
.dash-hero-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-sm); flex-wrap: wrap; margin-bottom: 12px; }
.dash-status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-md); font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.dash-status .s { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dash-status .s.blue { background: var(--blue); animation: pulse 1.4s infinite; }
.dash-status .s.green { background: var(--success); }
.dash-status .s.orange { background: var(--warning); }
.dash-status .s.gray { background: var(--gray); }
.dash-pct {
  font-size: var(--fs-xs); font-weight: 650; color: var(--text-secondary);
  background: var(--fill); padding: 1px 9px; border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}
.dash-tags { display: flex; flex-wrap: wrap; gap: var(--sp-sm); align-items: center; }
.dash-times { display: flex; flex-wrap: wrap; gap: var(--sp-sm); margin-top: 12px; }
.dash-time {
  flex: 1 1 84px; min-width: 84px;
  background: var(--fill); border-radius: var(--radius);
  padding: 7px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.dash-time span { font-size: 10px; color: var(--text-muted); letter-spacing: 0.6px; }
.dash-time b { font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

.dash-board { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }
.dash-card {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 15px 18px 17px;
  min-width: 0;
}
.dash-card.dash-wide { grid-column: 1 / -1; }
.dash-card-h {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 650; color: var(--text-muted);
  letter-spacing: 0.3px; margin-bottom: 11px;
}
.dash-card-h svg { width: 14px; height: 14px; color: var(--primary); opacity: 0.9; flex: none; }
.dash-desc { white-space: pre-wrap; font-size: 14px; line-height: 1.75; color: var(--text); word-break: break-word; }
.dash-ai-title { font-size: 14px; font-weight: 650; color: var(--text); letter-spacing: -0.01em; margin-bottom: 10px; }
.dash-ai-title + .agents { margin-bottom: 0; }
.dash-imgs { display: flex; flex-wrap: wrap; gap: var(--sp-sm); }
.dash-imgs img {
  width: 84px; height: 84px; object-fit: cover;
  border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
.dash-usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: var(--sp-sm); }
.du { background: var(--fill); border-radius: var(--radius); padding: 8px 11px; display: flex; flex-direction: column; gap: 3px; }
.du span { font-size: 10px; color: var(--text-muted); letter-spacing: 0.4px; }
.du b { font-size: var(--fs-sm); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.dash-result-card { background: rgba(52, 199, 89, 0.07); border-color: rgba(52, 199, 89, 0.22); }
.dash-result-card .dash-card-h { color: #1f9d4b; }
.dash-result-card .dash-card-h svg { color: var(--success); }
.dash-card .log-list { max-height: 300px; }
@media (max-width: 768px) {
  .modal-dash { max-width: 100%; }
  .dash-board { grid-template-columns: 1fr; }
  .dash-card.dash-wide { grid-column: auto; }
  .sv-grid { grid-template-columns: 1fr; }
  .dash-time { min-width: 0; }
  .dash-imgs img { width: 72px; height: 72px; }
  .dash-usage-grid { grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); }
}

/* ===================== 图片弹窗 ===================== */
.img-modal { position: relative; max-width: 92vw; max-height: 90vh; animation: slideUp 260ms var(--ease); }
.img-modal img { max-width: 92vw; max-height: 90vh; border-radius: var(--radius-lg); display: block; box-shadow: var(--shadow-xl); }
.modal-close.img-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 17px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
}
.modal-close.img-close:hover { background: rgba(0, 0, 0, 0.8); color: #fff; transform: scale(1.06); }
.img-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 15px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.img-close:hover { background: rgba(0, 0, 0, 0.7); }

/* ===================== toast（HUD 药丸） ===================== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: rgba(30, 30, 32, 0.85);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: #fff;
  padding: 11px 22px; border-radius: var(--radius-pill);
  z-index: 200; font-size: var(--fs-sm); font-weight: 500;
  max-width: 86vw; text-align: center;
  box-shadow: var(--shadow-lg);
  animation: toastIn 250ms var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.toast[hidden] { display: none; }

/* ===================== 响应式：桌面 ===================== */
@media (min-width: 1025px) {
  .content { padding: 40px; }
}
@media (max-width: 1200px) {
  .board { grid-template-columns: repeat(2, 1fr); }
}

/* 移动端状态列 tab（仅 ≤768px 显示，桌面隐藏） */
.mob-tabs { display: none; }

/* ===================== 响应式：手机端（≤768px）—— 顶栏紧凑重排 + 状态列横向滑动 + 大触控 ===================== */
@media (max-width: 768px) {
  body { font-size: 14px; }

  /* 顶栏第一行：标题 + 导航/搜索/主题/新建按钮；sp 仅做弹性占位不再强制换行 */
  .topbar { flex-wrap: wrap; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 8px; }
  .topbar .sp { flex: 1 1 auto; height: 0; min-height: 0; }
  .icon-nav { order: 1; }
  #searchToggle { order: 2; }
  #themeBtn { order: 3; }
  #newTaskBtn { order: 4; }

  /* 第二行：对象筛选 + 统计徽标横向滚动（不换行不折行） */
  .filterbox { order: 97; flex: 0 1 auto; }
  .filterbox .filter-chip { flex: 1; padding: 6px 11px; }
  .topbar .topstats {
    order: 98;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topbar .topstats::-webkit-scrollbar { display: none; }
  .topbar .topstats .stat { flex: 0 0 auto; padding: 4px 10px; font-size: 10.5px; }

  /* 搜索框展开时占一整行 */
  .searchbox { order: 99; flex: 1 1 100%; width: auto; padding: 8px 14px; }
  .searchbox input[type="text"] { font-size: 16px; }

  /* 第三行：状态列切换分段（随顶栏 sticky，左右滑动列与点击互相同步） */
  .mob-tabs {
    order: 100;
    flex: 1 1 100%;
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--sidebar-active);
    border-radius: var(--radius-sm);
  }
  .mob-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 4px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  }
  .mob-tab .mcount { font-style: normal; font-weight: 600; font-size: 11px; color: inherit; opacity: 0.75; font-variant-numeric: tabular-nums; }
  .mob-tab.active { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

  .topbar .btn { min-height: 34px; padding: 6px 14px; font-size: 12px; }

  .content { padding: var(--sp-md) var(--sp-sm) calc(var(--sp-xl) + env(safe-area-inset-bottom)); }

  /* 三列 = 横向翻页（左右滑切换，scroll-snap 每次一列；点顶部 tab 直达） */
  .board {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
  }
  .board::-webkit-scrollbar { display: none; }
  .board .column { flex: 0 0 100%; min-width: 100%; scroll-snap-align: start; scroll-snap-stop: always; padding: 0 1px; }

  .card { padding: var(--sp-md); border-radius: var(--radius-lg); }
  .card-title { font-size: 16px; }
  .col-head { padding: 4px 2px var(--sp-sm); font-size: 14px; }

  /* 触控友好：加大按钮与分页，输入框 ≥16px 防 iOS 聚焦自动放大 */
  .card-btn { min-height: 36px; padding: 8px 16px; font-size: 13px; }
  .card-actions { gap: 10px; }
  .pager button { width: 40px; height: 40px; font-size: 18px; }
  .reply-input { font-size: 16px; min-height: 42px; }
  textarea, input[type="text"], input[type="password"] { font-size: 16px; }
  .modal-close { width: 36px; height: 36px; font-size: 18px; }

  /* 弹窗 = 底部抽屉（全宽贴底上滑）；图片预览保持居中；截图弹窗全屏 */
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; width: 100%; border-radius: 22px 22px 0 0; max-height: 92dvh; }
  .modal-wide { max-width: 100%; }
  .modal-narrow { max-width: 100%; }
  .modal-head { padding: 18px var(--sp-lg) 14px; }
  .modal-body { padding: 2px var(--sp-lg) var(--sp-sm); }
  .modal-foot { padding: 14px var(--sp-lg) calc(16px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; min-height: 42px; }
  #imgModal { align-items: center; padding: 16px; }
  #imgModal .img-modal { width: auto; max-width: 100%; }
  #shotModal { align-items: stretch; padding: 0; }
  #shotModal .shot-wrap { width: 100% !important; max-width: 100%; max-height: 100dvh; border-radius: 0; }

  .pending-item, .mem-item { padding: var(--sp-md); }
  .pending-q { font-size: var(--fs-base); }

  .chip { padding: 8px 14px; font-size: 12px; min-height: 34px; display: inline-flex; align-items: center; }
  .btn { min-height: 40px; }

  .detail-desc { padding: var(--sp-sm) var(--sp-md); }
  .detail-imgs img { width: 68px; height: 68px; }
}


/* ===================== 任务卡操作按钮（v4.1 追加，勿删） ===================== */
.card-actions { display: flex; justify-content: flex-end; gap: var(--sp-sm); margin-top: var(--sp-sm); }
.card-btn {
  padding: 5px 12px;
  font-size: var(--fs-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
}
.card-btn:hover { background: var(--primary-lighter); border-color: var(--primary); }
.card-btn:active { transform: scale(0.96); }
.card-btn.danger { color: #ff3b30; }
.card-btn.danger:hover { background: rgba(255, 59, 48, 0.10); border-color: #ff3b30; }
.card-btn.warn { color: #ff9500; }
.card-btn.warn:hover { background: rgba(255, 149, 0, 0.10); border-color: #ff9500; }

/* ===================== 截取图片（框选截图） ===================== */
.upload-btns { display: flex; flex-wrap: wrap; gap: var(--sp-sm); }
.shot-choose { display: flex; gap: var(--sp-sm); }
.shot-choice {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 20px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--fill); cursor: pointer; transition: all .16s var(--ease);
}
.shot-choice:hover { border-color: var(--primary); background: var(--primary-lighter); transform: translateY(-1px); }
.shot-choice-icon { font-size: 28px; line-height: 1; }
.shot-choice-name { font-size: 14px; font-weight: 600; color: var(--text); }
.shot-choice-sub { font-size: 11px; color: var(--text-muted); }
.shot-wrap { width: auto; max-height: 92vh; }
.shot-head-btns { display: flex; align-items: center; gap: 6px; }
.shot-body { padding: 10px; background: var(--fill); border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); }
.shot-body iframe { display: block; border: 0; border-radius: 10px; background: #fff; max-width: 100%; }
.shot-placeholder { padding: 40px 24px; text-align: center; color: var(--text-secondary); font-size: 13px; line-height: 1.9; }
.shot-placeholder p { margin: 0 0 6px; }
.shot-freeze { text-align: center; padding: 4px 0 2px; }
.shot-freeze-stage { position: relative; display: inline-block; line-height: 0; max-width: 100%; cursor: crosshair; touch-action: none; }
.shot-freeze-stage img { max-width: 100%; max-height: 56vh; display: block; border-radius: 8px; }
.shot-sel { position: absolute; border: 2px dashed var(--primary); background: rgba(0, 113, 227, 0.14); pointer-events: none; border-radius: 3px; }
.shot-hint { padding: 10px 4px 2px; font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.shot-guide { padding: 26px 20px 20px; text-align: center; }
.shot-guide-icon { font-size: 34px; line-height: 1; margin-bottom: 8px; }
.shot-guide-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.shot-guide-steps { display: inline-block; text-align: left; font-size: 13px; color: var(--text-secondary); line-height: 2.15; margin-bottom: 12px; }
.shot-guide-steps p { margin: 0; }
.shot-guide-steps b { color: var(--primary); }
.shot-guide-note { max-width: 480px; margin: 0 auto; padding: 10px 14px; border-radius: 12px; background: var(--fill); font-size: 12px; color: var(--text-muted); line-height: 1.7; }
.shot-foot { flex-wrap: wrap; }
@media (max-width: 640px) {
  .shot-choice { padding: 14px 8px; }
  .shot-freeze-stage img { max-height: 44vh; }
  .shot-body { padding: 6px; }
}


/* --- AI 工作状态弹层（顶栏「主AI N」信息框点击弹出） --- */
.stat.ai-status { cursor: pointer; }

/* ============================================================
   AI 状态看板（弹窗 · 苹果风，点击顶栏「主AI N · 子AI N」打开）
   ============================================================ */
.ai-dash { z-index: 1300; }
.dash-panel { max-width: 800px; max-height: 88vh; }
.dash-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 16px; border-bottom: 1px solid var(--border-light); }
.dash-head-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-title { display: inline-flex; align-items: center; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.dash-title-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-right: 8px; background: var(--gray); }
.dash-title-dot.on { background: var(--success); }
.dash-title-dot.warn { background: var(--warning); }
.dash-head-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-head-actions { display: flex; gap: 6px; flex: none; }
.dash-head-actions .btn { width: 32px; height: 32px; padding: 0; border-radius: 50%; font-size: 14px; }
.dash-body { overflow-y: auto; padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 22px; }

/* 总览统计行 */
.dash-overview { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.dash-stat { background: var(--fill); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-stat-v { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-stat-l { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-stat.ok .dash-stat-v { color: var(--success); }
.dash-stat.warn .dash-stat-v { color: var(--orange); }
.dash-stat.accent .dash-stat-v { color: var(--accent); }

/* 区块 */
.dash-sec { display: flex; flex-direction: column; gap: 10px; }
.dash-sec-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); letter-spacing: -.01em; }
.dash-ailist { display: flex; flex-direction: column; gap: 8px; }
.dash-note { font-size: 12px; color: var(--text-muted); padding: 2px 4px 0; }
.dash-subgroup-wrap { display: flex; flex-direction: column; gap: 8px; }
.dash-subgroup { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-secondary); padding: 8px 10px; border-radius: 12px; cursor: pointer; user-select: none; transition: background .15s; }
.dash-subgroup:hover { background: var(--fill); }
.dash-subgroup-chev { flex: none; font-size: 11px; color: var(--text-muted); transition: transform .18s ease; }
.dash-subgroup-chev.open { transform: rotate(90deg); }
.dash-subgroup-ai { display: inline-flex; padding: 2px 10px; border-radius: 999px; background: rgba(0, 113, 227, 0.10); color: var(--accent); font-weight: 700; flex: none; }
.dash-subgroup-info { color: var(--text-secondary); font-weight: 500; }
.dash-subgroup-hint { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--text-muted); flex: none; }
.dash-subgroup-body { display: flex; flex-direction: column; gap: 8px; }
.dash-subgroup-body[hidden] { display: none; }

/* 主 AI / 子 AI 行 */
.dash-airow { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dash-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.dash-avatar.on { background: rgba(52, 199, 89, 0.14); color: #1f9d46; }
.dash-avatar.off { background: rgba(255, 149, 0, 0.15); color: #c26600; }
.dash-avatar.none { background: rgba(142, 142, 147, 0.16); color: var(--text-muted); }
.dash-avatar.work { background: rgba(0, 113, 227, 0.10); color: var(--accent); }
.dash-ainfo { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dash-ainame { font-size: 14px; font-weight: 600; }
.dash-aisub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-badge { margin-left: auto; flex: none; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.dash-badge.on { background: rgba(52, 199, 89, 0.14); color: #1f9d46; }
.dash-badge.off { background: rgba(255, 149, 0, 0.15); color: #c26600; }
.dash-badge.none { background: rgba(142, 142, 147, 0.16); color: var(--text-secondary); }
.dash-badge.work { background: rgba(0, 113, 227, 0.10); color: var(--accent); }
.dash-subcard, .dash-work, .dash-qcol { background: var(--card); border: 1px solid var(--border-light); border-radius: 16px; box-shadow: var(--shadow-sm); }
.dash-subcard { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.dash-subtasks { display: flex; flex-direction: column; gap: 6px; }
.dash-subtask { display: flex; align-items: center; gap: 10px; font-size: 12.5px; padding: 7px 12px; background: var(--fill); border-radius: 10px; cursor: pointer; min-width: 0; transition: background .15s; }
.dash-subtask:hover { background: var(--border-light); }
.dash-subtask span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.dash-pct { margin-left: auto; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-secondary); }

/* 队列与待确认 */
.dash-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dash-qcol { padding: 13px 16px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.dash-qtitle { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.dash-qitem { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 10px; border-radius: 10px; background: var(--fill); cursor: pointer; min-width: 0; transition: background .15s; }
.dash-qitem:hover { background: var(--border-light); }
.dash-qnone { padding: 14px 16px; background: var(--card); border: 1px solid var(--border-light); border-radius: 16px; font-size: 12.5px; color: var(--text-muted); }
.dash-qitem span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.dash-qtag { flex: none; font-size: 10.5px; font-weight: 700; color: var(--text-muted); padding: 1px 7px; border-radius: 999px; background: rgba(142, 142, 147, 0.14); }
.dash-qtag.warn { background: rgba(255, 149, 0, 0.16); color: #c26600; }

/* 底部系统指标条 */
.dash-sysstrip { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 11.5px; color: var(--text-muted); border-top: 1px solid var(--border-light); padding-top: 15px; }
.dash-sysstrip b { color: var(--text-secondary); font-weight: 600; }

.dash-empty { color: var(--text-muted); font-size: 12.5px; padding: 8px 2px; }

@media (max-width: 768px) {
  .dash-overview { grid-template-columns: repeat(3, 1fr); }
  .dash-two { grid-template-columns: 1fr; }
  .dash-panel { max-height: 92dvh; }
  .dash-head { padding: 18px 18px 14px; }
  .dash-head-actions .btn { width: 36px; height: 36px; font-size: 16px; }
  .dash-body { padding: 16px 18px calc(20px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   主AI API Keys 管理（记忆库菜单 · 2026-08-17）
   ============================================================ */
.mem-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 14px; }
.mem-head-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.mem-head .btn { display: inline-flex; align-items: center; gap: 6px; }
.aik-sum { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.aik-ok { color: var(--success); font-weight: 600; }
.aik-bad { color: var(--danger); font-weight: 600; }
.aik-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--card); }
.aik-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.aik-dot.on { background: var(--success); }
.aik-dot.off { background: var(--danger); }
.aik-letter { font-weight: 600; font-size: 14px; min-width: 64px; }
.aik-letter em { font-style: normal; font-size: 10px; font-weight: 600; background: var(--primary); color: #fff; border-radius: 6px; padding: 1px 5px; margin-left: 4px; vertical-align: 1px; }
.aik-mask { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-secondary); background: var(--input); padding: 3px 8px; border-radius: 8px; cursor: pointer; }
.aik-st { font-size: 12px; color: var(--text-muted); }
.aik-st.on { color: var(--success); }
.aik-st.off { color: var(--danger); }
.aik-acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.btn-xs { padding: 3px 10px; font-size: 12px; }
.aik-danger { color: var(--danger); }
.aik-note { font-size: 12px; color: var(--text-secondary); line-height: 1.7; margin-top: 14px; border-top: 1px solid var(--border-light); padding-top: 10px; }
.aik-code { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--input); border-radius: 8px; padding: 8px 10px; margin-top: 8px; word-break: break-all; user-select: all; }
