
/* ========================================
   1. CSS 变量定义（Material Design 3 tokens — Stitch reference 对齐）
   ======================================== */
:root {
  /* ── 品牌主色 ── */
  --primary: #a83807;
  --primary-dark: #822700;
  --primary-container: #ef6b3a;
  --on-primary: #ffffff;
  --primary-subtle: rgba(168, 56, 7, 0.10);

  /* ── 辅助色 ── */
  --secondary: #296861;
  --secondary-container: #b0efe5;
  --on-secondary: #ffffff;
  --tertiary: #005ac2;
  --tertiary-container: #5391ff;

  /* ── 系统功能色（与 M3 secondary/error 对齐）── */
  --success: #296861;
  --success-bg: rgba(41, 104, 97, 0.12);
  --warning: #a83807;
  --warning-bg: rgba(168, 56, 7, 0.10);
  --danger: #ba1a1a;
  --danger-bg: rgba(186, 26, 26, 0.10);
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --info: #005ac2;
  --info-bg: rgba(0, 90, 194, 0.1);

  /* 背景色 */
  --bg: #f8f9fa;
  /* ── surfaces（M3 surface 层级）── */
  --surface: #ffffff;
  --surface-dim: #d9dadb;
  --surface-bright: #f8f9fa;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f3f4f5;
  --surface-container: #edeeef;
  --surface-container-high: #e7e8e9;
  --surface-container-highest: #e1e3e4;
  --surface-muted: #f5f7f8;
  --bg: #f8f9fa;
  --bg-hover: #f0faf8;

  /* ── Alias tokens (for compatibility) ── */
  --surface-0: #ffffff;
  --surface-1: #f3f4f5;
  --surface-variant: #edeeef;
  --border-color: #e1e3e4;
  --brand-primary: #a83807;

  /* ── Text ── */
  --on-surface: #191c1d;
  --on-surface-variant: #58423a;
  --text-primary: #191c1d;
  --text-secondary: #303536;
  --text-muted: #5f6b70;
  --text-placeholder: #95a1a8;
  --text-on-primary: #ffffff;
  --accent-teal: #0f766e;

  /* ── Outline ── */
  --outline: #8c7169;
  --outline-variant: rgba(224, 192, 182, 0.30);
  --border: #e1e3e4;
  --border-light: #eceff1;
  --border-strong: #cfd5d8;

  /* ── 阴影 ── */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 2px 8px rgba(25, 28, 29, 0.06);
  --shadow-elevated: 0 6px 16px rgba(25, 28, 29, 0.10);
  --shadow-interactive: 0 6px 18px rgba(168, 56, 7, 0.22);

  /* ── 圆角（对齐 Stitch rounded-xl = 12px）── */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* ── 字体 ── */
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", monospace;

  /* ── 字号与行高 token（语义层） ── */
  --font-size-2xs: 10px;
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-md: 14px;
  --font-size-lg: 15px;
  --font-size-xl: 17px;
  --font-size-2xl: 20px;
  --line-height-tight: 1.35;
  --line-height-base: 1.6;
  --line-height-relaxed: 1.75;

  /* ── 兼容别名（收口历史模板变量） ── */
  --bg-subtle: var(--surface-muted);
  --border-subtle: var(--border-light);
  --tone-brand: var(--primary);
  --tone-success: var(--success);
  --tone-danger: var(--danger);
  --tone-gold: var(--warning);
  --tone-pine: var(--accent-teal);
  --tone-brand-subtle: rgba(168, 56, 7, 0.08);
  --tone-success-subtle: rgba(41, 104, 97, 0.08);
  --tone-danger-subtle: rgba(186, 26, 26, 0.08);
  --tone-gold-subtle: rgba(168, 56, 7, 0.08);

  /* ── 间距 ── */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;

  /* ── 布局（固定 topbar + 固定 sidebar）── */
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --topbar-height: var(--topbar-h);

  /* ── 过渡 ── */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
}

/* ========================================
   2. 基础样式
   ======================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-base);
  font-feature-settings: "tnum" 1;
  color: var(--text-primary);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ========================================
   3. 布局系统（固定 topbar 64px + 固定 sidebar 256px）
   ======================================== */
.app-shell {
  display: block;
  min-height: 100vh;
  background: var(--bg);
}

/* ── 侧边栏 ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface-container-low);
  border-right: 1px solid var(--outline-variant);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  padding-top: var(--topbar-h);
  z-index: 40;
}

/* 侧边栏品牌区 */
.sidebar-brand {
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
}

.brand-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-1);
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-lg);
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-container);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.brand-version {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--surface-container);
  border-radius: var(--radius-full);
}

/* 侧边栏 nav */
.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 平铺 nav-item（无 section 标题）*/
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--secondary);
  transform: translateX(3px);
}

.nav-item.active {
  background: rgba(41, 104, 97, 0.12);
  color: var(--secondary);
  font-weight: 600;
}

.nav-item .material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: 'wght' 300, 'FILL' 0;
  color: inherit;
  opacity: 0.75;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.nav-item.active .material-symbols-outlined,
.nav-item:hover .material-symbols-outlined {
  opacity: 1;
  font-variation-settings: 'wght' 400, 'FILL' 0;
}

/* nav-section-title: 兼容旧渲染 — 隐藏 */
.nav-section { display: contents; }
.nav-section-title { display: none; }

/* ── 主内容区（固定偏移）── */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── 顶部栏（固定）── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  gap: var(--space-4);
}

.topbar-brand {
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  min-width: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: var(--space-6);
}

.topbar-nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.topbar-nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-container-low);
}

.topbar-nav-link.active {
  color: var(--primary);
  background: var(--primary-subtle);
  font-weight: 700;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: var(--space-4);
}

.topbar-search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.topbar-search-icon {
  position: absolute;
  left: 10px;
  font-size: 16px !important;
  line-height: 1;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

.topbar-search {
  width: 200px;
  height: 34px;
  border: none;
  background: var(--surface-container-low);
  border-radius: var(--radius-sm);
  padding: 0 12px 0 34px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: box-shadow var(--transition-fast);
}

.topbar-search:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(168, 56, 7, 0.18);
}

.topbar-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-container-low);
  color: var(--text-muted);
  font-size: 14px;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

.topbar-icon:hover {
  background: var(--bg-hover);
  color: var(--secondary);
}

.topbar-icon .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'wght' 300;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--outline-variant);
}

/* 页面内容 */
.page-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1440px;
  width: 100%;
}

.page-inline-meta {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px var(--space-4);
  box-shadow: var(--shadow-sm);
}

/* ── 侧边栏底部 ── */
.sidebar-foot {
  border-top: 1px solid var(--outline-variant);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-foot .btn {
  width: 100%;
  justify-content: center;
}

.sidebar-logout {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sidebar-logout:hover {
  background: var(--surface-container);
  color: var(--text-secondary);
}

.sidebar-logout .material-symbols-outlined {
  font-size: 16px;
}

/* ========================================
   4. 组件样式
   ======================================== */

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(168, 56, 7, 0.20);
}

.btn-sm {
  height: 28px;
  padding: 0 var(--space-3);
  font-size: 13px;
}

.btn-md {
  height: 32px;
  padding: 0 var(--space-4);
}

.btn-lg {
  height: 40px;
  padding: 0 var(--space-5);
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-interactive);
}

.btn-secondary {
  background: var(--surface-container-high);
  color: var(--secondary);
  border: 1px solid rgba(41, 104, 97, 0.22);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--secondary);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #9b1212;
}

/* 卡片 */
.card {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card-hover:hover {
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}

/* KPI 卡片 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.kpi-card {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}

.kpi-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.kpi-trend {
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--error); }

/* 表格 */
.table-container {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(2px);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.table th {
  text-align: left;
  padding: 11px var(--space-4);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  background: var(--surface-muted);
  border-bottom: 1px solid rgba(140, 113, 105, 0.12);
  white-space: nowrap;
}

.table td {
  padding: 12px var(--space-4);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(140, 113, 105, 0.08);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: rgba(176, 239, 229, 0.25);
}

.row-p0 > td:first-child {
  border-left: 3px solid #c2410c;
}

.row-attention > td:first-child {
  border-left: 3px solid var(--warning);
}

/* ── sidebar-foot: 定义已前置至布局系统区，此处保留覆写层清除 grid ── */
.sidebar-foot { display: flex; }

/* 状态标签 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.badge-neutral {
  background: var(--bg-hover);
  color: var(--text-muted);
}

/* 输入框 */
.input {
  width: 100%;
  height: 32px;
  padding: 0 var(--space-3);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

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

/* 筛选工具栏 */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.filter-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 面板 */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base), border-color var(--transition-fast);
}

.panel:hover {
  box-shadow: var(--shadow-elevated);
  border-color: var(--border-strong);
}

.panel-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
}

.panel-body {
  padding: var(--space-4) var(--space-5);
}

/* 列表 */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item strong {
  min-width: 108px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 700;
}

.list-item p,
.list-item span {
  color: var(--text-primary);
  flex: 1;
}

.list-item p {
  font-size: var(--font-size-md);
  line-height: var(--line-height-base);
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.list-item-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.empty-inline {
  padding: var(--space-3);
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.danger-note {
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.06);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.danger-note strong {
  color: #B91C1C;
  font-size: 13px;
}

.danger-note p {
  color: #7F1D1D;
  font-size: 13px;
  margin-top: 4px;
}

.decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.decision-actions-dense .btn {
  min-width: 120px;
}

.fold-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.fold-panel + .fold-panel {
  margin-top: var(--space-4);
}

.fold-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px var(--space-4);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, #fbfcff 0%, var(--surface-muted) 100%);
}

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

.fold-content.panel {
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.mono-code {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: 0.01em;
  color: var(--text-secondary);
  word-break: break-all;
}

.mono-code-tight {
  font-size: var(--font-size-xs);
}

.list-spaced-top {
  margin-top: var(--space-4);
}

.danger-note-tight {
  margin-top: var(--space-2);
  margin-bottom: 0;
}

.tag-flow {
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-4);
}

.subtle-empty {
  padding: var(--space-4);
  color: var(--text-muted);
}

.receipt-panel {
  padding: 12px 16px;
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.receipt-panel-success {
  border-color: rgba(41, 104, 97, 0.24);
  background: rgba(41, 104, 97, 0.06);
}

.receipt-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.receipt-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.receipt-meta-gap {
  margin-top: 4px;
}

.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.table-op-divider {
  color: var(--text-muted);
  margin: 0 6px;
}

.task-phase-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
}

.task-phase-card {
  display: grid;
  gap: var(--space-2);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-muted);
}

.task-phase-card.is-active {
  border-color: rgba(168, 56, 7, 0.32);
  background: rgba(168, 56, 7, 0.07);
}

.task-phase-card.is-complete {
  border-color: rgba(41, 104, 97, 0.32);
  background: rgba(41, 104, 97, 0.08);
}

.task-phase-card.is-blocked {
  border-color: rgba(191, 53, 35, 0.32);
  background: rgba(191, 53, 35, 0.08);
}

.task-phase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.task-phase-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  line-height: 1.55;
}

.field-group {
  display: grid;
  gap: var(--space-2);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.field-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.field-required {
  color: var(--danger);
  margin-left: 2px;
}

.field-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(168, 56, 7, 0.12);
}

textarea.field-input {
  min-height: 88px;
  resize: vertical;
  padding: 10px 12px;
  line-height: var(--line-height-base);
}

.field-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.decision-section {
  margin-bottom: 24px;
}

.decision-section-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.decision-section-icon {
  font-size: 18px;
  color: var(--text-secondary);
}

.decision-section-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.decision-section-count {
  font-size: var(--font-size-2xs);
}

.decision-item-card {
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
  border-left: 4px solid var(--border);
}

.decision-item-blocked {
  border-left-color: var(--danger);
}

.decision-item-risk {
  border-left-color: var(--warning);
}

.decision-item-approval {
  border-left-color: var(--primary);
}

.decision-item-decision {
  border-left-color: var(--accent-teal);
}

.decision-item-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.decision-item-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: var(--space-1);
}

.decision-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.decision-item-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.decision-item-date {
  flex-shrink: 0;
  white-space: nowrap;
}

.decision-item-scope {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.decision-item-next {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.decision-item-next .material-symbols-outlined {
  font-size: 13px;
  vertical-align: -2px;
}

.decision-item-next-source {
  margin-left: 6px;
}

/* 处理历史 */
.decision-history {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(0,0,0,0.02);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--secondary);
  font-size: 12px;
}
.decision-history-head {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 600;
  margin-bottom: var(--space-1);
  color: var(--text-secondary);
}
.decision-history-count {
  font-size: 11px;
  color: var(--text-muted);
}
.decision-history-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 2px 0;
  color: var(--text-muted);
  font-size: 11px;
}
.decision-history-time {
  color: var(--text-muted);
}
.decision-history-comment {
  color: var(--text-secondary);
  font-style: italic;
}

/* 已处理 card 样式 */
.decision-item-handled {
  background: rgba(41, 104, 97, 0.04) !important;
}
.decision-item-handled .decision-item-head {
  border-left: 3px solid var(--secondary);
  padding-left: 8px;
}
.decision-item-resolved-badge {
  margin-left: var(--space-2);
}

/* 高亮跳转 */
.decision-card-highlighted {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* 提交按钮 */
.decision-action-submit {
  white-space: nowrap;
}

.decision-closed-note {
  margin-top: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
}

.receipt-panel-warning {
  border-left-color: var(--warning);
  background: rgba(213, 126, 40, 0.08);
}

.decision-action-form {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}

.decision-action-select {
  min-width: 148px;
}

.decision-action-input {
  flex: 1;
  min-width: 200px;
}

.decision-approval-structure {
  padding: var(--space-4) var(--space-5);
  margin-bottom: 20px;
}

.decision-approval-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 10px;
}

.decision-approval-title .material-symbols-outlined {
  font-size: 16px;
}

.decision-approval-title span {
  font-size: var(--font-size-md);
  font-weight: 600;
}

.decision-flow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.intake-layout {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(320px, 3fr);
  gap: 24px;
  align-items: start;
}

.intake-layout-chat {
  grid-template-columns: minmax(260px, 1.15fr) minmax(0, 2fr);
}

.intake-sidebar-stack,
.intake-main-stack {
  display: grid;
  gap: 20px;
}

.intake-thread-sidebar,
.intake-thread-panel,
.intake-process-panel {
  padding: 18px 20px;
}

.intake-thread-sidebar-head,
.intake-thread-panel-head,
.intake-process-head {
  align-items: flex-start;
}

.intake-thread-toolbar {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.intake-thread-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.intake-thread-search {
  flex: 1 1 180px;
  min-width: 0;
}

.intake-thread-group-select {
  flex: 0 0 148px;
}

.intake-thread-toolbar-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.intake-thread-list {
  display: grid;
  gap: 14px;
  max-height: 420px;
  overflow-y: auto;
  margin-top: 14px;
}

.intake-thread-group {
  display: grid;
  gap: 10px;
}

.intake-thread-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-secondary);
}

.intake-thread-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.intake-thread-item:hover {
  border-color: var(--c-brand);
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}

.intake-thread-item.active {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 1px rgba(192, 57, 43, 0.16);
}

.intake-thread-item-head,
.intake-message-meta,
.intake-thread-item-meta,
.intake-thread-header-meta,
.intake-process-summary-row,
.intake-process-item-head,
.intake-process-item-meta,
.intake-message-attachments {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.intake-thread-item-head {
  justify-content: space-between;
  margin-bottom: 6px;
}

.intake-thread-item-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.intake-thread-item-preview {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.intake-thread-item-meta,
.intake-thread-header-meta,
.intake-process-item-meta,
.intake-message-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.intake-thread-item-meta,
.intake-thread-header-meta {
  margin-top: 8px;
}

.intake-thread-messages {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
}

.intake-message {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.intake-message.user {
  background: rgba(192, 57, 43, 0.05);
  border-color: rgba(192, 57, 43, 0.18);
}

.intake-message.system {
  background: var(--bg-subtle);
}

.intake-message-role {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.intake-message-body {
  color: var(--text-primary);
  line-height: 1.7;
  word-break: break-word;
}

.intake-message-meta,
.intake-message-attachments {
  margin-top: 10px;
}

.intake-message-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
}

.intake-process-summary {
  margin-top: 14px;
}

.intake-process-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.intake-process-section-title {
  margin-bottom: 10px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.intake-process-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
}

.intake-process-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  padding: 12px 14px;
}

.intake-process-item-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.intake-process-item-body {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: 1.6;
  word-break: break-word;
}

.intake-process-code {
  font-family: var(--font-mono, 'Cascadia Code', monospace);
  font-size: 12px;
  background: rgba(15, 23, 42, 0.04);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.intake-inline-status {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
}

.intake-inline-status.tone-neutral {
  background: rgba(31, 41, 55, 0.04);
  border-color: rgba(31, 41, 55, 0.08);
  color: var(--text-secondary);
}

.intake-inline-status.tone-success {
  background: rgba(41, 104, 97, 0.08);
  border-color: rgba(41, 104, 97, 0.18);
  color: var(--secondary);
}

.intake-inline-status.tone-warning {
  background: rgba(213, 126, 40, 0.08);
  border-color: rgba(213, 126, 40, 0.18);
  color: var(--warning);
}

.empty-inline {
  padding: 16px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  text-align: center;
}

.intake-context-panel {
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
}

.intake-context-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.intake-context-title .material-symbols-outlined {
  font-size: 14px;
  vertical-align: -2px;
}

.intake-context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.intake-context-label {
  color: var(--text-muted);
}

.intake-context-value {
  margin-top: 2px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.intake-warning {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  background: rgba(186, 26, 26, 0.06);
}

.intake-warning .material-symbols-outlined {
  font-size: 13px;
  vertical-align: -2px;
  color: var(--danger);
}

.intake-warning strong {
  color: var(--danger);
}

.intake-context-meta {
  margin-top: 8px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.intake-guide-panel {
  padding: 14px 18px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.intake-guide-title {
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.intake-guide-list {
  margin: 0;
  padding-left: 16px;
  line-height: 1.8;
}

.intake-form-panel {
  padding: 20px 24px;
}

.intake-form-panel .panel-header {
  margin-bottom: var(--space-4);
  padding: 0;
  border: none;
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.panel-sub {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.intake-form {
  display: grid;
  gap: var(--space-4);
}

/* ── Intake Tab Bar ── */
.intake-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-4);
}
.intake-tab {
  padding: 8px 18px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.intake-tab:hover { color: var(--text-primary); }
.intake-tab.active {
  color: var(--c-brand);
  border-bottom-color: var(--c-brand);
}
.intake-tab-content { display: none; }
.intake-tab-content.active { display: block; }

/* ── Attachment Upload ── */
.attachment-upload-zone {
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: center;
}
.attachment-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.attachment-preview-item {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* ── AI Assist Panel ── */
.ai-assist-panel { margin-top: var(--space-3); }
.ai-assist-success {
  background: var(--bg-elevated);
  border: 1px solid var(--c-success-dim, #c3e6cb);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: var(--font-size-sm);
}
.ai-assist-error {
  background: #fff5f5;
  border: 1px solid var(--c-danger-dim, #f5c6cb);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: var(--font-size-sm);
  color: var(--c-danger);
}

/* ── Intake Chat-box ── */
.intake-chatbox {
  border: 1.5px solid var(--border-subtle, #e5e7eb);
  border-radius: var(--radius-lg, 10px);
  background: var(--bg-surface, #fff);
  transition: border-color 0.15s;
  overflow: hidden;
}
.intake-chatbox.focused,
.intake-chatbox:focus-within {
  border-color: var(--c-brand, #c0392b);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
}
.intake-chatbox-input {
  display: block;
  width: 100%;
  min-height: 88px;
  max-height: 320px;
  padding: 14px 16px 8px;
  font-size: var(--font-size-base, 14px);
  font-family: inherit;
  line-height: 1.6;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  box-sizing: border-box;
  overflow-y: auto;
}
.intake-chatbox-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 0;
  min-height: 0;
}
.intake-chatbox-attachments:empty { display: none; }
.intake-chatbox-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 6px;
  border-radius: var(--radius-md, 6px);
  background: var(--bg-elevated, #f9fafb);
  border: 1px solid var(--border-subtle, #e5e7eb);
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 220px;
}
.attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.intake-chatbox-attach-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}
.intake-chatbox-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 2px;
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.12s;
}
.intake-chatbox-remove-btn:hover { color: var(--c-danger, #e74c3c); }
.intake-chatbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 6px 8px;
  border-top: 1px solid var(--border-subtle, #e5e7eb);
  gap: 4px;
}
.intake-chatbox-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.chatbox-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md, 6px);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  transition: background 0.12s, color 0.12s;
  font-size: 14px;
}
.chatbox-tool-btn:hover {
  background: var(--bg-elevated, #f3f4f6);
  color: var(--text-primary);
}
.chatbox-tool-btn .material-symbols-outlined { font-size: 18px; }
.chatbox-tool-sep {
  width: 1px;
  height: 18px;
  background: var(--border-subtle, #e5e7eb);
  margin: 0 4px;
  flex-shrink: 0;
}
.chatbox-select {
  height: 28px;
  padding: 0 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  outline: none;
  transition: border-color 0.12s, background 0.12s;
  max-width: 100px;
}
.chatbox-select:hover, .chatbox-select:focus {
  background: var(--bg-elevated, #f3f4f6);
  border-color: var(--border-subtle, #e5e7eb);
}
.chatbox-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md, 8px);
  background: var(--c-brand, #c0392b);
  border: none;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.chatbox-submit-btn:hover { background: var(--c-brand-dark, #a93226); transform: scale(1.05); }
.chatbox-submit-btn .material-symbols-outlined { font-size: 18px; }
.intake-advanced-wrap {
  margin-top: var(--space-3);
}
.intake-advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  transition: color 0.12s;
}
.intake-advanced-toggle:hover { color: var(--text-primary); }
.intake-adv-arrow { font-size: 16px !important; transition: transform 0.15s; }
.intake-advanced-panel {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-elevated, #f9fafb);
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: var(--radius-md, 8px);
}

.intake-model-panel {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-elevated, #f9fafb);
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: var(--radius-md, 8px);
}

.intake-model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.intake-model-note {
  margin-top: 12px;
}

/* ── Task Library ── */
.task-library-list {
  display: grid;
  gap: var(--space-3);
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
}
.task-library-card {
  width: 100%;
  text-align: left;
  background: var(--bg-surface);
  padding: 12px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.task-library-card:hover {
  border-color: var(--c-brand);
  box-shadow: var(--shadow-elevated);
}
.task-library-card-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  margin-bottom: 4px;
}

.model-priority-chip {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  border-radius: var(--radius-sm, 4px);
  background: var(--neutral-100, #f3f4f6);
  border: 1px solid var(--border-subtle, #e5e7eb);
  font-size: var(--text-xs, 12px);
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
}

.module-card {
  display: block;
  text-decoration: none;
  cursor: pointer;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.module-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-elevated);
}

.module-card-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.module-card-main {
  flex: 1;
  min-width: 0;
}

.module-card-title {
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--text-primary);
  margin-bottom: 4px;
}

.module-card-desc {
  margin-top: 0;
}

.module-card-status {
  flex-shrink: 0;
}

.module-card-foot {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

@media (max-width: 1180px) {
  .intake-layout,
  .intake-layout.intake-layout-chat {
    grid-template-columns: 1fr;
  }

  .intake-process-columns,
  .intake-model-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .intake-form-panel,
  .intake-thread-sidebar,
  .intake-thread-panel,
  .intake-process-panel {
    padding: 16px;
  }

  .intake-thread-toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .intake-thread-group-select {
    flex-basis: auto;
  }

  .intake-thread-list,
  .intake-thread-messages,
  .intake-process-list {
    max-height: none;
  }

  .intake-chatbox-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .intake-chatbox-tools {
    width: 100%;
  }

  .chatbox-select {
    max-width: none;
  }

  .chatbox-submit-btn {
    align-self: flex-end;
  }
}

.module-card-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.module-card-metric-icon {
  font-size: var(--font-size-xs);
  vertical-align: -2px;
}

.module-card-risk {
  font-size: 11px;
}

.module-card-date {
  margin-left: auto;
  color: var(--text-muted);
}

.module-domain-section {
  margin-bottom: 28px;
}

.module-domain-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.module-domain-icon {
  font-size: 18px;
  color: var(--text-secondary);
}

.module-domain-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.module-domain-count {
  font-size: var(--font-size-xs);
}

.module-domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
}

.module-detail-hero {
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-5);
}

.module-detail-hero-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.module-detail-hero-main {
  flex: 1;
  min-width: 0;
}

.module-detail-hero-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.module-detail-hero-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.module-detail-hero-desc {
  margin-bottom: var(--space-2);
}

.module-detail-hero-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.module-detail-hero-tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.module-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.module-detail-panel {
  padding: var(--space-4) var(--space-5);
}

.module-detail-metrics-panel {
  margin-bottom: var(--space-4);
}

.module-detail-panel-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.module-detail-panel-title .material-symbols-outlined {
  font-size: 16px;
  vertical-align: -3px;
}

.module-detail-panel-line {
  margin-bottom: 4px;
}

.module-detail-metric-row {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.module-detail-metric-item {
  display: grid;
  gap: 2px;
}

.module-detail-metric-value {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.module-detail-timeline-item {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: flex-start;
}

.module-detail-timeline-badge {
  margin-top: 1px;
}

.module-detail-timeline-main {
  min-width: 0;
}

.module-detail-timeline-detail {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.module-detail-section {
  margin-bottom: var(--space-4);
}

.module-detail-empty {
  padding: 12px 16px;
  color: var(--text-muted);
}

.module-detail-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.artifact-empty-panel {
  padding: var(--space-4);
  color: var(--text-muted);
}

.artifact-table-wrapper {
  padding: 0;
  overflow: auto;
}

.artifact-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1040px;
}

.artifact-table-head {
  text-align: left;
  background: var(--bg-subtle);
}

.artifact-th {
  padding: 10px 12px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.artifact-cell {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.artifact-title {
  font-weight: 600;
}

.artifact-cell-nowrap {
  white-space: nowrap;
}

.artifact-source-cell {
  max-width: 360px;
}

.artifact-report-ref {
  margin-top: 2px;
}

.artifact-empty-row {
  padding: var(--space-4);
  color: var(--text-muted);
}

.decision-row-card {
  padding: 12px 16px;
  margin-bottom: var(--space-2);
  border-left: 3px solid var(--border);
}

.decision-row-blocked {
  border-left-color: var(--danger);
}

.decision-row-risk {
  border-left-color: var(--warning);
}

.decision-row-approval,
.decision-row-decision {
  border-left-color: var(--primary);
}

.decision-row-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 4px;
}

.decision-row-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.decision-row-severity {
  margin-left: auto;
  font-size: 11px;
}

.decision-row-meta {
  margin-top: 2px;
}

.decision-row-next {
  margin-top: 4px;
  color: var(--text-primary);
}

.decision-row-next-source {
  margin-left: 6px;
}

/* 时间线 */
.timeline {
  position: relative;
  padding-left: var(--space-6);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-4);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
}

.timeline-item.active::before {
  border-color: var(--primary);
  background: var(--primary);
}

.timeline-item.success::before {
  border-color: var(--success);
  background: var(--success);
}

.timeline-content {
  font-size: 14px;
}

.timeline-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.timeline-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.timeline-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  color: var(--text-muted);
}

.empty-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-light);
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* 网格布局 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

/* 分栏布局 */
.split-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
}

/* 工具类 */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ========================================
   5. 渲染层兼容与 P1 精修增强
   ======================================== */

.button-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 var(--space-3);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.button-primary {
  background: var(--primary);
  color: var(--text-on-primary);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.button-secondary:hover {
  background: var(--bg-hover);
}

.button-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.button-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin: var(--space-4) 0 var(--space-6);
}

.metric-card {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.metric-card .eyebrow {
  font-size: 12px;
  color: var(--text-muted);
}

.metric-card strong {
  font-size: 24px;
  line-height: 1.2;
}

.metric-card span:last-child {
  color: var(--text-muted);
  font-size: 12px;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.factory-live-status {
  margin: 0 0 var(--space-4);
}

.factory-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.factory-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.factory-nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.factory-nav-link.active {
  border-color: rgba(37, 99, 235, 0.18);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.04));
  color: var(--primary);
}

.factory-header-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.factory-header-block h2 {
  font-size: 22px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.factory-header-block p {
  color: var(--text-secondary);
  font-size: 13px;
  max-width: 720px;
}

.factory-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.factory-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.factory-summary-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.factory-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
  display: grid;
  gap: var(--space-1);
  position: relative;
  overflow: hidden;
}

.factory-summary-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: transparent;
}

.factory-summary-card.tone-brand::before {
  background: var(--primary);
}

.factory-summary-card.tone-success::before {
  background: var(--success);
}

.factory-summary-card.tone-warning::before {
  background: var(--warning);
}

.factory-summary-card.tone-danger::before {
  background: var(--danger);
}

.factory-summary-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.factory-summary-card strong {
  font-size: 24px;
  line-height: 1.2;
  color: var(--text-primary);
}

.factory-summary-card span:last-child {
  font-size: 12px;
  color: var(--text-secondary);
}

.factory-action-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-4);
}

.factory-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-3);
}

.factory-danger-note {
  margin: 0 var(--space-4) var(--space-2);
  padding: 10px 12px;
  background: rgba(245, 158, 11, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
}

.factory-action-status {
  margin: 0;
  padding: 0 var(--space-4) var(--space-4);
  color: var(--text-muted);
  font-size: 12px;
}

.factory-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 0.9fr);
  gap: var(--space-4);
  align-items: start;
}

.factory-primary-column,
.factory-rail-column {
  display: grid;
  gap: var(--space-4);
}

.factory-section-block {
  margin-bottom: 0;
}

.factory-rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.factory-rail-body {
  padding: var(--space-4);
}

.factory-list {
  display: grid;
  gap: var(--space-3);
}

.factory-list-item {
  display: grid;
  gap: 2px;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.factory-list-item strong {
  font-size: 13px;
  color: var(--text-primary);
}

.factory-list-item span {
  font-size: 12px;
  color: var(--text-secondary);
}

.factory-list-item.interactive:hover {
  background: rgba(37, 99, 235, 0.06);
}

.factory-empty {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-size: 12px;
  color: var(--text-muted);
}

.factory-sticky-filters {
  margin-bottom: var(--space-4);
}

.factory-lane-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
}

.factory-lane-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-3);
  display: grid;
  gap: var(--space-3);
}

.factory-lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.factory-lane-head strong {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.factory-lane-head span {
  font-size: 12px;
  color: var(--text-muted);
}

.factory-lane-card.lane-blocked {
  border-color: rgba(239, 68, 68, 0.28);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.06), var(--surface));
}

.factory-lane-card.lane-deadletter {
  border-color: rgba(245, 158, 11, 0.24);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), var(--surface));
}

.factory-lane-card.lane-doing {
  border-color: rgba(37, 99, 235, 0.2);
}

.stack {
  display: grid;
  gap: var(--space-4);
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #cfd5d8 transparent;
}

.table-scroll-ops {
  overflow-x: auto;
}

.table-card table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-muted);
  box-shadow: inset 0 -1px 0 rgba(140, 113, 105, 0.12);
}

.table-card table tbody tr:nth-child(even) td {
  background: rgba(148, 163, 184, 0.04);
}

.table-card table tbody tr:hover td {
  background: rgba(37, 99, 235, 0.05);
}

.table-card table tbody tr {
  transition: background var(--transition-fast);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.section-heading h3 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-tight);
}

.section-heading p {
  margin-top: 2px;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.detail-grid,
.key-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
}

.key-stat {
  display: grid;
  gap: 4px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.key-stat span {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.key-stat strong {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

.detail-text {
  padding: var(--space-4);
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

.sticky-actions {
  position: sticky;
  top: var(--topbar-height);
  z-index: 3;
  background: var(--surface);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4);
}

.toolbar label {
  display: grid;
  gap: var(--space-1);
  min-width: 140px;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.toolbar select,
.toolbar input {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--surface);
}

.toolbar-actions {
  display: flex;
  align-items: end;
}

.table-ops-meta {
  margin: 0 var(--space-4) var(--space-4);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  border-top: 1px dashed var(--border-light);
  padding-top: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.list {
  display: grid;
}

.list-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

.inline-link {
  color: var(--primary);
  font-weight: 600;
  text-underline-offset: 2px;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

.inline-link:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

.inline-link:focus-visible {
  outline: 2px solid rgba(168, 56, 7, 0.24);
  outline-offset: 2px;
  border-radius: 2px;
}

.notice {
  margin: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  padding: var(--space-3);
  color: var(--text-secondary);
  font-size: 13px;
}

.badge.tone-brand {
  background: var(--info-bg);
  color: var(--info);
}

.badge.tone-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge.tone-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge.tone-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge.tone-gold {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge.tone-pine {
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent-teal);
}

.badge.tone-neutral {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.tone-success { color: var(--success); }
.tone-warning { color: var(--warning); }
.tone-danger { color: var(--danger); }
.tone-neutral { color: var(--text-secondary); }

.factory-summary-card,
.factory-rail-card,
.table-card,
.panel {
  animation: fadeSlideIn 220ms ease both;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.truncate-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

.cell-id {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--primary);
  white-space: nowrap;
}

.cell-sub-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.cell-time {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--text-secondary);
  white-space: nowrap;
}

.cell-metric {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.profile-list .list-item {
  min-height: 48px;
}

.profile-list .list-item strong {
  min-width: 116px;
}

.row-high-risk {
  background: rgba(239, 68, 68, 0.05);
}

.row-high-risk td:first-child {
  border-left: 4px solid var(--danger);
}

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

.deadline-warning {
  color: var(--warning);
  font-weight: 600;
}

.deadline-normal {
  color: var(--text-secondary);
}

.queue-meta {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  flex-wrap: wrap;
}

.queue-filter-row {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-3);
}

.filter-chip {
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.filter-chip.active {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

.queue-subrow td {
  padding-top: 0;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-muted);
}

.wait-time {
  font-weight: 500;
}

.wait-time-alert {
  color: var(--warning);
}

.approval-meta {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  flex-wrap: wrap;
}

.util-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.util-bar {
  width: 60px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--border-light);
  overflow: hidden;
}

.util-bar > span {
  display: block;
  height: 100%;
}

.util-high > span {
  background: var(--danger);
}

.util-mid > span {
  background: var(--warning);
}

.util-low > span {
  background: var(--success);
}

.trend-up {
  color: var(--success);
  font-weight: 600;
}

.trend-down {
  color: var(--warning);
  font-weight: 600;
}

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

.row-attention {
  background: rgba(245, 158, 11, 0.08);
}

@media (max-width: 1024px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    position: sticky;
    width: 100%;
    top: 0;
    bottom: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    padding: var(--space-3) var(--space-4);
  }

  .nav-section {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 0;
  }

  .nav-section-title {
    margin-bottom: 0;
    white-space: nowrap;
  }

  .nav-item {
    margin-bottom: 0;
    white-space: nowrap;
    border: 1px solid transparent;
  }

  .nav-item.active {
    border-color: rgba(239, 107, 58, 0.38);
  }

  .sidebar-foot {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid,
  .key-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .factory-summary-grid,
  .factory-summary-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .factory-main-grid {
    grid-template-columns: 1fr;
  }

  .factory-lane-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intake-layout {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .module-detail-grid {
    grid-template-columns: 1fr;
  }

  .module-detail-hero-row {
    flex-direction: column;
  }

  .decision-item-head {
    flex-direction: column;
  }

  .decision-item-date {
    white-space: normal;
  }
}

@media (max-width: 768px) {
  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
  }

  .topbar-left,
  .topbar-right {
    width: 100%;
  }

  .topbar-nav {
    gap: 12px;
    overflow-x: auto;
    white-space: nowrap;
    width: 100%;
  }

  .topbar-search {
    flex: 1;
    width: auto;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .topbar-actions .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }

  .page-content {
    padding: var(--space-4);
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid,
  .key-grid {
    grid-template-columns: 1fr;
    padding: var(--space-3);
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    align-items: stretch;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .field-actions .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }

  .decision-action-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .decision-action-select,
  .decision-action-input {
    min-width: 0;
  }

  .intake-context-grid {
    grid-template-columns: 1fr;
  }

  .queue-meta,
  .approval-meta {
    gap: var(--space-2);
  }

  .sticky-actions {
    top: 0;
  }

  .truncate-cell {
    max-width: 200px;
  }

  .factory-header-block {
    flex-direction: column;
  }

  .factory-header-meta {
    justify-content: flex-start;
  }

  .factory-summary-grid,
  .factory-summary-grid-compact,
  .factory-lane-grid {
    grid-template-columns: 1fr;
  }

  .factory-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .factory-nav-link {
    white-space: nowrap;
  }

  .factory-action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .module-detail-hero {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }

  .module-detail-panel {
    padding: var(--space-4);
  }

  .module-detail-metric-row {
    gap: var(--space-3);
  }

  .module-detail-actions .btn {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }

  .decision-actions-dense .btn,
  .decision-actions .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }

  .fold-panel {
    border-radius: var(--radius-sm);
  }

  .fold-panel[open] .fold-summary {
    color: var(--text-primary);
  }

  .fold-summary {
    padding: 10px var(--space-3);
    font-size: 12px;
  }

  .module-detail-metric-item {
    width: 100%;
  }
}

/* ========================================
   Bento Grid 仪表盘布局（12 列）
   ======================================== */

/* 状态条 */
.status-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px var(--space-4);
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-pill-success { background: var(--success-bg); color: var(--secondary); }
.status-pill-warning { background: var(--warning-bg); color: var(--primary); }
.status-pill-error   { background: var(--danger-bg);  color: var(--error); }
.status-pill-info    { background: rgba(0,90,194,0.08); color: var(--tertiary); }
.status-pill-neutral { background: var(--surface-container); color: var(--text-muted); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}

.pulse-bars {
  margin-left: auto;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.pulse-bar {
  width: 4px;
  background: var(--secondary-container);
  border-radius: 2px;
  animation: pulse-height 1.2s ease-in-out infinite alternate;
}

.pulse-bar:nth-child(1) { height: 8px;  animation-delay: 0s; }
.pulse-bar:nth-child(2) { height: 14px; animation-delay: 0.15s; }
.pulse-bar:nth-child(3) { height: 10px; animation-delay: 0.30s; }
.pulse-bar:nth-child(4) { height: 18px; animation-delay: 0.45s; }
.pulse-bar:nth-child(5) { height: 12px; animation-delay: 0.60s; }
.pulse-bar:nth-child(6) { height: 16px; animation-delay: 0.75s; }

@keyframes pulse-height {
  from { opacity: 0.4; transform: scaleY(0.7); }
  to   { opacity: 1;   transform: scaleY(1); }
}

/* bento 网格容器 */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-6  { grid-column: span 6; }
.col-8  { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* Phase 阶段卡片 */
.phase-card {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-left-width: 4px !important;
  border-left-style: solid !important;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base), transform var(--transition-fast);
}

.phase-card:hover { box-shadow: var(--shadow-elevated); transform: translateY(-1px); }

.phase-card-plan    { border-left-color: var(--tertiary) !important; }
.phase-card-exec    { border-left-color: var(--primary) !important; }
.phase-card-verify  { border-left-color: var(--secondary) !important; }
.phase-card-deliver { border-left-color: var(--outline) !important; }

.phase-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.phase-icon .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'wght' 400, 'FILL' 1;
}

.phase-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.phase-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.phase-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* 控制器状态卡 */
.controller-card {
  background: var(--surface-container-highest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}

.controller-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.controller-status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--outline-variant);
}

.controller-status-item:last-child { border-bottom: none; }

.controller-status-label { color: var(--text-secondary); }
.controller-status-val   { font-weight: 600; color: var(--text-primary); }

/* 队列面板 */
.queue-panel {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.queue-panel-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.queue-bucket {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  font-size: 13px;
  background: var(--surface-container-low);
}

.queue-bucket-label { color: var(--text-secondary); font-weight: 500; }
.queue-bucket-count { font-size: 18px; font-weight: 800; color: var(--text-primary); }

/* 门禁决策表格 */
.gate-panel {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gate-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--space-4);
  border-bottom: 1px solid var(--outline-variant);
}

.gate-panel-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.gate-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.gate-table th {
  text-align: left;
  padding: 9px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--outline-variant);
}

.gate-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--outline-variant);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.gate-table tr:last-child td { border-bottom: none; }
.gate-table tr:hover td { background: rgba(176,239,229,0.15); }

.factory-log-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.factory-log-table th,
.factory-log-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--outline-variant);
  font-size: 13px;
  color: var(--text-secondary);
  vertical-align: middle;
  white-space: nowrap;
}

.factory-log-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.factory-log-table tr:last-child td {
  border-bottom: none;
}

.factory-log-table tr:hover td {
  background: rgba(176, 239, 229, 0.13);
}

.factory-log-table tr.row-clickable {
  cursor: pointer;
}

.factory-log-table tr.row-clickable:focus-visible td {
  background: rgba(168, 56, 7, 0.08);
  outline: 1px solid rgba(168, 56, 7, 0.22);
  outline-offset: -1px;
}

.factory-log-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--surface);
  box-shadow: inset -1px 0 0 var(--outline-variant);
}

.factory-log-table thead .sticky-col {
  background: var(--surface-muted);
}

.factory-log-table tbody tr:hover .sticky-col {
  background: rgba(176, 239, 229, 0.13);
}

.factory-log-table .col-scope {
  width: 230px;
  min-width: 230px;
}

.factory-log-table .col-file {
  width: 260px;
  min-width: 260px;
}

.factory-log-table .col-time {
  width: 190px;
  min-width: 190px;
}

.factory-log-table .col-category {
  width: 96px;
  min-width: 96px;
}

.factory-log-table .col-action {
  width: 80px;
  min-width: 80px;
  text-align: right;
}

.factory-log-table .scope-ellipsis {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.sort-indicator {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-placeholder);
}

/* 事件时间线面板 */
.event-panel {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.event-panel-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.event-item {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--outline-variant);
  align-items: flex-start;
}

.event-item:last-child { border-bottom: none; }

.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.event-dot-success { background: var(--secondary); }
.event-dot-warn    { background: var(--primary-container); }
.event-dot-info    { background: var(--tertiary); }
.event-dot-neutral { background: var(--outline); }

.event-content { flex: 1; min-width: 0; }
.event-msg { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.event-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* 指标卡片组 */
.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.metric-card {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-card);
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.metric-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* 报告入口卡片排 */
.report-row {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.report-chip {
  flex: 1;
  padding: 10px var(--space-3);
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.report-chip:hover { background: var(--bg-hover); color: var(--secondary); }

.report-chip .material-symbols-outlined { font-size: 16px; }

/* WeCom 面板 */
.wecom-panel {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wecom-panel-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.wecom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
}

.wecom-label { color: var(--text-secondary); }
.wecom-val   { font-weight: 600; color: var(--text-primary); }

/* ========================================
   Session Events (D1)
   ======================================== */
.session-event-tool_call  { border-left: 3px solid #2196f3; }
.session-event-tool_result { border-left: 3px solid #4caf50; }
.session-event-model_reply { border-left: 3px solid #9c27b0; }
.session-event-error       { border-left: 3px solid #f44336; }
.session-event-prompt_sent { border-left: 3px solid #9e9e9e; }
.session-event-finish         { border-left: 3px solid #ff9800; }
.session-event-loop_complete  { border-left: 3px solid #ff9800; }
.session-event-unknown        { border-left: 3px solid #9e9e9e; }
.session-event-content {
  margin: 4px 0 0;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  background: var(--surface-variant);
  border-radius: var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ========================================
   Docs Browser (D2)
   ======================================== */
.doc-layout {
  display: flex;
  gap: var(--space-4);
  min-height: 600px;
}
.doc-tree-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  overflow-y: auto;
  max-height: 80vh;
}
.doc-tree-search input {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.doc-tree-dir-label {
  cursor: pointer;
  padding: 3px 0;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}
.doc-tree-dir-label:hover { color: var(--text-primary); }
.doc-tree-arrow { display: inline-block; transition: transform .15s; font-size: 10px; }
.doc-tree-dir.collapsed .doc-tree-arrow { transform: rotate(-90deg); }
.doc-tree-dir.collapsed .doc-tree-children { display: none; }
.doc-tree-children { padding-left: 14px; }
.doc-tree-file {
  display: block;
  padding: 3px 0;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-tree-file:hover { color: var(--brand-primary); }
.doc-content-panel {
  flex: 1;
  min-width: 0;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow-y: auto;
  max-height: 80vh;
}
.doc-content-path {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
}
.doc-content-placeholder {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: var(--space-8) 0;
}
.doc-content-error {
  color: var(--danger);
  font-size: 14px;
  text-align: center;
  padding: var(--space-8) 0;
}
.doc-content-md { font-size: 14px; line-height: 1.7; color: var(--text-primary); }
.doc-content-md h2 { font-size: 20px; margin: 1.2em 0 0.5em; border-bottom: 1px solid var(--border-color); padding-bottom: 4px; }
.doc-content-md h3 { font-size: 17px; margin: 1em 0 0.4em; }
.doc-content-md h4 { font-size: 15px; margin: 0.8em 0 0.3em; }
.doc-content-md pre { background: var(--surface-variant); padding: 12px; border-radius: var(--radius-md); overflow-x: auto; font-size: 12px; }
.doc-content-md code { background: var(--surface-variant); padding: 1px 4px; border-radius: 3px; font-size: 0.9em; }
.doc-content-md pre code { background: none; padding: 0; }
.doc-content-md ul { padding-left: 1.4em; margin: 0.5em 0; }
.doc-content-md li { margin: 0.2em 0; }
.doc-content-md a { color: var(--brand-primary); text-decoration: underline; }
.doc-content-raw {
  font-size: 12px;
  line-height: 1.5;
  background: var(--surface-variant);
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ========================================
   Code Assets Browser
   ======================================== */
.code-layout {
  display: flex;
  gap: var(--space-4);
  min-height: 600px;
}
.code-tree-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  overflow-y: auto;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.code-tree-search {
  display: flex;
  gap: 6px;
  margin-bottom: var(--space-2);
}
.code-tree-search input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text-primary);
}
.code-tree-search select {
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--text-primary);
}
.code-tree-container {
  flex: 1;
  overflow-y: auto;
}
.code-tree-dir-label {
  cursor: pointer;
  padding: 3px 0;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.code-tree-dir-label:hover { color: var(--text-primary); }
.code-tree-arrow { display: inline-block; transition: transform .15s; font-size: 10px; }
.code-tree-dir.collapsed .code-tree-arrow { transform: rotate(-90deg); }
.code-tree-dir.collapsed .code-tree-children { display: none; }
.code-tree-children { padding-left: 14px; }
.code-tree-icon { font-size: 16px; vertical-align: middle; margin-right: 2px; }
.code-tree-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
  font-weight: 400;
}
.code-tree-file {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: var(--radius-sm);
}
.code-tree-file:hover { background: var(--surface-variant); color: var(--brand-primary); }
.code-tree-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}
.code-content-panel {
  flex: 1;
  min-width: 0;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow-y: auto;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.code-content-path {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
}
.code-content-placeholder {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: var(--space-8) 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
.code-content-error {
  color: var(--danger);
  font-size: 14px;
  text-align: center;
  padding: var(--space-8) 0;
}
.code-file-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 12px;
  background: var(--surface-variant);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  font-size: 13px;
}
.code-file-stat {
  color: var(--text-muted);
  font-size: 12px;
}
.code-viewer {
  flex: 1;
  margin: 0;
  padding: 12px 0;
  background: var(--surface-variant);
  border-radius: var(--radius-md);
  overflow: auto;
  font-size: 12px;
  line-height: 1.6;
}
.code-viewer code {
  display: block;
  font-family: var(--font-mono);
  counter-reset: line;
}
.code-line {
  display: block;
  padding: 0 12px 0 0;
}
.code-line:hover { background: rgba(255,255,255,0.04); }
.code-line-num {
  display: inline-block;
  width: 48px;
  text-align: right;
  padding-right: 12px;
  margin-right: 12px;
  color: var(--text-muted);
  border-right: 1px solid var(--border-color);
  user-select: none;
  font-size: 11px;
}
.code-line-text { white-space: pre-wrap; word-break: break-all; }

/* Language badges */
.badge.lang-ts { background: #3178c6; color: #fff; }
.badge.lang-js { background: #f7df1e; color: #333; }
.badge.lang-json { background: #5b5ea6; color: #fff; }
.badge.lang-yaml { background: #cb171e; color: #fff; }
.badge.lang-md { background: #555; color: #fff; }
.badge.lang-ps1 { background: #012456; color: #fff; }
.badge.lang-sh { background: #4eaa25; color: #fff; }
.badge.lang-css { background: #264de4; color: #fff; }
.badge.lang-html { background: #e34c26; color: #fff; }
.badge.lang-sql { background: #e38d13; color: #fff; }
.badge.lang-plain { background: var(--surface-variant); color: var(--text-secondary); }

.btn-ghost { background: none; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 4px 10px; color: var(--text-secondary); cursor: pointer; font-size: 12px; }
.btn-ghost:hover { background: var(--surface-variant); color: var(--text-primary); }

.wecom-member-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--outline-variant);
}

.wecom-member-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
  font-size: 11px;
  font-weight: 600;
}

.wecom-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.wecom-online { opacity: 1; }
.wecom-offline { opacity: 0.5; }

.wecom-member-add {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px dashed var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  align-self: center;
}

/* 安全动作面板 */
.safe-actions-panel {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}

.safe-actions-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.safe-action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  border: 1px solid var(--outline-variant);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  background: var(--surface-container-low);
}

.safe-action-item:hover { background: var(--bg-hover); border-color: var(--secondary); }

.safe-action-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.safe-action-icon .material-symbols-outlined { font-size: 16px; font-variation-settings: 'wght' 400, 'FILL' 1; }

.safe-action-text { flex: 1; min-width: 0; }
.safe-action-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.safe-action-desc  { font-size: 11px; color: var(--text-muted); }

.safe-danger-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(186, 26, 26, 0.12);
}

.safe-btn-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 8px;
  background: var(--error);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity var(--transition-fast);
  white-space: nowrap;
}

.safe-btn-danger:hover { opacity: 0.88; }

.safe-btn-outline-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 8px;
  background: transparent;
  color: var(--error);
  border: 1.5px solid var(--error);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.safe-btn-outline-danger:hover { background: rgba(186, 26, 26, 0.05); }

/* 浮动 FAB */
.fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--secondary);
  color: var(--on-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(41, 104, 97, 0.40);
  cursor: pointer;
  z-index: 30;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  border: none;
}

.fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(41, 104, 97, 0.50); background: #1d5149; }

/* ========================================
   精修增量 — 新增组件样式
   ======================================== */

/* 顶部栏面包屑（替换原 tab 导航）*/
.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-brand {
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-decoration: none;
}

.topbar-crumb-sep {
  display: flex;
  align-items: center;
  color: var(--text-placeholder);
}

.topbar-crumb {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* 页面操作栏（非工厂页面使用，替代 Safe Actions 栏）*/
.page-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: 10px var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.page-danger-note {
  background: rgba(186, 26, 26, 0.06);
  border: 1px solid rgba(186, 26, 26, 0.18);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--danger);
  width: 100%;
  margin-bottom: 4px;
}

/* 表单网格（任务创建页等）*/
.form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-4);
  padding: var(--space-4);
}

.form-grid .form-full {
  grid-column: 1 / -1;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
  letter-spacing: 0.02em;
}

.form-input,
.form-select {
  width: 100%;
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(168, 56, 7, 0.10);
}

.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(168, 56, 7, 0.10);
}

/* 偏好设置列表（设置页专用）*/
.pref-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pref-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.pref-item:last-child {
  border-bottom: none;
}

.pref-item:hover {
  background: var(--surface-muted);
}

.pref-label {
  width: 100px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.pref-value {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.pref-action-hint {
  font-size: 12px;
  color: var(--text-placeholder);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.pref-action-hint:hover {
  color: var(--primary);
}

/* row-clickable 附加悬停色优化 */
.table tr.row-clickable:hover td {
  background: rgba(176, 239, 229, 0.30);
  cursor: pointer;
}

.table tr.row-clickable:focus-visible td {
  background: rgba(168, 56, 7, 0.06);
  outline: 1px solid rgba(168, 56, 7, 0.22);
  outline-offset: -1px;
}

/* 移除旧 topbar-nav（已由面包屑替代）*/
.topbar-nav { display: none; }

/* 段落标题层级优化 */
.section-heading h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

/* factory-header-block h2 更有视觉重量 */
.factory-header-block h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* KPI / 汇总卡片数字优化 */
.factory-summary-card strong {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* table th 更清晰 */
.table th {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* factory-log-table th 一致 */
.factory-log-table th {
  text-transform: uppercase;
}

/* FAB 在移动端隐藏时不占空间 */
@media (max-width: 768px) {
  .fab { right: 16px; bottom: 16px; width: 44px; height: 44px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-actions-bar { gap: var(--space-2); }
}

/* ═══════════════════════════════════════════════════════════════════
   驾驶舱 V3 — 六区块信息架构专用样式
   ═══════════════════════════════════════════════════════════════════ */

/* ── A. 项目叙事条 ── */
.cockpit-narrative {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.cockpit-narrative-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.cockpit-narrative-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--text-primary); flex-wrap: wrap; }
.cockpit-narrative-icon { font-size: 20px; color: var(--primary); }
.cockpit-narrative-divider { color: var(--text-muted); font-weight: 300; }
.cockpit-narrative-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.cockpit-narrative-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cockpit-narrative-goal { font-size: 12px; color: var(--text-muted); max-width: 200px; text-align: right; }

/* ── 今日焦点 ── */
.cockpit-focus { margin-bottom: 16px; }
.cockpit-focus-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--error); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.cockpit-focus-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.cockpit-focus-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  text-decoration: none; color: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
.cockpit-focus-card:hover { border-color: var(--primary); box-shadow: var(--shadow-card); }
.cockpit-focus-critical { border-left: 3px solid var(--error); }
.cockpit-focus-high { border-left: 3px solid var(--warning); }
.cockpit-focus-normal { border-left: 3px solid var(--tertiary); }
.cockpit-focus-icon { font-size: 20px; flex-shrink: 0; }
.cockpit-focus-critical .cockpit-focus-icon { color: var(--error); }
.cockpit-focus-high .cockpit-focus-icon { color: var(--warning); }
.cockpit-focus-normal .cockpit-focus-icon { color: var(--tertiary); }
.cockpit-focus-text { flex: 1; min-width: 0; }
.cockpit-focus-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.cockpit-focus-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 通用区块标题 ── */
.cockpit-section-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.cockpit-section-head > .material-symbols-outlined { font-size: 18px; color: var(--tertiary); }
.cockpit-section-head h3 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin: 0; }
.cockpit-section-meta { font-size: 12px; color: var(--text-muted); margin-left: 4px; }
.cockpit-section-link { font-size: 12px; margin-left: auto; white-space: nowrap; }

/* ── B. 目标与里程碑 ── */
.cockpit-goals { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px; }
.cockpit-goals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cockpit-goal-card { background: var(--surface-container-low); border-radius: var(--radius-md); padding: 14px 16px; }
.cockpit-goal-horizon { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.cockpit-goal-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 10px; line-height: 1.45; }
.cockpit-goal-bar-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.cockpit-goal-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.cockpit-goal-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.cockpit-goal-next { font-size: 11px; color: var(--text-muted); }

/* ── C. 多视图计划区 ── */
.cockpit-plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px; }
.cockpit-plan-tabs { display: flex; gap: 2px; margin-left: auto; background: var(--surface-container-low); border-radius: var(--radius-sm); padding: 2px; }
.cockpit-plan-tab { font-size: 12px; padding: 4px 12px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-muted); user-select: none; }
.cockpit-plan-tab.active { background: var(--surface); color: var(--text-primary); font-weight: 600; box-shadow: var(--shadow-sm); }
.cockpit-plan-tab.disabled { opacity: 0.4; cursor: default; }

.cockpit-kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 4px; }
.cockpit-kanban-col { min-width: 0; }
.cockpit-kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 12px; font-weight: 600; }
.cockpit-kanban-todo { background: var(--surface-container-low); color: var(--text-secondary); }
.cockpit-kanban-doing { background: rgba(0, 90, 194, 0.08); color: var(--tertiary); }
.cockpit-kanban-blocked { background: rgba(186, 26, 26, 0.08); color: var(--error); }
.cockpit-kanban-done { background: rgba(41, 104, 97, 0.08); color: var(--secondary); }
.cockpit-kanban-count { font-size: 11px; opacity: 0.7; }

.cockpit-plan-card {
  background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  padding: 8px 10px; margin-bottom: 6px;
}
.cockpit-plan-card-head { display: flex; gap: 4px; margin-bottom: 4px; }
.cockpit-plan-card-title { font-size: 12px; font-weight: 500; color: var(--text-primary); line-height: 1.4; }
.cockpit-plan-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── View switching ── */
.cockpit-view { display: none; }
.cockpit-view-active { display: block; }

/* ── 列表视图 ── */
.cockpit-list { overflow-x: auto; margin-top: 4px; }
.cockpit-list-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cockpit-list-table thead th { text-align: left; font-weight: 600; font-size: 11px; color: var(--text-muted); padding: 8px 10px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.cockpit-list-table tbody tr { border-bottom: 1px solid var(--border-light); transition: background 0.15s; }
.cockpit-list-table tbody tr:hover { background: var(--surface-container-low); }
.cockpit-list-table td { padding: 8px 10px; vertical-align: middle; }
.cockpit-list-title { font-weight: 500; color: var(--text-primary); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cockpit-list-module { color: var(--text-secondary); font-size: 11px; }
.cockpit-list-assignee { color: var(--text-secondary); font-size: 11px; }
.cockpit-list-date { color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ── 甘特视图 ── */
.cockpit-gantt { margin-top: 4px; overflow-x: auto; }
.cockpit-gantt-header { display: flex; border-bottom: 2px solid var(--border); padding-bottom: 4px; }
.cockpit-gantt-label-header { width: 180px; min-width: 180px; font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 4px 8px; }
.cockpit-gantt-timeline-header { flex: 1; display: flex; }
.cockpit-gantt-day { flex: 1; text-align: center; font-size: 10px; color: var(--text-muted); padding: 4px 0; }
.cockpit-gantt-body { position: relative; }
.cockpit-gantt-row { display: flex; align-items: center; border-bottom: 1px solid var(--border-light); min-height: 32px; }
.cockpit-gantt-label { width: 180px; min-width: 180px; padding: 4px 8px; display: flex; align-items: center; gap: 6px; }
.cockpit-gantt-title { font-size: 11px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.cockpit-gantt-track { flex: 1; position: relative; height: 20px; }
.cockpit-gantt-bar { position: absolute; top: 3px; height: 14px; border-radius: 3px; opacity: 0.85; min-width: 6px; }
.cockpit-gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--primary); opacity: 0.6; z-index: 1; pointer-events: none; }

/* ── 日历视图 ── */
.cockpit-calendar { margin-top: 4px; }
.cockpit-cal-month { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.cockpit-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border-light); border: 1px solid var(--border-light); border-radius: var(--radius-sm); overflow: hidden; }
.cockpit-cal-weekday { background: var(--surface-container-low); text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 6px 0; }
.cockpit-cal-cell { background: var(--surface); min-height: 72px; padding: 4px 6px; }
.cockpit-cal-empty { background: var(--surface-container-low); }
.cockpit-cal-today { background: rgba(168, 56, 7, 0.04); }
.cockpit-cal-today .cockpit-cal-day { color: var(--primary); font-weight: 700; }
.cockpit-cal-day { font-size: 11px; font-weight: 500; color: var(--text-secondary); margin-bottom: 2px; }
.cockpit-cal-event { font-size: 10px; padding: 2px 4px; border-radius: 2px; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4; }
.cockpit-cal-event-danger { background: rgba(186, 26, 26, 0.1); color: var(--error); }
.cockpit-cal-event-info { background: rgba(0, 90, 194, 0.1); color: var(--tertiary); }
.cockpit-cal-event-success { background: rgba(41, 104, 97, 0.1); color: var(--secondary); }
.cockpit-cal-event-neutral { background: var(--surface-container-low); color: var(--text-muted); }
.cockpit-cal-more { font-size: 10px; color: var(--text-muted); padding: 1px 4px; }

/* ── D. 工厂脉搏 ── */
.cockpit-pulse { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px; }
.cockpit-pulse-live { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.cockpit-pulse-live-text { font-size: 12px; color: var(--text-muted); }
.cockpit-pulse-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cockpit-pulse-card { background: var(--surface-container-low); border-radius: var(--radius-md); padding: 12px 14px; }
.cockpit-pulse-role { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; border-bottom: 1px solid var(--border-light); padding-bottom: 8px; }
.cockpit-pulse-role .material-symbols-outlined { font-size: 16px; color: var(--tertiary); }
.cockpit-pulse-line { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--text-secondary); padding: 3px 0; }
.cockpit-pulse-line strong { font-size: 11px; color: var(--text-muted); min-width: 64px; flex-shrink: 0; }
.cockpit-pulse-empty { font-size: 12px; color: var(--text-muted); padding: 8px 0; }

/* ── 功能架构全局快照 ── */
.cockpit-archmap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px; }
.cockpit-archmap-summary { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border-light); }
.cockpit-archmap-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cockpit-archmap-stat strong { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.cockpit-archmap-stat span { font-size: 11px; color: var(--text-muted); }
.cockpit-archmap-active strong { color: var(--tertiary); }
.cockpit-archmap-done strong { color: var(--secondary); }
.cockpit-archmap-blocked strong { color: var(--error); }
.cockpit-archmap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.cockpit-archmap-chip {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px;
  background: var(--surface-container-low); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  text-decoration: none; color: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
.cockpit-archmap-chip:hover { border-color: var(--tertiary); box-shadow: var(--shadow-card); }
.cockpit-archmap-chip-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.cockpit-archmap-chip-badge { font-size: 10px; align-self: flex-start; }
.cockpit-archmap-chip-blocked { font-size: 10px; color: var(--error); font-weight: 500; }

/* ── E. 风险与待决策 ── */
.cockpit-decisions { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px; }
.cockpit-decision-list { display: grid; gap: 10px; }
.cockpit-decision-card { background: var(--surface-container-low); border-radius: var(--radius-md); padding: 12px 14px; border-left: 3px solid var(--border); }
.cockpit-decision-card:has(.badge-danger:first-child) { border-left-color: var(--error); }
.cockpit-decision-card:has(.badge-warning:first-child) { border-left-color: var(--warning); }
.cockpit-decision-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.cockpit-decision-title { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; min-width: 0; }
.cockpit-decision-why, .cockpit-decision-impact, .cockpit-decision-action { font-size: 12px; color: var(--text-secondary); line-height: 1.5; padding: 2px 0; }
.cockpit-decision-why strong, .cockpit-decision-impact strong, .cockpit-decision-action strong { color: var(--text-muted); font-size: 11px; }
.cockpit-decision-need-action { display: inline-block; font-size: 10px; font-weight: 600; color: var(--error); background: var(--danger-bg); padding: 1px 6px; border-radius: var(--radius-sm); margin-left: 6px; }
.cockpit-empty-note { font-size: 13px; color: var(--text-muted); padding: 16px 0; text-align: center; }

/* ── F. 证据与结果 ── */
.cockpit-evidence { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px; }
.cockpit-evidence-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cockpit-evidence-card { background: var(--surface-container-low); border-radius: var(--radius-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.cockpit-evidence-label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cockpit-evidence-label .material-symbols-outlined { font-size: 14px; }
.cockpit-evidence-value { font-size: 13px; font-weight: 600; align-self: flex-start; }
.cockpit-evidence-meta { font-size: 11px; color: var(--text-muted); }
.cockpit-evidence-empty { font-size: 12px; color: var(--text-muted); }

/* ── 辅助入口（降级） ── */
.cockpit-aux { margin-bottom: 16px; }
.cockpit-aux-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.cockpit-aux-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 14px;
  background: var(--surface-container-low); border: 1px solid var(--border-light); border-radius: var(--radius-full);
  font-size: 12px; color: var(--text-secondary); text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.cockpit-aux-item:hover { border-color: var(--primary); background: var(--surface); }
.cockpit-aux-item .material-symbols-outlined { font-size: 14px; color: var(--text-muted); }

/* ── 响应式 ── */
@media (max-width: 1024px) {
  .cockpit-goals-grid { grid-template-columns: 1fr; }
  .cockpit-kanban { grid-template-columns: repeat(2, 1fr); }
  .cockpit-pulse-grid { grid-template-columns: 1fr; }
  .cockpit-evidence-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .cockpit-narrative { flex-direction: column; align-items: flex-start; }
  .cockpit-narrative-right { align-self: flex-start; }
  .cockpit-kanban { grid-template-columns: 1fr; }
  .cockpit-evidence-grid { grid-template-columns: 1fr; }
  .cockpit-archmap-grid { grid-template-columns: repeat(2, 1fr); }
}


.fab .material-symbols-outlined { font-size: 22px; font-variation-settings: 'wght' 400, 'FILL' 1; }

pre.raw-output {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 480px;
  overflow-y: auto;
}

/* ─── VI Settings Page ─────────────────────────────────────────── */
.vi-save-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--success-50, #f0fdf4);
  border: 1px solid var(--success-200, #bbf7c8);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--success-700, #15803d);
}
.vi-settings-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 860px;
}
.vi-section {
  padding: 24px;
}
.vi-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}
.vi-section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 16px 0;
}
.vi-field-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.vi-field {
  flex: 1;
  min-width: 240px;
}
.vi-field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 0 0;
}
.vi-image-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 640px) {
  .vi-image-grid { grid-template-columns: 1fr; }
}
.vi-image-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vi-image-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vi-image-hint-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-container);
  border-radius: var(--radius-full);
  padding: 2px 8px;
}
.vi-image-upload-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 2px dashed var(--border-light, #e5e7eb);
  border-radius: var(--radius-lg);
  background: var(--surface-container-low, #fafafa);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
  position: relative;
}
.vi-image-upload-area:hover,
.vi-image-upload-area.vi-drop-active {
  border-color: var(--primary-500, #ef6b3a);
  background: var(--primary-50, #fff7f0);
}
.vi-img-preview {
  max-width: 100%;
  max-height: 110px;
  object-fit: contain;
  padding: 8px;
  border-radius: var(--radius-md);
}
.vi-img-favicon {
  max-height: 64px;
}
.vi-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px;
}
.vi-hidden-input {
  display: none;
}
.vi-image-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.vi-upload-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* Menu editor */
.vi-menu-editor {
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.vi-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.vi-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
  background: var(--surface, white);
  transition: background 0.1s;
  cursor: default;
}
.vi-menu-item:last-child { border-bottom: none; }
.vi-menu-item--hidden {
  background: var(--surface-container-low, #fafafa);
  opacity: 0.5;
}
.vi-menu-item.vi-menu-dragging {
  opacity: 0.4;
}
.vi-menu-item.vi-menu-drag-over {
  background: var(--primary-50, #fff7f0);
  border-top: 2px solid var(--primary-500, #ef6b3a);
}
.vi-menu-drag-handle {
  cursor: grab;
  color: var(--neutral-400);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.vi-menu-drag-handle:active { cursor: grabbing; }
.vi-menu-item-path {
  font-size: 12px;
  min-width: 130px;
  flex-shrink: 0;
  font-family: var(--font-mono, monospace);
}
.vi-menu-item-label-input {
  flex: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 4px);
  padding: 4px 8px;
  font-size: 14px;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
  min-width: 0;
}
.vi-menu-item-label-input:hover,
.vi-menu-item-label-input:focus {
  border-color: var(--border-input, #d1d5db);
  background: var(--surface, white);
  outline: none;
}
.vi-menu-visibility-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm, 4px);
  color: var(--neutral-400);
  display: flex;
  align-items: center;
  transition: color 0.15s;
  flex-shrink: 0;
}
.vi-menu-visibility-btn:hover { color: var(--primary-500, #ef6b3a); }
.vi-form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 0 8px 0;
}
.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}
