/* ============================================================
   浸想开发工作台 · 设计系统 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;
}

/* 苹果暗色（iOS Dark） */
[data-theme="dark"] {
  --bg: #000000;
  --card: #1c1c1e;
  --panel: #1c1c1e;
  --border: rgba(255, 255, 255, 0.16);
  --border-light: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-muted: #6e6e73;
  --input: rgba(255, 255, 255, 0.08);
  --fill: rgba(255, 255, 255, 0.08);
  --primary: #0a84ff;
  --primary-light: #409cff;
  --primary-lighter: rgba(10, 132, 255, 0.18);
  --accent: #0a84ff;
  --accent-light: rgba(10, 132, 255, 0.18);
  --success: #30d158;
  --warning: #ffd60a;
  --danger: #ff453a;
  --info: #64d2ff;
  --blue: #0a84ff;
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --purple: #bf5af2;
  --gray: #48484a;
  --glass: rgba(28, 28, 30, 0.72);
  --sidebar-bg: var(--glass);
  --sidebar-text: #f5f5f7;
  --sidebar-active: rgba(255, 255, 255, 0.10);
  --sidebar-label: #98989d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.7);
}

/* --- 基础重置 --- */
*, *::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; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); }

/* ===================== 布局：顶部信息栏 + 内容（无侧边栏） ===================== */
.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; }
[data-theme="dark"] .main::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); }

.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 .title { font-size: var(--fs-lg); font-weight: 600; color: var(--text); letter-spacing: -0.02em; white-space: nowrap; margin-right: 12px; }
.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 在线状态点：绿=在线 · 灰=离线 */
.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); }
.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 新增：本地过滤任务/记忆，无网络请求） */
.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);
}
[data-theme="dark"] .searchbox:focus-within { box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.28); }
.searchbox .search-ic { font-size: 12px; color: var(--text-muted); flex-shrink: 0; line-height: 1; }
.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 {
  color: var(--primary-light);
  background: var(--primary-lighter);
  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); }


.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); }
[data-theme="dark"] .btn-ghost { background: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .btn-ghost:hover { background: rgba(255, 255, 255, 0.18); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #ff6259; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ===================== 任务栏四列 ===================== */
.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); }
@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-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-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; }
[data-theme="dark"] .tag-a { background: rgba(10, 132, 255, 0.18); color: #409cff; }
[data-theme="dark"] .tag-b { background: rgba(48, 209, 88, 0.18); color: #30d158; }
[data-theme="dark"] .tag-both { background: rgba(255, 255, 255, 0.10); color: var(--text-secondary); }
[data-theme="dark"] .tag-usage { background: rgba(255, 255, 255, 0.10); color: var(--text-secondary); }
.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;
}

/* 进度条（细线 · 圆角） */
.progress {
  height: 5px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--sp-md);
}
[data-theme="dark"] .progress { background: rgba(255, 255, 255, 0.12); }
.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; }
[data-theme="dark"] .card-log.result { color: #30d158; }
.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); }

/* ===================== 面板标题（大标题 · 无装饰） ===================== */
.panel-head {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-lg);
}

/* ===================== 待办列表 ===================== */
.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-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);
}
[data-theme="dark"] .pending-reply .reply-input:focus {
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.35);
}
@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); }
[data-theme="dark"] .pending-answered { color: #30d158; }

/* ===================== 记忆列表 ===================== */
.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);
}

/* ===================== 弹窗（苹果风格 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);
}
[data-theme="dark"] .modal-close { background: rgba(255, 255, 255, 0.12); color: #d1d1d6; }
.modal-close:hover { background: rgba(0, 0, 0, 0.12); color: var(--text); transform: scale(1.06); }
[data-theme="dark"] .modal-close:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.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);
}
[data-theme="dark"] textarea:focus, [data-theme="dark"] input:focus { box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.28); }

/* ===================== 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-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;
}
[data-theme="dark"] .detail-result { background: rgba(48, 209, 88, 0.14); border-color: rgba(48, 209, 88, 0.3); color: #30d158; }

/* ===================== 图片弹窗 ===================== */
.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); }
}

/* ===================== 响应式：手机端（≤768px）—— 顶栏信息换行，按钮靠右上 ===================== */
@media (max-width: 768px) {
  body { font-size: 14px; }

  .topbar { flex-wrap: wrap; padding: 8px 14px; gap: 8px; }
  .topbar .sp { flex: 1 1 100%; height: 0; min-height: 0; }
  .topnav { margin-left: auto; }
  .filterbox { order: 97; flex: 1 1 100%; justify-content: center; }
  .filterbox .filter-chip { flex: 1; }
  .searchbox { order: 98; flex: 1 1 100%; width: auto; padding: 7px 14px; }
  .topbar .btn { min-height: 34px; padding: 6px 14px; font-size: 12px; }
  .topbar .topstats { order: 99; flex: 1 1 100%; }
  .topbar .topstats .stat { padding: 4px 8px; font-size: 10.5px; }

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

  .board { grid-template-columns: 1fr; gap: var(--sp-md); }
  .card { padding: var(--sp-md); border-radius: var(--radius-lg); }
  .col-head { padding: 4px 2px var(--sp-sm); }

  .modal { max-width: 96vw; border-radius: 20px; }
  .modal-wide { max-width: 96vw; }
  .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) 16px; }
  .modal-foot .btn { flex: 1 1 auto; min-height: 42px; }

  .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; }
.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-foot { flex-wrap: wrap; }
@media (max-width: 640px) {
  .shot-choice { padding: 14px 8px; }
  .shot-freeze-stage img { max-height: 44vh; }
  .shot-body { padding: 6px; }
}
