/* ============================================================
   陪跑师效率系统 — 统一设计规范
   分层：1 Token  2 基础  3 Landing/Auth（营销风格）
        4 应用骨架（侧边栏/顶栏）  5 通用组件  6 页面模块  7 响应式
   约定：应用内（view-app）为企业后台密度 —— 13px 正文、32px 控件、
        6/8px 圆角、1px 边框分层、无毛玻璃、无位移动效。
   ============================================================ */

/* ==================== 1. Design Tokens ==================== */
:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;

  /* 色彩 */
  --ink: #1a2233;
  --ink-2: #3d4658;
  --muted: #6f7a90;
  --line: #e3e8f0;
  --soft-line: #edf0f6;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --blue: #3468ff;
  --blue-deep: #2f5eea;
  --blue-soft: rgba(52, 104, 255, .08);
  --green: #1fa15d;
  --orange: #e07800;
  --purple: #7c4dff;
  --sky: #0f8bd9;
  --danger: #de3442;
  --warn: #b25e00;
  --ok: #1a7f4b;
  --sidebar-bg: #0b1e38;

  /* 字号 */
  --font-body: 13px;
  --font-sm: 12px;
  --font-xs: 11px;
  --font-title: 15px;

  /* 控件与形状 */
  --control-h: 32px;
  --control-h-sm: 26px;
  --radius-ctl: 6px;
  --radius-card: 8px;
  --shadow-card: 0 1px 2px rgba(23, 32, 51, .05);
  --focus-ring: 0 0 0 3px rgba(52, 104, 255, .18);
}

/* ==================== 2. 基础 ==================== */
* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-size: var(--font-body);
  line-height: 1.5;
  background: transparent;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  overflow-x: hidden;
}

h2, h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0;
}

h2 { font-size: var(--font-title); }
h3 { font-size: 13px; }

.muted { color: var(--muted); }
.danger-text { color: var(--danger); font-weight: 600; }

a.dl-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

a.dl-link:hover { text-decoration: underline; }

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes gate-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 三态视图：landing / auth / app 互斥 */
.landing { display: none; }
body.view-landing, body.view-auth, body.auth-only { display: block; }
body.view-landing .landing { display: block; }
body.view-landing .sidebar, body.view-landing main,
body.view-auth .sidebar, body.view-auth main,
body.auth-only .sidebar, body.auth-only main { display: none; }
.auth-gate { display: none; }
body.view-auth .auth-gate, body.auth-only .auth-gate {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: clamp(20px, 4vw, 48px);
}

/* ==================== 3a. Landing（营销页，保留展示型风格） ==================== */
.landing {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(52, 104, 255, .08), transparent 34%),
    radial-gradient(circle at 92% 6%, rgba(31, 161, 93, .08), transparent 30%),
    var(--bg);
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px clamp(20px, 5vw, 64px);
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--soft-line);
}

.landing-brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.landing-brand strong { display: block; font-size: 15px; font-weight: 700; }
.landing-brand span { font-size: 12px; color: var(--muted); }

.landing-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #1bc7ff);
  box-shadow: 0 4px 12px rgba(52, 104, 255, .28);
}

.landing-nav-links { display: flex; gap: 22px; }
.landing-nav-links a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.landing-nav-links a:hover { color: var(--ink); }
.landing-nav-actions { display: flex; gap: 10px; }

.primary-btn, .ghost-btn {
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: box-shadow .15s ease, background .15s ease;
}

.primary-btn {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 6px 16px rgba(52, 104, 255, .28);
}

.primary-btn:hover { background: var(--blue-deep); }

.ghost-btn {
  background: rgba(255, 255, 255, .8);
  color: var(--ink);
  border-color: var(--line);
}

.ghost-btn:hover { background: #fff; border-color: var(--blue); color: var(--blue); }
.primary-btn.lg, .ghost-btn.lg { padding: 13px 28px; font-size: 15px; }

.landing-hero {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(52px, 8vw, 110px) clamp(20px, 5vw, 64px) clamp(36px, 6vw, 64px);
  text-align: center;
}

.landing-hero h1 {
  margin: 18px 0;
  font-size: clamp(34px, 5.6vw, 62px);
  line-height: 1.08;
  letter-spacing: -.02em;
  font-weight: 700;
}

.landing-hero p {
  max-width: 620px;
  margin: 0 auto;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.75;
  color: var(--ink-2);
}

.landing-hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.landing-status { margin-top: 20px; font-size: 13px; color: var(--muted); }

.eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
}

.landing-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(36px, 6vw, 72px) clamp(20px, 5vw, 64px);
}

.landing-section-head { text-align: center; margin-bottom: 36px; }

.landing-section-head h2 {
  margin: 12px 0 0;
  font-size: clamp(24px, 3.2vw, 34px);
  letter-spacing: -.01em;
  font-weight: 700;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.landing-card {
  padding: 26px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--soft-line);
  box-shadow: var(--shadow-card);
  transition: box-shadow .18s ease;
}

.landing-card:hover { box-shadow: 0 10px 28px rgba(23, 32, 51, .1); }

.landing-card-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 19px;
  background: var(--blue-soft);
  color: var(--blue);
}

.landing-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.landing-card p { margin: 0; color: var(--ink-2); line-height: 1.7; font-size: 14px; }
.landing-grid.roles .landing-card.role h3 { color: var(--blue); }

.landing-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.landing-steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 20px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--soft-line);
}

.landing-steps li > span {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #1bc7ff);
}

.landing-steps li strong { display: block; margin-bottom: 4px; font-size: 14px; }
.landing-steps li p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; }

.landing-cta {
  margin-top: 48px;
  text-align: center;
  padding: clamp(32px, 5vw, 56px);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(52, 104, 255, .08), rgba(31, 161, 93, .08));
  border: 1px solid var(--soft-line);
}

.landing-cta h2 { margin: 0 0 8px; font-size: clamp(22px, 3vw, 30px); font-weight: 700; }
.landing-cta p { margin: 0; color: var(--muted); font-size: 14px; }
.landing-cta .landing-hero-actions { margin-top: 22px; }

.landing-footer {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--soft-line);
}

/* ==================== 3b. Auth（登录/注册） ==================== */
body.view-auth, body.auth-only {
  background:
    radial-gradient(circle at 12% 16%, rgba(52, 104, 255, .1), transparent 32%),
    radial-gradient(circle at 88% 8%, rgba(31, 161, 93, .1), transparent 28%),
    var(--bg);
}

.auth-shell {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  animation: gate-rise .36s ease both;
}

.auth-back {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.auth-back:hover { border-color: var(--blue); color: var(--blue); }

.auth-card {
  width: 100%;
  padding: clamp(24px, 4vw, 32px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(23, 32, 51, .1);
}

.auth-card input, .auth-card select, .auth-card button { width: 100%; }

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 17px;
  font-weight: 700;
}

.auth-status-pill {
  width: fit-content;
  max-width: 100%;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(31, 161, 93, .1);
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 14px 0 16px;
  background: #eef1f7;
  border-radius: 10px;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 8px 0;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
  box-shadow: none;
  min-height: 0;
}

.auth-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(23, 32, 51, .1);
}

.auth-panel { display: none; }
.auth-panel.active { display: block; animation: gate-rise .24s ease both; }
.auth-panel-hint { margin: 0 0 12px; }

/* ==================== 4. 应用骨架 ==================== */
.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
  color: rgba(255, 255, 255, .72);
  background: var(--sidebar-bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 2px 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: linear-gradient(135deg, #4e7dff, #1bc7ff);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 4px;
}

.brand strong {
  display: block;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.brand span { color: rgba(255, 255, 255, .45); font-size: 11px; }

.sidebar nav {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar nav::-webkit-scrollbar { width: 0; height: 0; }

.nav-group { display: grid; gap: 2px; }

.nav-label {
  padding: 6px 8px 4px;
  color: rgba(255, 255, 255, .35);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
}

.sidebar button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-ctl);
  background: transparent;
  color: rgba(255, 255, 255, .68);
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: background .15s ease, color .15s ease;
}

.sidebar button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  opacity: .75;
}

.sidebar button:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.sidebar button.active {
  background: var(--blue-deep);
  color: #fff;
  font-weight: 600;
}

.sidebar button.active svg { opacity: 1; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  background: linear-gradient(135deg, #ffba7a, #ff5b83);
}

.sidebar-user strong {
  display: block;
  max-width: 116px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user small {
  display: block;
  max-width: 116px;
  color: rgba(255, 255, 255, .45);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user .badge {
  min-height: 17px;
  margin: 0 4px 0 0;
  padding: 1px 6px;
  font-size: 10px;
}

main {
  min-width: 0;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 52px;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar strong {
  color: var(--ink);
  font-size: var(--font-title);
  font-weight: 600;
}

.topbar span {
  color: var(--muted);
  margin-left: 10px;
  font-size: 12px;
}

.topbar > div:first-child { min-width: 0; }

#health, #actionStatus {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
  vertical-align: middle;
}

#actionStatus { max-width: 520px; }

#actionStatus.loading { background: rgba(224, 120, 0, .1); color: var(--warn); box-shadow: none; }

#actionStatus.loading::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

#actionStatus.ok { background: rgba(31, 161, 93, .1); color: var(--ok); box-shadow: none; }
#actionStatus.error { background: rgba(222, 52, 66, .09); color: var(--danger); box-shadow: none; }

body.busy, body.busy button, body.busy .file { cursor: progress; }

.auth-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-bar span { margin-left: 0; }

.panel {
  display: none;
  padding: 16px 20px 24px;
}

.panel.active { display: block; }

/* ==================== 5. 通用组件 ==================== */

/* --- 控件 --- */
button, .file, select {
  min-height: var(--control-h);
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl);
  background: #fff;
  color: var(--ink);
  padding: 5px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

button:hover, .file:hover {
  border-color: var(--blue);
  color: var(--blue);
}

button:disabled, select:disabled {
  cursor: not-allowed;
  opacity: .5;
}

button:focus-visible, .file:focus-visible, select:focus-visible,
input:focus-visible, textarea:focus-visible {
  outline: 0;
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

button.danger-action {
  border-color: rgba(222, 52, 66, .4);
  color: var(--danger);
}

button.danger-action:hover {
  border-color: var(--danger);
  background: rgba(222, 52, 66, .05);
  color: var(--danger);
}

.file { display: inline-flex; align-items: center; }
.file input { display: none; }

textarea, input {
  width: 100%;
  min-height: var(--control-h);
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl);
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s ease;
}

textarea:hover, input:hover, select:hover { border-color: rgba(52, 104, 255, .4); }

textarea[readonly] { background: #f7f9fc; color: var(--muted); }

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

td input, td textarea { min-height: var(--control-h-sm); }
td textarea { min-height: 68px; }

/* --- 子页签（页内二级导航） --- */
.subtabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 3px;
  margin-bottom: 14px;
  background: #e9edf5;
  border-radius: 8px;
  overflow-x: auto;
}

.subtabs button {
  min-height: 28px;
  padding: 3px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.subtabs button:hover { color: var(--ink); }

.subtabs button.active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(23, 32, 51, .1);
}

.panel-group { display: none; }
.panel-group.active { display: block; }

/* --- 区块头 --- */
.section-head, .card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
  min-width: 0;
}

.compact-head { margin-bottom: 8px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.actions.left { justify-content: flex-start; }

/* --- 卡片容器 --- */
.kpi, .summary, .row-card, .ai-card, .report-card,
.profile-pane, .ai-pane, .table-wrap,
.split > section, .chat-side, .chat-main,
.assist-card, .assist-section, .task-card,
.template-form, .wecom-form, .secondary-box,
.messages, .timeline, .chat-messages, .empty,
.pending-feature-card, .state-card, .detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.kpi, .summary, .split > section,
.profile-pane, .ai-pane, .ai-card, .report-card,
.chat-side, .chat-main, .assist-card, .assist-section, .task-card {
  padding: 14px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
  gap: 12px;
}

.stack { display: grid; gap: 10px; min-width: 0; }

/* --- KPI / 摘要 --- */
.kpi-grid, .summary-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi span, .summary span { color: var(--muted); font-size: 12px; }

.kpi strong, .summary strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}

.kpi small { color: var(--muted); }

.summary-grid.mini-summary { gap: 8px; margin-bottom: 10px; }
.mini-summary .summary { padding: 10px 12px; }
.mini-summary .summary strong { font-size: 18px; }

/* --- 徽章 --- */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(111, 122, 144, .12);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
  white-space: nowrap;
}

.badge.ok { background: rgba(31, 161, 93, .12); color: var(--ok); }
.badge.warn { background: rgba(224, 120, 0, .13); color: var(--warn); }
.badge.danger { background: rgba(222, 52, 66, .1); color: var(--danger); }

/* --- 表格 --- */
.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

th, td {
  border-bottom: 1px solid var(--soft-line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  line-height: 1.4;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9fc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

tr:hover td { background: #f6f9ff; }
tr:last-child td { border-bottom: 0; }

td .cell-actions { display: flex; flex-wrap: wrap; gap: 6px; }
td .cell-actions button { min-height: var(--control-h-sm); padding: 2px 9px; font-size: 12px; }

.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- 空态 / 状态卡 --- */
.empty {
  margin: 0;
  padding: 14px;
  border-style: dashed;
  box-shadow: none;
  color: var(--muted);
}

.state-card {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 16px;
  border-style: dashed;
  box-shadow: none;
}

.state-card strong { display: block; margin-top: 6px; font-size: 14px; color: var(--ink); }
.state-card p { margin: 6px 0 0; color: var(--muted); line-height: 1.6; }

.state-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(111, 122, 144, .12);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
}

.state-loading .state-kicker { background: rgba(224, 120, 0, .13); color: var(--warn); }

.state-loading .state-kicker::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.state-error { border-color: rgba(222, 52, 66, .3); background: rgba(222, 52, 66, .04); }
.state-error .state-kicker { background: rgba(222, 52, 66, .1); color: var(--danger); }
.state-risk { border-color: rgba(224, 120, 0, .35); background: rgba(224, 120, 0, .05); }
.state-risk .state-kicker { background: rgba(224, 120, 0, .13); color: var(--warn); }

/* --- 行卡片 --- */
.row-card {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  min-width: 0;
  transition: border-color .15s ease;
}

.row-card:hover { border-color: rgba(52, 104, 255, .35); }
.row-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.priority-card { border-left: 3px solid var(--line); }
.priority-高 { border-left-color: var(--danger); }
.priority-中 { border-left-color: var(--orange); }
.priority-低 { border-left-color: var(--green); }

/* --- 列表项按钮 --- */
.list-item {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  min-height: 0;
  padding: 8px 10px;
  border-radius: var(--radius-ctl);
  overflow: hidden;
}

.list-item strong, .list-item span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item strong { font-size: 13px; font-weight: 600; line-height: 1.3; }
.list-item span { color: var(--muted); font-size: 11px; }

.list-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item.selected {
  border-color: rgba(52, 104, 255, .45);
  color: var(--blue);
  background: var(--blue-soft);
}

/* --- 表单容器 --- */
.compact-form { display: grid; gap: 10px; margin-bottom: 14px; }

.template-form {
  padding: 14px;
  display: grid;
  grid-template-columns: 160px 150px 140px minmax(260px, 1fr) 120px;
  gap: 10px;
  align-items: start;
  margin-bottom: 14px;
}

.template-form textarea { min-height: 68px; }

.wecom-form {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(140px, .8fr) minmax(120px, .7fr) minmax(120px, .7fr) 110px;
  gap: 10px;
  align-items: start;
  margin-bottom: 14px;
}

#manualTaskForm {
  padding: 12px;
  grid-template-columns: minmax(180px, 1.2fr) minmax(130px, .78fr) minmax(150px, .88fr) minmax(190px, 1fr) 132px;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 12px;
}

#manualTaskForm textarea {
  min-height: 56px;
  grid-column: 1 / 4;
  grid-row: 2;
}

#manualTaskDeviceHint {
  grid-column: 4;
  grid-row: 2;
  margin: 0;
  min-height: 56px;
  max-height: 56px;
  padding: 7px 9px;
  border: 1px dashed var(--soft-line);
  border-radius: var(--radius-ctl);
  background: #f7f9fc;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.35;
}

#manualTaskMode { grid-column: 5; grid-row: 1; }
#manualTaskForm > button { grid-column: 5; grid-row: 2; min-height: 100%; }

.secondary-box { margin: 10px 0 12px; padding: 12px; box-shadow: none; }
.secondary-box summary { font-weight: 600; }

.inline-check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.inline-check input { width: auto; min-height: 0; }

/* --- 定义列表 / 文本 --- */
dl { margin: 10px 0 0; }
dt { color: var(--muted); font-size: 11px; margin-top: 10px; font-weight: 600; }
dd { margin: 3px 0 0; line-height: 1.55; }

pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0 0;
  color: var(--ink-2);
  background: #f7f9fc;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  padding: 10px;
  font-size: 12px;
  line-height: 1.55;
}

details { margin: 10px 0; }
summary { cursor: pointer; color: var(--muted); }

/* --- 消息 / 时间线 --- */
.messages { max-height: 480px; overflow: auto; }

.msg { padding: 10px 12px; border-bottom: 1px solid var(--soft-line); }
.msg:last-child { border-bottom: 0; }
.msg p { margin: 4px 0; line-height: 1.55; }

.timeline { max-height: 540px; overflow: auto; padding: 10px; }

.timeline-item {
  position: relative;
  padding: 10px 10px 10px 14px;
  border-left: 3px solid var(--line);
  border-bottom: 1px solid var(--soft-line);
}

.timeline-item:last-child { border-bottom: 0; }
.timeline-send_log { border-left-color: var(--green); }
.timeline-followup, .timeline-ai_output, .timeline-weekly_report { border-left-color: var(--blue); }
.timeline-checkin { border-left-color: var(--orange); }

.timeline-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.timeline-head time { margin-left: auto; color: var(--muted); font-size: 11px; }
.timeline-item p { margin: 6px 0; line-height: 1.6; white-space: pre-wrap; }

.evidence-box {
  display: grid;
  gap: 8px;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  background: #fbfcfe;
}

.evidence-box blockquote {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  border-radius: 4px;
}

.evidence-box p { margin: 3px 0; line-height: 1.55; }

/* --- 跟进记录 --- */
.followup-list { display: grid; gap: 8px; margin: 10px 0 16px; }

.followup-card {
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  background: #fff;
}

.followup-需升级 { border-color: rgba(222, 52, 66, .3); background: rgba(222, 52, 66, .04); }
.followup-card p { margin: 6px 0 0; }
.followup-form textarea { min-height: 80px; }

/* --- AI 卡片 --- */
.ai-card { border-left-width: 3px; }
.agent-profile { border-left-color: var(--blue); }
.agent-weekly { border-left-color: var(--purple); }
.agent-reply { border-left-color: var(--green); }
.agent-checkin { border-left-color: var(--orange); }

.agent-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-bottom: 12px;
}

.report-grid p { margin: 0; line-height: 1.55; }
.report-grid strong { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }

/* --- 阶段卡（家庭详情） --- */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.stage-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  background: #f8faff;
}

.stage-card.wide { grid-column: span 2; }
.stage-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }

.stage-card strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 340px;
  gap: 12px;
}

.detail-card { padding: 14px; }

.op-layer { display: grid; gap: 4px; min-width: 170px; }
.op-layer strong { font-size: 12px; }
.op-layer .muted { margin: 0; font-size: 11px; }

.output-preview { margin-top: 14px; }

.login-status { margin: 10px 0 14px; }
.login-status p { margin: 4px 0 0; }

/* --- 开关 --- */
.switch-control { position: relative; flex: 0 0 auto; }
.switch-control input { position: absolute; opacity: 0; width: auto; min-height: 0; }

.switch-control span {
  display: block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #d5dbe8;
  transition: background .16s ease;
}

.switch-control span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(23, 32, 51, .25);
  transition: transform .16s ease;
}

.switch-control input:checked + span { background: var(--green); }
.switch-control input:checked + span::after { transform: translateX(20px); }

/* --- Toast --- */
#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 400px;
  background: rgba(26, 34, 51, .94);
  color: #fff;
  padding: 11px 14px;
  border-radius: var(--radius-card);
  box-shadow: 0 10px 30px rgba(23, 32, 51, .25);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 10;
}

#toast.show { opacity: 1; transform: translateY(0); }

/* ==================== 6. 页面模块 ==================== */

/* --- 工作台 --- */
.dashboard-panel { max-width: 1440px; margin: 0 auto; }

.console-kpis {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  min-height: 76px;
  padding: 12px;
}

.metric-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-card);
  color: var(--blue);
  background: var(--blue-soft);
}

.metric-icon svg { width: 15px; height: 15px; }

.metric-danger .metric-icon, .insight-danger .metric-icon { background: rgba(222, 52, 66, .1); color: var(--danger); }
.metric-green .metric-icon, .insight-green .metric-icon { background: rgba(31, 161, 93, .11); color: var(--green); }
.metric-blue .metric-icon, .insight-blue .metric-icon { background: var(--blue-soft); color: var(--blue); }
.metric-purple .metric-icon, .insight-purple .metric-icon { background: rgba(124, 77, 255, .1); color: var(--purple); }
.metric-orange .metric-icon, .insight-orange .metric-icon { background: rgba(224, 120, 0, .11); color: var(--orange); }
.metric-sky .metric-icon { background: rgba(15, 139, 217, .1); color: var(--sky); }
.metric-ok .metric-icon { background: rgba(31, 161, 93, .11); color: var(--green); }

.metric-card span { display: block; color: var(--ink-2); font-size: 12px; font-weight: 500; }

.metric-card strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}

.metric-card strong small { margin-left: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.metric-card em { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; font-style: normal; }

.dashboard-triad {
  display: grid;
  grid-template-columns: minmax(300px, .92fr) minmax(420px, 1.38fr) minmax(280px, .86fr);
  gap: 12px;
  align-items: stretch;
}

.dashboard-card, .insight-card, .work-suggestions {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.dashboard-card { min-width: 0; padding: 14px; }
.dashboard-card .section-head { margin-bottom: 10px; }
.dashboard-card h2 { font-size: 14px; }

.priority-panel .stack, .ai-advice-panel .stack {
  max-height: 340px;
  overflow: auto;
  padding-right: 4px;
}

.priority-panel .row-card {
  align-items: flex-start;
  min-height: 0;
  padding: 10px 10px 10px 12px;
  border-radius: var(--radius-ctl);
  box-shadow: none;
}

.priority-panel .row-card p { margin-top: 3px; font-size: 12px; }
.priority-panel .cell-actions { flex-direction: column; align-items: stretch; min-width: 72px; }
.priority-panel .cell-actions button { min-height: var(--control-h-sm); padding: 0 9px; font-size: 12px; }

.funnel-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.funnel-row, .todo-column {
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  padding: 10px;
  background: #fff;
}

.funnel-top, .todo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.funnel-top strong { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }

.funnel-families { display: flex; flex-wrap: wrap; gap: 6px; }

.funnel-families button {
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
}

.family-brief-panel .funnel-list { margin-bottom: 10px; }
.family-brief-panel .funnel-row { min-height: 84px; background: #f8faff; }
.family-brief-panel .funnel-top strong { font-size: 20px; }
.family-brief-panel .funnel-families { max-height: 40px; overflow: hidden; }

.todo-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.todo-item {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  min-height: 54px;
  padding: 8px 10px;
  background: #f8faff;
}

.todo-item span, .todo-item small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.todo-item small { white-space: nowrap; font-size: 11px; }

.ai-advice-panel .ai-card { padding: 10px; border-radius: var(--radius-ctl); box-shadow: none; }

.ai-advice-panel .ai-card pre {
  max-height: 66px;
  margin: 6px 0 0;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.5;
}

.ai-advice-panel .card-top { align-items: flex-start; margin-bottom: 0; }

.insight-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.insight-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 9px;
  min-height: 96px;
  padding: 12px;
}

.insight-card strong { display: block; color: var(--ink); font-size: 12px; font-weight: 600; }

.insight-card span {
  display: block;
  margin: 5px 0 6px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.insight-card small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }

.insight-card button {
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  justify-self: start;
}

.work-suggestions {
  display: grid;
  grid-template-columns: 96px repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 12px 16px;
  color: var(--ink-2);
  font-size: 12px;
}

.work-suggestions strong { color: var(--blue); font-size: 13px; }

.work-suggestions span { position: relative; padding-left: 12px; }

.work-suggestions span::before {
  content: "";
  position: absolute;
  left: 0;
  top: .6em;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--muted);
}

/* --- 功能待开放 --- */
.pending-feature-card { margin-bottom: 16px; padding: 16px; border-style: dashed; box-shadow: none; }
.pending-feature-card strong { display: block; font-size: 14px; }
.pending-feature-card p { margin: 8px 0 0; color: var(--muted); line-height: 1.65; }

/* --- 陪跑会话 --- */
#webChat { font-variant-numeric: tabular-nums; }

#webChat .section-head { gap: 10px; margin-bottom: 10px; }
#webChat .chat-workbench-head { align-items: flex-start; }
#webChat .chat-workbench-head > div:first-child { min-width: 220px; }
#webChat .chat-workbench-head p { margin: 3px 0 0; font-size: 12px; }

.chat-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}

.chat-side, .chat-main { min-width: 0; align-self: stretch; padding: 12px; }

.chat-side { display: grid; align-content: start; gap: 8px; }

.chat-side-head, .chat-room-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  min-height: 28px;
  margin-bottom: 0;
}

.chat-side-head h3, .chat-room-head h2 { font-size: 14px; line-height: 1.3; }

#chatSearch {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.login-status.compact {
  display: grid;
  align-content: center;
  gap: 2px;
  margin: 0;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  background: #f8faff;
}

.login-status.compact > span, .login-status.compact small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.login-status.compact strong {
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 12px;
  line-height: 1.2;
}

.chat-conversation-list {
  display: grid;
  gap: 5px;
  max-height: clamp(360px, 56vh, 600px);
  overflow: auto;
  padding-right: 2px;
}

#webChat .list-item small {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chat-messages {
  height: clamp(360px, 56vh, 600px);
  overflow: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.chat-date-sep {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 6px 0 4px;
  background: linear-gradient(180deg, #fff 65%, rgba(255, 255, 255, 0));
}

.chat-date-sep span {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef1f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.chat-message-row {
  display: grid;
  grid-template-columns: minmax(100px, 148px) minmax(0, 1fr) 64px;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--soft-line);
}

.chat-message-row:nth-child(even) { background: #fafbfe; }
.chat-message-row.ai { background: rgba(52, 104, 255, .045); }
.chat-message-row:last-child { border-bottom: 0; }

.chat-message-speaker {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-message-kind {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(31, 161, 93, .12);
  color: var(--ok);
  font-size: 10px;
  font-weight: 600;
  font-style: normal;
}

.chat-message-row.ai .chat-message-kind { background: rgba(52, 104, 255, .12); color: var(--blue); }

.chat-message-row.queued { background: rgba(224, 120, 0, .05); }
.chat-message-row.queued .chat-message-kind { background: rgba(224, 120, 0, .14); color: var(--warn); }
.chat-message-row.queued .chat-message-content { color: var(--ink-2); }

.chat-message-row.send-failed { background: rgba(222, 52, 66, .05); }
.chat-message-row.send-failed .chat-message-kind { background: rgba(222, 52, 66, .12); color: var(--danger); }
.chat-message-row.send-failed .chat-message-content { white-space: normal; }

.chat-message-row.send-failed .chat-message-content small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-message-row.send-failed .chat-message-time button {
  min-height: 22px;
  padding: 1px 8px;
  font-size: 11px;
}

.chat-message-content {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.chat-message-time {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.chat-messages .empty, .chat-messages .state-card { margin: 10px; }

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 8px;
  margin-top: 10px;
}

.chat-compose textarea {
  height: 42px;
  min-height: 42px;
  max-height: 96px;
  padding: 7px 10px;
  line-height: 1.35;
}

.chat-send-actions { display: grid; gap: 6px; }
.chat-send-actions button { width: 100%; min-height: var(--control-h); padding: 4px 10px; font-size: 12px; }

#chatSendHint { grid-column: 1 / -1; margin: -2px 0 0; font-size: 11px; line-height: 1.4; }
#chatMeta { font-size: 11px; }

#webChat .assist-card, #webChat .assist-section, #webChat .task-card { padding: 10px; }
#webChat .assist-card dt, #webChat .assist-card dd { font-size: 12px; line-height: 1.4; }
#webChat textarea[id^="chat-task-"] { min-height: 80px; font-size: 13px; line-height: 1.45; }

.assist-section { display: grid; gap: 10px; min-width: 0; }

/* --- 任务审核列表（表格化行 + 展开详情） --- */
.task-card { display: grid; min-width: 0; }
.task-card textarea { min-height: 72px; }

.task-review-list, .reply-draft-list {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.task-review-header {
  display: grid;
  grid-template-columns: 64px minmax(170px, .95fr) minmax(260px, 1.35fr) minmax(128px, .7fr) minmax(150px, .8fr) 78px;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.task-review-card {
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--soft-line);
  background: transparent;
  box-shadow: none;
}

.task-review-card:last-child { border-bottom: 0; }

.task-card-summary {
  display: grid;
  grid-template-columns: 64px minmax(170px, .95fr) minmax(260px, 1.35fr) minmax(128px, .7fr) minmax(150px, .8fr) 78px;
  gap: 6px;
  align-items: center;
  min-height: 42px;
  padding: 6px 10px;
  cursor: pointer;
  list-style: none;
}

.task-card-summary::-webkit-details-marker { display: none; }
.task-card-summary:hover { background: #f6f9ff; }

.task-summary-id, .task-summary-target, .task-summary-preview,
.task-summary-status, .task-summary-readiness { min-width: 0; }

.task-summary-id { color: var(--muted); font-size: 11px; font-weight: 600; }

.task-summary-target strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-summary-target small {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-summary-preview {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-summary-status, .task-summary-readiness { display: flex; flex-wrap: wrap; gap: 3px; }

.task-expand-label, .reply-expand-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl);
  color: var(--ink-2);
  background: #fff;
  font-weight: 500;
  font-size: 11px;
}

.task-expand-label::before { content: "展开"; }
.task-review-card[open] .task-expand-label::before { content: "收起"; }

.task-card-detail {
  display: grid;
  gap: 8px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  background: #fafbfe;
}

.task-detail-table {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  background: #fff;
}

.task-detail-table section {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 6px 8px;
  border-right: 1px solid var(--soft-line);
}

.task-detail-table section:last-child { border-right: 0; }

.task-detail-table section > span, .task-content-editor > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.task-content-editor { display: grid; gap: 6px; }

/* --- 发送日志列表（摘要行 + 展开详情，复用 task-review 组件） --- */
.log-review-header, .log-card-summary {
  display: grid;
  grid-template-columns: 84px minmax(150px, .95fr) minmax(150px, .8fr) minmax(210px, 1.3fr) minmax(96px, .55fr) 64px;
  gap: 6px;
  align-items: center;
}

.log-review-header {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.log-card-summary {
  min-height: 42px;
  padding: 6px 10px;
  cursor: pointer;
  list-style: none;
}

.log-card-summary::-webkit-details-marker { display: none; }
.log-card-summary:hover { background: #f6f9ff; }

.log-card-summary > time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.log-summary-target { min-width: 0; }

.log-summary-target strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-summary-target small {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-summary-status { display: flex; flex-wrap: wrap; gap: 3px; min-width: 0; }
.log-summary-status .badge { margin-right: 0; }

.log-summary-reason {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  min-width: 0;
  color: var(--ink-2);
  font-size: 12px;
}

.log-summary-reason .badge { flex: 0 0 auto; margin-right: 0; }

.log-summary-reason > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-summary-verify { min-width: 0; }

/* --- AI 回复配置与草稿列表 --- */
.reply-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.reply-summary-card {
  min-height: 76px;
  padding: 12px;
  border-left: 3px solid var(--blue);
  background: #fff;
}

.reply-summary-card small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }

.reply-config-form {
  display: grid;
  grid-template-columns: minmax(280px, .88fr) minmax(360px, 1.12fr);
  gap: 10px;
  margin-bottom: 10px;
}

.reply-switch-card, .reply-config-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.reply-switch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.reply-switch-card.enabled {
  border-color: rgba(31, 161, 93, .38);
  background: rgba(31, 161, 93, .04);
}

.reply-switch-card h3, .reply-config-card h3 { margin: 0; }

.reply-switch-card p, .reply-config-status p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.reply-config-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.reply-config-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.reply-agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.reply-agent-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  background: #f8faff;
}

.reply-agent-card.active { border-color: rgba(52, 104, 255, .35); background: var(--blue-soft); }
.reply-agent-card input { width: auto; min-height: 0; margin-top: 2px; }
.reply-agent-card strong, .reply-agent-card span { grid-column: 2; }
.reply-agent-card span { color: var(--muted); font-size: 12px; line-height: 1.4; }

.reply-config-status { display: grid; align-content: start; gap: 8px; }
.reply-record-panel { margin-top: 12px; }
.reply-output-panel .compact-head { margin-bottom: 10px; }

.reply-output-panel #replyOutputs { max-height: 620px; overflow: auto; padding-right: 4px; }

.reply-record-card .reply-draft-body > pre {
  margin: 0;
  max-height: 150px;
  overflow: auto;
  white-space: pre-wrap;
}

.reply-draft-header {
  display: grid;
  grid-template-columns: minmax(180px, .95fr) minmax(260px, 1.35fr) 108px 66px;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.reply-draft-card {
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--soft-line);
  background: transparent;
  box-shadow: none;
}

.reply-draft-card:last-child { border-bottom: 0; }
.reply-draft-card:hover { background: #f6f9ff; }

.reply-draft-summary {
  display: grid;
  grid-template-columns: minmax(180px, .95fr) minmax(260px, 1.35fr) 108px 66px;
  gap: 6px;
  align-items: center;
  min-height: 42px;
  padding: 6px 10px;
  color: var(--ink);
  list-style: none;
  cursor: pointer;
}

.reply-draft-summary::-webkit-details-marker { display: none; }

.reply-draft-main, .reply-draft-preview { min-width: 0; }

.reply-draft-meta { display: flex; flex-wrap: wrap; gap: 3px 0; align-items: center; }
.reply-draft-meta strong { font-size: 13px; font-weight: 600; }

.reply-draft-summary p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-draft-summary small { color: var(--muted); font-size: 11px; white-space: nowrap; }

.reply-expand-label::before { content: "展开"; }
.reply-draft-card[open] .reply-expand-label::before { content: "收起"; }

.reply-draft-body {
  display: grid;
  gap: 8px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  background: #fafbfe;
}

.reply-draft-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  gap: 0;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  background: #fff;
}

.reply-draft-info section {
  min-width: 0;
  padding: 6px 8px;
  border-right: 1px solid var(--soft-line);
  background: transparent;
}

.reply-draft-info section:last-child { border-right: 0; }

.reply-draft-info span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.reply-draft-info strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-evidence {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius-ctl);
  background: #fbfcfe;
}

.reply-evidence > summary { color: var(--ink); font-weight: 600; font-size: 12px; }
.reply-evidence pre { max-height: 170px; overflow: auto; }

/* ==================== 7. 响应式 ==================== */
@media (max-width: 1180px) {
  .split, .detail-layout, .chat-shell { grid-template-columns: 1fr; }
  .kpi-grid, .summary-grid, .funnel-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-conversation-list { max-height: 220px; }
}

@media (max-width: 1120px) {
  .console-kpis, .insight-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-triad { grid-template-columns: 1fr; }
  .work-suggestions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1100px) {
  .task-review-header, .task-card-summary {
    grid-template-columns: 56px minmax(150px, 1fr) minmax(190px, 1.1fr) minmax(118px, .75fr) 64px;
  }

  .task-review-header span:nth-child(5), .task-summary-readiness { display: none; }
  .task-detail-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-detail-table section { border-right: 0; border-bottom: 1px solid var(--soft-line); }

  .log-review-header, .log-card-summary {
    grid-template-columns: 80px minmax(140px, 1fr) minmax(140px, .9fr) minmax(180px, 1.2fr) 60px;
  }

  .log-review-header span:nth-child(5), .log-summary-verify { display: none; }
}

@media (max-width: 820px) {
  body { display: block; width: 100%; max-width: 100vw; }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 6;
    width: 100%;
    max-width: 100vw;
    height: auto;
    padding: 8px 12px;
  }

  .brand, .sidebar-user { display: none; }

  .sidebar nav {
    display: flex;
    overflow-x: auto;
    width: 100%;
    gap: 6px;
    padding-bottom: 2px;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .nav-group { display: flex; flex: 0 0 auto; gap: 6px; }
  .nav-label { display: none; }

  .sidebar button {
    width: auto;
    min-width: 96px;
    flex: 0 0 auto;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }

  main, .topbar, .panel { width: 100%; max-width: 100vw; min-width: 0; }

  .topbar {
    position: relative;
    top: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
    gap: 10px;
  }

  .topbar > div { width: 100%; min-width: 0; }
  .topbar .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }

  .panel { padding: 12px; }

  .section-head, .card-top, .row-card { align-items: stretch; flex-direction: column; }
  .row-card .cell-actions, .card-top .actions, .section-head .actions { justify-content: flex-start; }

  .kpi-grid, .summary-grid, .stage-grid, .funnel-list, .todo-board,
  .report-grid, .template-form, .wecom-form, .console-kpis, .insight-grid,
  .work-suggestions, .reply-config-form, .reply-config-fields, .reply-agent-grid,
  .family-brief-panel .funnel-list, .family-brief-panel .todo-board {
    grid-template-columns: 1fr;
  }

  #manualTaskForm { grid-template-columns: 1fr; }

  #manualTaskForm textarea, #manualTaskDeviceHint, #manualTaskForm > button {
    grid-column: auto;
    grid-row: auto;
  }

  .stage-card.wide { grid-column: auto; }

  .chat-side, .chat-main { padding: 10px; }
  .chat-messages { height: min(56vh, 480px); }
  .chat-compose { grid-template-columns: 1fr; }

  .chat-message-row { grid-template-columns: minmax(84px, 110px) minmax(0, 1fr); }
  .chat-message-time { display: none; }

  .reply-switch-card { align-items: flex-start; }
  .reply-draft-header { display: none; }
  .reply-draft-summary { grid-template-columns: 1fr; }
  .reply-expand-label, .task-expand-label { width: 100%; }
  .reply-draft-info { grid-template-columns: 1fr; }

  .task-card-summary { grid-template-columns: 1fr; }
  .task-review-header { display: none; }
  .task-summary-status, .task-summary-readiness { justify-content: flex-start; max-width: none; }
  .task-detail-table { grid-template-columns: 1fr; }

  .log-review-header { display: none; }
  .log-card-summary { grid-template-columns: 1fr; }

  .table-wrap { max-width: 100%; overflow-x: auto; }
  table { min-width: 720px; }

  #actionStatus { margin: 8px 0 0; max-width: 100%; }
  #toast { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}

@media (max-width: 720px) {
  .landing-nav { gap: 12px; }
  .landing-nav-links { display: none; }
}

@media (max-width: 520px) {
  .cell-actions, .actions.left, .actions { display: grid; grid-template-columns: 1fr; }

  button, .file, select { width: 100%; justify-content: center; text-align: center; }

  .topbar .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 10px; }
  .kpi strong, .summary strong { font-size: 20px; }
}

@media (max-width: 360px) {
  .topbar .actions { grid-template-columns: 1fr; }
}
