/* ============================================================
 * components.css - 组件库
 * 导航 / 卡片 / 表单 / 按钮 / 报告 / 聊天 / 规范树 / 工具箱 / 提示
 * 亮色系单一配色，参考 Linear / Notion 风格
 * ============================================================ */

/* ==================== 顶部条（纯白 + 底部边框） ==================== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  background: #ffffff;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  height: var(--nav-height);
  gap: var(--space-2);
}
.nav-brand {
  color: var(--c-text);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  letter-spacing: 1px;
  white-space: nowrap;
  flex: 1;
}
.nav-brand-sub {
  margin-left: 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-normal);
  letter-spacing: 0.5px;
  color: var(--c-text-muted);
}
.nav-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  font-size: var(--fs-md);
  padding: var(--space-2);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.nav-action:hover { color: var(--c-text); background: var(--c-bg-hover); }

/* ==================== 侧边栏（浅灰底，右侧 18px 窄条由 .sidebar-edge 承担） ==================== */
.sidebar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  bottom: 0;
  width: calc(var(--sidebar-width) - 18px);
  background: var(--c-bg-subtle);
  z-index: var(--z-nav);
  display: flex;
  flex-direction: column;
  padding: var(--space-3) 0;
  overflow-x: hidden;
  overflow-y: auto;
  transition: width var(--transition);
}

.sidebar.collapsed { width: 0; overflow: hidden; padding: 0; }

/* 导航项 */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  color: var(--c-text-secondary);
  font-size: var(--fs-base);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border-left: 3px solid transparent;
  margin: 0 var(--space-2);
  border-radius: var(--radius-sm);
}
.sidebar-item:hover { color: var(--c-text); background: var(--c-bg-hover); }
.sidebar-item.active {
  color: var(--c-accent);
  background: var(--c-accent-soft);
  font-weight: var(--fw-medium);
}

.sidebar-icon { font-size: var(--fs-lg); flex-shrink: 0; width: 24px; text-align: center; }
.sidebar-label { flex: 1; }

/* 可展开父项 */
.sidebar-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  color: var(--c-text-secondary);
  font-size: var(--fs-base);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  margin: 0 var(--space-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent; /* 与 .sidebar-item 对齐（同款透明预留位），否则文字比其他项偏左 3px */
}
.sidebar-group-header:hover { color: var(--c-text); background: var(--c-bg-hover); }
.sidebar-group-header.group-active {
  color: var(--c-accent);
  font-weight: var(--fw-medium);
}
.sidebar-group-header .sidebar-icon { font-size: var(--fs-lg); flex-shrink: 0; width: 24px; text-align: center; }
.sidebar-group-header .sidebar-label { flex: 1; }
.sidebar-chevron {
  font-size: 10px;
  transition: transform var(--transition);
  opacity: 0.5;
}
.sidebar-chevron.expanded { transform: rotate(90deg); }

/* 子菜单 */
.sidebar-sub {
  overflow: hidden;
  transition: max-height var(--transition-slow);
  max-height: 300px;
}
.sidebar-sub.collapsed { max-height: 0; }
.sidebar-sub-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5) var(--space-2) var(--space-12);
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  margin: 0 var(--space-2);
  border-radius: var(--radius-sm);
}
.sidebar-sub-item:hover { color: var(--c-text); background: var(--c-bg-hover); }
.sidebar-sub-item.active {
  color: var(--c-accent);
  background: var(--c-accent-soft);
  font-weight: var(--fw-medium);
}

/* 侧边栏右边缘收展窄条（通高，箭头居中，收起后仅露窄条） */
.sidebar-edge {
  position: fixed;
  left: calc(var(--sidebar-width) - 18px);
  top: var(--nav-height);
  bottom: 0;
  width: 18px;
  background: var(--c-bg-subtle);
  border-right: 1px solid var(--c-border);
  cursor: pointer;
  z-index: calc(var(--z-nav) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  transition: left var(--transition);
  user-select: none;
}
.sidebar-edge:hover { color: var(--c-text); background: var(--c-bg-hover); }
.sidebar-edge svg { transition: transform 0.15s; pointer-events: none; }
body.sidebar-collapsed .sidebar-edge { left: 0; }
body.sidebar-collapsed .sidebar-edge svg { transform: rotate(180deg); }

/* 折叠态 tooltip */
.sidebar.collapsed .sidebar-item:hover::after,
.sidebar.collapsed .sidebar-group-header:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 60px;
  background: var(--c-text);
  color: #fff;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  z-index: var(--z-sticky);
}
.sidebar.collapsed .sidebar-item,
.sidebar.collapsed .sidebar-group-header { position: relative; }

/* ==================== 卡片 ==================== */
.card {
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.section-label {
  text-transform: uppercase;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text-muted);
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
}

/* ==================== 表单 ==================== */
.field {
  padding: var(--space-3) 0;
  margin-bottom: var(--space-2);
}
.field:last-child { margin-bottom: 0; }
.field-label {
  font-size: var(--fs-base);
  color: var(--c-text-secondary);
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.field-label .field-hint {
  font-size: var(--fs-xs);
  color: var(--c-text-disabled);
  font-weight: var(--fw-normal);
}
.field-input,
.field-textarea,
.field-select {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3);
  background: var(--c-bg-input);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  color: var(--c-text);
  outline: none;
  transition: all var(--transition-fast);
}
.field-input:hover,
.field-textarea:hover,
.field-select:hover { border-color: var(--c-border-strong); }
.field-textarea {
  height: auto;
  min-height: 80px;
  padding: var(--space-3);
  line-height: var(--lh-base);
  resize: vertical;
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus {
  border-color: var(--c-accent);
  box-shadow: var(--shadow-focus);
}
.field-input::placeholder,
.field-textarea::placeholder {
  color: var(--c-text-disabled);
}
.field-readonly {
  height: 44px;
  line-height: 44px;
  padding: 0 var(--space-3);
  background: var(--c-bg-hover);
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  color: var(--c-text-muted);
}
select.field-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field-error {
  font-size: var(--fs-xs);
  color: var(--c-error);
  margin-top: var(--space-1);
}

/* ==================== 模式切换（分段控件） ==================== */
.mode-switch {
  display: flex;
  background: var(--c-bg-hover);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.mode-option {
  flex: 1;
  text-align: center;
  padding: var(--space-2) 0;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}
.mode-option.active {
  background: var(--c-bg-elevated);
  color: var(--c-brand);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-sm);
}

/* 单位切换标签 */
.unit-switch {
  display: inline-flex;
  gap: 2px;
  background: var(--c-bg-hover);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.unit-tag {
  font-size: var(--fs-xs);
  padding: 4px var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}
.unit-tag.active {
  background: var(--c-brand);
  color: var(--c-bg-elevated);
  font-weight: var(--fw-medium);
}

/* ==================== 按钮 ==================== */
.btn-row {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-6);
  justify-content: flex-end;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--c-accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37,99,235,.3), 0 3px 8px rgba(37,99,235,.18);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(37,99,235,.35), 0 5px 14px rgba(37,99,235,.25);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:hover { background: var(--c-accent-hover); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--c-bg-elevated);
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border-strong);
}
.btn-secondary:hover { background: var(--c-bg-hover); border-color: var(--c-text-muted); }
.btn-ghost {
  background: transparent;
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border);
}
.btn-ghost:hover {
  background: var(--c-bg-hover);
  border-color: var(--c-border-strong);
  color: var(--c-text);
}
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--fs-sm); }
.btn-icon { padding: var(--space-2); }

/* ==================== 报告 ==================== */
.report {
  background: var(--c-bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4);
  box-shadow: var(--shadow);
  animation: slideUp var(--transition) ease;
}
.report-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  margin-bottom: var(--space-4);
}
.calc-process {
  background: var(--c-bg-input);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}
.calc-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text-secondary);
  margin-bottom: var(--space-2);
}
.calc-step {
  display: flex;
  align-items: baseline;
  padding: var(--space-1) 0;
  gap: var(--space-2);
}
.calc-label {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  flex-shrink: 0;
  min-width: 100px;
}
.calc-formula {
  font-size: var(--fs-sm);
  color: var(--c-text);
  font-family: var(--font-mono);
}
.result-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.result-metrics.single { grid-template-columns: 1fr; }
.metric-card {
  background: var(--c-bg-input);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-3);
  text-align: center;
}
.metric-card-label {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  margin-bottom: var(--space-2);
}
.metric-card-value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-extrabold);
  color: var(--c-text);
}
.metric-card-unit {
  font-size: var(--fs-sm);
  font-weight: var(--fw-normal);
  color: var(--c-text-muted);
}
.source-box {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--c-divider);
}
.source-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text-secondary);
  margin-bottom: var(--space-2);
}
.source-item {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  padding: 2px 0;
}
.disclaimer {
  font-size: var(--fs-xs);
  color: var(--c-text-disabled);
  text-align: center;
  line-height: var(--lh-loose);
  margin-top: var(--space-2);
}
.status-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
}
.status-bar.pass { background: var(--c-success-bg); color: var(--c-success); }
.status-bar.warn { background: var(--c-warning-bg); color: var(--c-warning); }
.status-bar.fail { background: var(--c-error-bg); color: var(--c-error); }
.status-bar.none { background: var(--c-bg-hover); color: var(--c-text-muted); }

/* ==================== 聊天 ==================== */
/* 整体布局：顶部标题栏 + 中间内容区(滚动) + 底部输入栏，占满视口减去固定导航栏 */
.chat-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - var(--content-padding) - var(--content-padding-bottom));
}
.chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
/* 顶部右侧操作行：联网搜索滑块 + 新对话 */
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
/* ==================== 问答模式下拉（规范问答 / 项目问答，对齐小程序 mode-dropdown） ==================== */
.mode-dropdown { position: relative; flex-shrink: 0; }
.mode-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 15px; background: #F2F2F7;
  font-size: var(--fs-sm); color: var(--c-text);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background var(--transition-fast);
}
.mode-trigger:hover { background: #e3e3e8; }
.mode-trigger .mode-arrow { font-size: 10px; color: var(--c-text-muted); }
.mode-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 220px; max-height: 320px; overflow-y: auto;
  background: var(--c-bg-elevated); border: 1px solid var(--c-border);
  border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: var(--space-1); z-index: 100;
}
.mode-menu.hidden { display: none; }
.mode-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: var(--fs-sm); color: var(--c-text); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mode-option:hover { background: var(--c-bg-hover); }
.mode-option.active { background: var(--c-info-bg); color: var(--c-info); font-weight: var(--fw-medium); }
.mode-option.disabled { color: var(--c-text-disabled); cursor: not-allowed; }
.mode-option.disabled:hover { background: transparent; }
/* 项目问答依据卡：文档组/笔记组微调 */
/* 项目问答依据卡：来源行淡暖橙底（对齐小程序 project-source-wrap #FAEAD0）
   来源名称文字无背景色（对齐小程序 project-source-name） */
.ref-group.project-group-doc .ref-reg,
.ref-group.project-group-note .ref-reg,
.ref-group.project-group-cad .ref-reg { background: #FAEAD0; }
.ref-group.project-group-doc .regulation-name-tag,
.ref-group.project-group-note .regulation-name-tag,
.ref-group.project-group-cad .regulation-name-tag { background: transparent; color: #333333; }
/* 新对话胶囊按钮（对齐小程序 new-chat-btn 配色） */
.new-chat-pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 15px;
  background: #F2F2F7;
  color: #1a1a1a;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background var(--transition-fast);
}
.new-chat-pill:hover { background: #c8eef5; }
/* 联网搜索开关：iOS 风格滑动块（对齐小程序 .web-search-switch）
   关闭：圆点在右，灰底；开启：圆点滑到左，浅青底，文字靠右 */
.web-search-switch {
  width: 110px;
  height: 30px;
  border-radius: 15px;
  background-color: #F2F2F7;
  position: relative;
  flex-shrink: 0;
  transition: background-color 0.25s ease;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.web-search-switch.on { background-color: #c8eef5; }
/* 内部轨道：承载文字 + 圆点 */
.switch-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
/* 文字：固定"联网搜索"，位置随圆点滑动到对侧（避免被圆点遮挡）
   关闭：圆点在右 -> 文字靠左；开启：圆点在左 -> 文字靠右 */
.web-search-switch .switch-text {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  line-height: 1;
  color: #666666;
  pointer-events: none;
  transition: left 0.25s ease, right 0.25s ease, color 0.25s ease;
  left: 12px;
  right: auto;
  text-align: left;
}
.web-search-switch.on .switch-text {
  color: #1b6b7a;
  left: auto;
  right: 12px;
  text-align: right;
}
/* 圆点：默认在右，开启滑到左 */
.switch-thumb {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: right 0.25s ease, left 0.25s ease;
}
.web-search-switch.on .switch-thumb {
  right: auto;
  left: 3px;
}
.chat-footer {
  flex-shrink: 0;
}
.chat-box {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-bottom: var(--space-4);
  animation: slideUp var(--transition) ease;
}
.chat-msg.user { flex-direction: row; justify-content: flex-end; }
/* 头像（文字占位，零资源依赖） */
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  user-select: none;
}
.chat-avatar.ai-avatar { background: var(--c-brand); }
.chat-avatar.user-avatar { background: #4a90e2; }
.chat-bubble {
  max-width: 85%;
  padding: var(--space-3) var(--space-4);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg.user .chat-bubble {
  background: var(--c-brand);
  color: var(--c-bg-elevated);
  border-radius: 12px 12px 4px 12px;
}
.chat-msg.assistant .chat-bubble {
  background: #ffffff;
  color: #333333;
  border-radius: 12px 12px 12px 4px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.12);
}
.chat-msg.assistant .chat-bubble.streaming::after {
  content: '▋';
  animation: blink 1s infinite;
  color: var(--c-text-muted);
}
@keyframes blink { 50% { opacity: 0; } }
.chat-msg.system .chat-bubble {
  background: var(--c-info-bg);
  color: var(--c-text-secondary);
  font-size: var(--fs-sm);
  text-align: center;
  max-width: 90%;
  margin: 0 auto;
}
.chat-input-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: var(--space-3);
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  outline: none;
  resize: none;
  transition: border-color var(--transition-fast);
}
.chat-input:focus { border-color: var(--c-brand); }
/* 回形针：项目问答内上传资料入口（仅项目模式渲染） */
.chat-paperclip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 44px;
  color: var(--c-text-muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.chat-paperclip:hover {
  color: var(--c-accent);
  background: var(--c-accent-soft);
}
.chat-send-btn {
  flex: 0 0 auto;
  padding: 0 var(--space-5);
  height: 44px;
}
/* 输入框上方工具栏（联网搜索开关等） */
.chat-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}
.chat-toolbar .sc-include-common-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}

/* AI 结构化回答 - 卡片化（对齐小程序 conclusion-section / basis-section 配色） */
/* 结论卡：绿边框 + 绿底头部；依据卡：蓝边框 + 蓝底头部 */
.response-section {
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--c-border);
  margin: var(--space-3) 0;
}
.response-section:first-child { margin-top: 0; }
.section-header {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  background: #fafafa;
  color: #1a1a1a;
  border-bottom: 1px solid var(--c-border);
}
.section-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: #1a1a1a; }
.section-content {
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-base);
  line-height: var(--lh-loose);
  color: #333333;
}
.conclusion-section { border-color: #B8E894; }
.conclusion-header { background: #dbfabc; border-bottom-color: #B8E894; }
/* 项目问答结论卡：紫色（对齐小程序 project-conclusion 配色；规范问答保持绿色） */
.project-answer .conclusion-section { border-color: #D8C8E8; }
.project-answer .conclusion-header { background: #EDE0F7; border-bottom-color: #D8C8E8; }
.basis-section { border-color: #7EC4ED; }
.basis-header { background: #9edbf7; border-bottom-color: #7EC4ED; }
/* 项目问答专属色系（对齐小程序 project-basis：暖橙） */
.project-basis { border-color: #E0C8A0; }
.project-basis-header { background: #F5DBA8; border-bottom-color: #E0C8A0; }
/* 依据内容过长时滚动显示（CAD 卡自带折叠不套用；规范问答不受影响） */
.project-basis .ref-group:not(.project-group-cad) .ref-content {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}
.project-basis .ref-group:not(.project-group-cad) .ref-content::-webkit-scrollbar { width: 6px; }
.project-basis .ref-group:not(.project-group-cad) .ref-content::-webkit-scrollbar-thumb { background: #d8c9a8; border-radius: 3px; }
.project-basis .ref-group:not(.project-group-cad) .ref-content::-webkit-scrollbar-track { background: transparent; }
/* 旧版行式小标题保留（兼容未被卡片化的残留文本） */
.ai-section-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text-secondary);
  margin: var(--space-3) 0 var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--c-divider);
}
.ai-section-title:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}
.ai-external-title { color: var(--c-warning, #B8860B); }

/* 条文分组 - 对齐小程序 regulation-group / article-item-wrap / article-header 结构
   灰底只覆盖条文编号那一行（ref-article-header），正文 ref-body 无背景 */
.ref-group { margin: 0 0 var(--space-3); }
.ref-group:last-child { margin-bottom: 0; }
/* 规范名行：青底（对齐 regulation-title-wrap），网页宽，子元素横向排列 */
.ref-reg {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px;
  padding: 5px;
  background: #c8e8f8;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: #333333;
}
/* 外部条文规范名行：淡薄荷绿（对齐 external-group .regulation-title-wrap） */
.ref-group-external .ref-reg { background: #E3F2E8; }
/* 规范名/编号（对齐 regulation-name-tag / regulation-code-text） */
.regulation-name-tag {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: #333333;
}
.regulation-code-text {
  font-size: var(--fs-xs);
  color: #333333;
  padding-left: 8px;
}
/* 外部来源提示小字：规范名行内最右侧（对齐 external-source-hint） */
.external-source-hint {
  font-size: 13px;
  color: #B08050;
  margin-left: auto;
  padding-right: 4px;
  line-height: 1.4;
}
/* 条文项容器：无背景，padding 留给 header 负 margin 撑满（对齐 article-item-wrap） */
.ref-article {
  padding: 5px;
  background: transparent;
  border: none;
  margin: 0;
}
/* 条文编号头部行：灰底只在此行（对齐 article-header） */
.ref-article-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #c8c8c8;
  margin: 0 -5px;
  padding: 2px 10px;
  border-bottom: 1px solid #f0f0f0;
}
.ref-article:last-child .ref-article-header { border-bottom: none; }
.ref-code {
  font-size: var(--fs-sm);
  color: #333333;
  font-weight: var(--fw-semibold);
}
.ref-article-link {
  font-size: var(--fs-xs);
  color: var(--c-accent);
  white-space: nowrap;
  text-decoration: none;
}
.ref-article-link:hover { text-decoration: underline; }
/* 条文正文区：无背景（对齐 article-body） */
.ref-body { padding-top: 5px; }
.ref-content {
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
  color: #333333;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.ref-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }
/* 条文说明折叠区（对齐 article-explanation） */
.ref-expand {
  font-size: var(--fs-xs);
  color: #888;
  cursor: pointer;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px dashed #ddd;
  user-select: none;
}
.ref-expand:hover { text-decoration: underline; }
.ref-explanation {
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
  color: #333333;
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0 0;
  background: var(--c-bg-hover); /* 展开的条文说明加浅灰底，与条文正文区分 */
  border: none;
  border-radius: var(--radius-sm);
}

/* CAD 依据卡明细折叠按钮（明细超 30 行默认收起，样式对齐 .ref-expand） */
.cad-basis-toggle {
  font-size: var(--fs-xs);
  color: #888;
  cursor: pointer;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px dashed #ddd;
  user-select: none;
  text-align: center;
}
.cad-basis-toggle:hover { text-decoration: underline; }

/* VIP 定价区（三栏定价卡，2026-09 重设计） */
.vip-section { display: flex; flex-direction: column; gap: var(--space-4); }
.vip-status-bar {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--c-success-bg); border: 1px solid #bbf7d0; border-radius: var(--radius-md);
  font-size: var(--fs-sm);
}
.vip-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-success); box-shadow: 0 0 0 3px rgba(22,163,74,0.15); flex-shrink: 0; }
.vip-status-text { color: var(--c-success); font-weight: var(--fw-semibold); }
.vip-status-note { color: var(--c-text-muted); font-size: var(--fs-xs); }
.vip-hero { text-align: center; padding-top: var(--space-2); }
.vip-hero-title { font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.vip-hero-sub { color: var(--c-text-secondary); font-size: var(--fs-sm); margin-top: var(--space-1); }
.vip-hero-benefits { display: flex; justify-content: center; gap: var(--space-5); flex-wrap: wrap; margin-top: var(--space-3); }
.vip-hero-benefits span { font-size: var(--fs-xs); color: var(--c-text-secondary); }
.vip-hero-benefits span::before { content: '✓ '; color: var(--c-success); font-weight: var(--fw-bold); }
.vip-pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); padding-top: var(--space-2); }
.vip-plan-card {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: var(--space-6) var(--space-4) var(--space-5);
  background: var(--c-bg-elevated); border: 1px solid var(--c-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.vip-plan-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--c-border-strong); }
.vip-plan-card.featured {
  border-color: var(--c-accent-border);
  background: linear-gradient(180deg, var(--c-accent-soft) 0%, #ffffff 55%);
  box-shadow: var(--shadow-md);
}
.vip-plan-card.featured:hover { border-color: var(--c-accent); }
.vip-plan-badge {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  padding: 2px 12px; border-radius: var(--radius-full);
  background: var(--c-accent); color: #fff; font-size: 12px; font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-sm); white-space: nowrap;
}
.vip-plan-name { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--c-text-secondary); }
.vip-plan-price { font-size: var(--fs-3xl); font-weight: var(--fw-extrabold); letter-spacing: -0.5px; line-height: 1.1; margin-top: var(--space-2); }
.vip-plan-cur { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin-right: 2px; }
.vip-plan-per { font-size: var(--fs-xs); color: var(--c-text-secondary); margin-top: var(--space-1); }
.vip-plan-save {
  font-size: var(--fs-xs); color: var(--c-warning); background: var(--c-warning-bg);
  border-radius: var(--radius-full); padding: 2px 10px; margin-top: var(--space-2); min-height: 20px;
}
.vip-plan-save.ghost { visibility: hidden; } /* 无节省额档位：隐形占位保持三卡按钮对齐 */
.vip-plan-btn { width: 100%; margin-top: var(--space-4); }
.vip-pay-tip { text-align: center; font-size: var(--fs-xs); color: var(--c-text-muted); }
@media (max-width: 640px) {
  .vip-pricing { grid-template-columns: 1fr; }
  .vip-hero-benefits { flex-direction: column; align-items: center; gap: var(--space-1); }
}

/* VIP 支付二维码弹窗 */
.pay-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.pay-modal {
  width: 340px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.pay-modal-title { font-size: 15px; font-weight: 600; color: #333; }
.pay-modal-qr { width: 240px; height: 240px; margin: 14px auto 10px; display: block; }
.pay-modal-status { font-size: 13px; color: #666; }
.pay-modal-status.paid { color: #34A853; font-weight: 600; }
.pay-modal-tip { font-size: 12px; color: #999; margin: 6px 0 14px; }

/* 缺失规范提示 - 层叠渐变（对齐小程序 missing-regulations-hint） */
.ai-missing-regs {
  margin: calc(-1 * var(--space-3)) 0 var(--space-2);
  padding: var(--space-4) var(--space-3) var(--space-2);
  background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
  border: 1px solid #e8e8e8;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: var(--fs-sm);
}
.ai-missing-regs-hint {
  color: indianred;
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-1);
}
.ai-missing-reg {
  color: #595959;
  font-size: var(--fs-sm);
  line-height: 1.8;
  padding: 1px 0;
}

/* AI 思考中气泡：阶段文字 + 三个跳动圆点（对齐小程序 thinking-bubble） */
.chat-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
}
.chat-thinking-text {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  white-space: nowrap;
}
.chat-thinking-dots {
  display: flex;
  gap: 5px;
}
.chat-thinking-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-text-muted);
  animation: thinking-bounce 1.4s ease-in-out infinite;
}
.chat-thinking-dots i:nth-child(1) { animation-delay: 0s; }
.chat-thinking-dots i:nth-child(2) { animation-delay: 0.2s; }
.chat-thinking-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}
.chat-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--c-text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.chat-action-btn:hover { background: var(--c-bg-hover); color: var(--c-text-secondary); }
.chat-action-btn svg { display: block; }

/* 示例问题 */
.sample-questions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
/* 缩进仅用于问答页（对齐气泡文字：头像 36px + 间距 6px）；效果图页复用本类时须与表单左缘对齐，不加缩进 */
#chat-box .sample-questions {
  padding-left: calc(36px + 6px);
}
.sample-chip {
  font-size: var(--fs-sm);
  padding: var(--space-2) var(--space-3);
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-full);
  color: var(--c-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.sample-chip:hover {
  border-color: var(--c-brand);
  color: var(--c-brand);
}

/* ==================== 工具箱 ==================== */
.toolbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}
.toolbox-card {
  background: var(--c-bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.toolbox-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.toolbox-icon {
  width: 48px;
  height: 48px;
}
.toolbox-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}
.toolbox-desc {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  line-height: var(--lh-base);
}

/* ==================== 规范库 ==================== */
.reg-card {
  display: flex;
  background: var(--c-bg-elevated);
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all var(--transition-fast);
}
.reg-card:hover { box-shadow: var(--shadow-md); }
.reg-card-accent { width: 4px; flex-shrink: 0; }
.reg-card-body { flex: 1; padding: var(--space-4) var(--space-4); }
.reg-card-code {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.reg-card-title {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  margin: var(--space-1) 0;
}
.reg-card-meta {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}
.reg-badge {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 1px var(--space-2);
  border-radius: var(--radius-full);
  font-weight: var(--fw-medium);
}
.reg-badge-published { background: var(--c-success-bg); color: var(--c-success); }
.reg-badge-review { background: var(--c-warning-bg); color: var(--c-warning); }
.reg-badge-expired { background: var(--c-bg-hover); color: var(--c-text-muted); }
.reg-badge-external { background: var(--c-info-bg); color: var(--c-info); }

/* ==================== 规范详情页（克制极简） ==================== */
/* 详情容器 */
/* 详情页容器：普通 block 布局（不用 flex column，避免 flex 容器内 sticky 失效） */
.detail { display: block; }

/* 详情头部卡片 */
/* 顶栏固定布局：列表页顶部栏不滚动，内容区独立滚动（类 AI 问答页）
   详情页不沿用此布局：detail-header 随滚动上去，目录 sticky 吸顶 */
.reg-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - var(--content-padding) - var(--content-padding-bottom));
}
.reg-topbar {
  flex-shrink: 0;
  background: var(--c-bg);
}
/* 列表顶栏：用 padding 包住内部元素，避免内部 margin 透明间隙 */
.reg-topbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
}
.reg-topbar .page-header { margin-bottom: 0; }
.reg-topbar .search-bar { margin-bottom: 0; }
/* 列表内容区：占剩余高度，独立滚动 */
.reg-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.detail-header {
  background: var(--c-bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4);
  box-shadow: var(--shadow);
  margin-bottom: var(--space-4);
}
/* 返回按钮（全站统一：白底胶囊 + chevron 箭头，悬停主色反馈） */
.back-btn,
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-secondary);
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  padding: 6px 14px 6px 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}
.back-btn:hover,
.detail-back:hover {
  color: var(--c-accent);
  border-color: var(--c-accent-border);
  background: var(--c-accent-soft);
}
.back-btn svg,
.detail-back svg { flex-shrink: 0; }
.detail-back { margin-bottom: var(--space-3); }
.detail-title-block { display: flex; flex-direction: column; gap: var(--space-1); }
.detail-code-row { display: flex; align-items: center; gap: var(--space-2); }
.detail-code {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text-secondary);
  letter-spacing: 0.3px;
}
.detail-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  margin: var(--space-1) 0 var(--space-2);
  line-height: var(--lh-tight);
}
.detail-meta { font-size: var(--fs-xs); color: var(--c-text-muted); }

/* 工具栏（全部展开/收起）：sticky 吸顶，按钮上边缘与目录边框对齐（不加外框）
   背景覆盖按钮行含 gap，防止内容从两按钮间漏出 */
.detail-toolbar {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-3));
  z-index: 90;
  background: var(--c-bg);
  display: flex;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
}
/* 正文独立滚动框：内容在框内滚动，不穿过吸顶的工具栏（解决穿透） */
.detail-scroll {
  max-height: calc(100vh - var(--nav-height) - var(--space-3) - var(--space-12));
  overflow-y: auto;
  padding-right: var(--space-2);
}
.tool-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tool-btn:hover {
  border-color: var(--c-text-muted);
  color: var(--c-text);
  background: var(--c-bg-hover);
}
.tool-btn:active { transform: scale(0.98); }

/* 详情主体 */
.detail-body { display: flex; flex-direction: column; }

/* 详情页脚 */
.detail-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  text-align: center;
}

/* ==================== 详情页目录树（左侧导航） ==================== */
/* 详情页目录是纯文字导航，覆盖通用 .split-sidebar 的 38% 宽度，固定窄列
   sticky 吸顶：贴在导航栏下方，正文滚动时目录不动；目录过长时自身内部滚动 */
.detail-toc {
  flex: 0 0 240px;
  min-width: 0;
  max-width: 240px;
  position: sticky;
  top: calc(var(--nav-height) + var(--space-3));
  max-height: calc(100vh - var(--nav-height) - var(--space-6));
  overflow-y: auto;
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.detail-toc-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--c-divider);
}
.detail-toc-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.detail-toc-item {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  line-height: var(--lh-tight);
}
.detail-toc-item:hover {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}
.detail-toc-code {
  flex-shrink: 0;
  font-weight: var(--fw-medium);
  color: var(--c-text);
  min-width: 32px;
}
.detail-toc-item:hover .detail-toc-code { color: var(--c-accent); }
.detail-toc-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-toc-empty {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  text-align: center;
  padding: var(--space-4) 0;
}

/* ==================== 条文树（层级靠文字样式区分，不缩进） ==================== */
/* 条文内容左缘相对 tree-node 的偏移 = tree-row 左padding + toggle + gap + code + code右margin
   用于让条文说明按钮/说明块/废止信息与条文内容左对齐 */
:root { --article-content-indent: calc(var(--space-1) + 18px + var(--space-1) + 42px + var(--space-1)); }
.tree-row {
  display: flex;
  align-items: flex-start;
  padding: var(--space-2) var(--space-1);
  cursor: default;
  border-radius: var(--radius-sm);
  gap: var(--space-1);
  background: var(--c-bg-elevated);
}
/* 条文间增加间隙 */
.tree-node { margin-bottom: var(--space-2); }
.tree-node:last-child { margin-bottom: 0; }
/* 层级间额外间距：1级与子节点间、2级与子节点间 */
.tree-children { margin-top: var(--space-1); margin-left: var(--space-4); border-left: 2px solid var(--c-border); padding-left: var(--space-2); }
/* 层级区分：用字重/颜色而非背景色，桌面文档风格 */
.tree-lv1 .tree-code,
.tree-lv1 .tree-content-inline { font-size: var(--fs-sm); }
.tree-lv1 .tree-code { font-weight: var(--fw-bold); color: var(--c-text); }
.tree-lv1 .tree-content-inline { color: var(--c-text); }
.tree-lv2 .tree-code,
.tree-lv2 .tree-content-inline { font-size: var(--fs-sm); }
.tree-lv2 .tree-code { font-weight: var(--fw-semibold); color: var(--c-text); }
.tree-lv2 .tree-content-inline { color: var(--c-text-secondary); }
.tree-lv3 .tree-code,
.tree-lv3 .tree-content-inline { font-size: var(--fs-sm); }
.tree-toggle {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  user-select: none;
  cursor: pointer;
  border-radius: 50%;
}
.toggle-svg {
  display: block;
  transition: transform var(--transition);
}
.tree-toggle.collapsed .toggle-svg { transform: rotate(0deg); }
.tree-toggle.expanded .toggle-svg { transform: rotate(90deg); }
.tree-toggle-spacer { width: 18px; flex-shrink: 0; }
/* 编码：固定宽度，与内容同行，间距收紧 */
.tree-code {
  flex-shrink: 0;
  min-width: 42px;
  margin-right: var(--space-1);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  line-height: var(--lh-base);
}
.tree-code-spacer { flex-shrink: 0; min-width: 42px; margin-right: var(--space-1); }
.tree-content-inline {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  line-height: var(--lh-base);
}
.content-inline { display: inline; }
.content-image-inline { display: inline; }
.content-image-inline img { max-width: 100%; border-radius: var(--radius-sm); }

/* 条文说明按钮 */
/* 条文说明按钮容器（正文下方，独立行）
   与条文内容左对齐；用 :not(.qf-node) 排除前言/附录自身的说明（QF 头部无编号，对齐基准不同） */
.tree-node:not(.qf-node) > .explanation-btn-wrap {
  margin-left: var(--article-content-indent);
  padding: var(--space-2) var(--space-1) var(--space-1);
}
/* 前言/附录内容区内的说明按钮容器（无 content-indent，跟随 qf-content 自身缩进） */
.qf-content > .explanation-btn-wrap {
  padding: var(--space-2) var(--space-1) var(--space-1);
}
.explanation-btn {
  display: inline-block;
  font-size: var(--fs-xs);
  color: var(--c-accent);
  padding: 2px var(--space-3);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  background: var(--c-accent-soft);
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
}
.explanation-btn:hover { color: var(--c-accent); background: var(--c-accent-border); }
.explanation-btn.active { background: var(--c-accent); color: var(--c-bg-elevated); }

/* 前言/附录内容容器（独立展开，样式与正文 1 级统一） */
.qf-content {
  padding: var(--space-2) var(--space-1) 0 calc(18px + var(--space-1));
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
  color: var(--c-text-secondary);
}
.qf-content.hidden { display: none; }
.qf-content .content-block { margin-bottom: var(--space-2); }
.qf-content .tree-children {
  margin-top: var(--space-2);
}

/* 子条文容器：不缩进 */
.tree-children { }
.tree-children.hidden { display: none; }

/* 作废/强条标记 */
/* 强条：仅内容加粗，编号和标签不加粗（参考小程序 level-mandatory .content-paragraph） */
.tree-mandatory .tree-content-inline .content-inline { font-weight: var(--fw-bold); }
.tree-mandatory .tree-content-inline .content-inline strong { font-weight: var(--fw-bold); }
/* 强条中 .normal 标记恢复正常字重（不加粗） */
.tree-mandatory .tree-content-inline .content-inline .normal { font-weight: var(--fw-normal) !important; }
/* 废止：仅内容灰显+删除线，编号和标签不受影响（参考小程序 level-deprecated .content-paragraph） */
.tree-deprecated .tree-content-inline .content-inline { color: #999999; text-decoration: line-through; }
/* 废止中 .keep-text 标记恢复正常（不删除线、不灰显） */
.tree-deprecated .tree-content-inline .content-inline .keep-text { display: inline-block !important; text-decoration: none !important; color: #000000 !important; }
/* 独立色块标签（强条/废止），放在正文最前侧 */
.tree-badge {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 1px var(--space-1);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-medium);
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: var(--space-1);
}
.tree-badge-dep { background: var(--c-bg-hover); color: var(--c-text-muted); }
.tree-badge-mand { background: var(--c-error-bg); color: var(--c-error); }

/* 插入条文（-X系列）：无编码、不可导航 */
.tree-insert .tree-content-inline { font-style: italic; color: var(--c-text-muted); }

/* 不可展开节点（3级） */
.tree-row.no-expand { cursor: default; }

/* 定位高亮：从关联规范条文跳转过来时，目标条文短暂高亮 */
@keyframes tree-highlight-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(255, 152, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
}
.tree-node.tree-highlight > .tree-row {
  background: #FFF8E1 !important;
  animation: tree-highlight-pulse 1.6s ease-out 2;
  border-radius: var(--radius-sm);
}

/* 文章树容器 */
.article-tree { margin-bottom: var(--space-3); }

/* ==================== 条文内容 HTML 标签样式（对齐小程序 mp-html） ==================== */
.tree-content-inline .text-center,
.content-block .text-center,
.explanation-block .text-center,
.content-block p.text-center,
.content-block div.text-center { text-align: center; }
.tree-content-inline .text-right,
.content-block .text-right,
.explanation-block .text-right,
.content-block p.text-right,
.content-block div.text-right { text-align: right; }
.tree-content-inline .bold,
.content-block .bold,
.explanation-block .bold,
.content-block strong.bold,
.content-block strong,
.explanation-block strong { font-weight: var(--fw-bold); }
.tree-content-inline .table-title,
.content-block .table-title,
.explanation-block .table-title,
.content-block p.table-title {
  font-weight: var(--fw-bold);
  text-align: center;
  margin: var(--space-2) 0 var(--space-1);
}

/* 内容中的 p 标签：段落间距 */
.tree-content-inline p,
.content-block p,
.explanation-block p {
  margin: 0 0 var(--space-1);
  line-height: var(--lh-loose);
}
.tree-content-inline p:last-child,
.content-block p:last-child,
.explanation-block p:last-child { margin-bottom: 0; }

/* 内容中的表格（居中，超宽可横向拖动滚动） */
.tree-content-inline table,
.content-block table,
.explanation-block table {
  border-collapse: collapse;
  border: none;
  margin: var(--space-3) auto 0;
  font-size: var(--fs-xs);
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
}
.tree-content-inline table th,
.content-block table th,
.explanation-block table th {
  border: 1px solid var(--c-border-strong);
  padding: var(--space-2) var(--space-3);
  text-align: center;
  font-weight: var(--fw-bold);
  background: var(--c-bg-hover);
  white-space: nowrap;
}
.tree-content-inline table td,
.content-block table td,
.explanation-block table td {
  border: 1px solid var(--c-border-strong);
  padding: var(--space-2) var(--space-3);
  text-align: center;
  white-space: normal;
  word-break: break-word;
  line-height: var(--lh-base);
}
/* 表格横向滚动条样式 */
.tree-content-inline table::-webkit-scrollbar,
.content-block table::-webkit-scrollbar,
.explanation-block table::-webkit-scrollbar {
  height: 6px;
}
.tree-content-inline table::-webkit-scrollbar-track,
.content-block table::-webkit-scrollbar-track,
.explanation-block table::-webkit-scrollbar-track {
  background: var(--c-bg-hover);
  border-radius: 3px;
}
.tree-content-inline table::-webkit-scrollbar-thumb,
.content-block table::-webkit-scrollbar-thumb,
.explanation-block table::-webkit-scrollbar-thumb {
  background: var(--c-border-strong);
  border-radius: 3px;
}
.tree-content-inline table::-webkit-scrollbar-thumb:hover,
.content-block table::-webkit-scrollbar-thumb:hover,
.explanation-block table::-webkit-scrollbar-thumb:hover {
  background: var(--c-text-muted);
}
/* 表格标题 */
.tree-content-inline .table-title,
.content-block .table-title,
.explanation-block .table-title,
.content-block p.table-title {
  font-weight: var(--fw-bold);
  text-align: center;
  margin: var(--space-3) 0 var(--space-1);
  font-size: var(--fs-sm);
  color: var(--c-text);
}

.tree-content-inline img,
.content-block img,
.explanation-block img { max-width: 100%; border-radius: var(--radius-sm); }

/* 内容块 */
.content-block { margin-bottom: var(--space-1); }
.content-block:last-child { margin-bottom: 0; }
.content-block img { max-width: 100%; border-radius: var(--radius-sm); }
.content-image { text-align: center; margin: var(--space-3) 0; }

/* 条文说明块（展开后淡显背景，与整体配色协调；与条文内容左对齐）
   :not(.qf-node) 排除前言/附录自身说明 */
.tree-node:not(.qf-node) > .explanation-block {
  margin: var(--space-1) 0 var(--space-2) var(--article-content-indent);
  padding: var(--space-3);
  background: var(--c-accent-soft);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  line-height: var(--lh-loose);
  color: var(--c-text-secondary);
}
/* 前言/附录内容区内的说明块（无 content-indent，跟随 qf-content 缩进） */
.qf-content > .explanation-block {
  margin: var(--space-1) 0 var(--space-2);
  padding: var(--space-3);
  background: var(--c-accent-soft);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  line-height: var(--lh-loose);
  color: var(--c-text-secondary);
}
.explanation-block .content-block { margin-bottom: var(--space-1); }
.explanation-block .content-block:last-child { margin-bottom: 0; }
.explanation-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-warning);
  margin-bottom: var(--space-2);
}

/* ==================== 废止条文信息（参考小程序，条文下方逐条显示；与条文内容左对齐） ====================
   :not(.qf-node) 排除前言/附录头部废止信息（QF 头部无编号，对齐基准不同） */
.tree-node:not(.qf-node) > .deprecated-info {
  margin-top: 0;
  margin-left: var(--article-content-indent);
  padding: var(--space-2) var(--space-3);
  background: #F5F5F5;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
}
/* 前言/附录头部废止信息（无 content-indent，与 QF 头部左对齐） */
.qf-node > .deprecated-info {
  margin-top: 0;
  padding: var(--space-2) var(--space-3);
  background: #F5F5F5;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
}
.deprecated-date,
.deprecated-reason {
  display: block;
  color: #333333;
  margin-bottom: var(--space-1);
}
.deprecated-reason:last-child { margin-bottom: 0; }

/* 详情提示（保留备用） */
.detail-tip {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  text-align: center;
  padding: var(--space-2);
  margin-bottom: var(--space-2);
}

/* ==================== 返回栏 ==================== */
.back-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
/* .back-btn 统一样式见本文件"返回按钮"块（约 1120 行），此处不再重复定义 */

/* ==================== 搜索栏 ==================== */
.search-bar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.search-input {
  flex: 1;
  height: 40px;
  padding: 0 var(--space-3);
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}
.search-input:focus { border-color: var(--c-brand); }

/* ==================== Toast 轻提示 ==================== */
.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + var(--space-3));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast {
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: var(--fs-sm);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
  animation: slideUp var(--transition) ease;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.error { background: rgba(198,40,40,0.92); }
.toast.success { background: rgba(76,175,80,0.92); }
.toast.warning { background: rgba(255,152,0,0.92); }

/* ==================== 持久 loading 遮罩（文件操作） ==================== */
.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-toast);
  animation: fadeIn var(--transition) ease;
}
.loading-mask-box {
  background: var(--c-bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
}
.loading-mask-text {
  font-size: var(--fs-sm);
  color: var(--c-text);
  text-align: center;
}

/* ==================== 嵌套列表（疏散工具） ==================== */
.floor-card,
.compartment-card,
.zone-card {
  background: var(--c-bg-elevated);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: var(--space-3);
  overflow: hidden;
}
.floor-header,
.compartment-header,
.zone-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--c-bg-hover);
  border-bottom: 1px solid var(--c-divider);
}
.floor-index,
.zone-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text);
  white-space: nowrap;
}
.floor-no-input,
.compartment-name {
  flex: 1;
  height: 32px;
  padding: 0 var(--space-2);
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  outline: none;
}
.floor-no-input:focus,
.compartment-name:focus { border-color: var(--c-brand); }
.floor-body,
.compartment-body,
.zone-body { padding: var(--space-3) var(--space-4); }

.icon-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.icon-close:hover { background: var(--c-error-bg); color: var(--c-error); }

.add-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-sm);
  color: var(--c-accent);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.add-btn:hover { background: var(--c-info-bg); }

.density-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.density-input { flex: 1; }
.density-range-hint {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  margin-top: var(--space-1);
}
.source-links {
  display: inline-flex;
  gap: var(--space-1);
  margin-left: auto;
}
.source-link {
  font-size: var(--fs-xs);
  color: var(--c-accent);
  cursor: pointer;
}
.source-link:hover { text-decoration: underline; }

/* ==================== 通用工具类 ==================== */
.tag {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-medium);
}
.divider {
  height: 1px;
  background: var(--c-divider);
  margin: var(--space-4) 0;
}

/* ==================== Markdown 渲染 ==================== */
.md-p { margin-bottom: var(--space-2); line-height: var(--lh-loose); }
.md-p:last-child { margin-bottom: 0; }
.md-h1 { font-size: var(--fs-xl); font-weight: var(--fw-bold); margin: var(--space-4) 0 var(--space-2); }
.md-h2 { font-size: var(--fs-lg); font-weight: var(--fw-bold); margin: var(--space-3) 0 var(--space-2); }
.md-h3 { font-size: var(--fs-md); font-weight: var(--fw-semibold); margin: var(--space-3) 0 var(--space-2); }
.md-h4, .md-h5, .md-h6 { font-size: var(--fs-base); font-weight: var(--fw-semibold); margin: var(--space-2) 0 var(--space-1); }
.md-ul, .md-ol { margin: var(--space-2) 0; padding-left: var(--space-5); }
.md-ul li, .md-ol li { margin-bottom: var(--space-1); line-height: var(--lh-loose); }
.md-ul { list-style: disc; }
.md-ol { list-style: decimal; }
.md-quote {
  border-left: 3px solid var(--c-border-strong);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0;
  color: var(--c-text-muted);
  background: var(--c-bg-input);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.md-code-block {
  background: var(--c-bg-hover);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  overflow-x: auto;
  margin: var(--space-2) 0;
  font-size: var(--fs-sm);
}
.md-code-block code { font-family: var(--font-mono); color: var(--c-text); }
.md-code {
  font-family: var(--font-mono);
  background: var(--c-bg-hover);
  padding: 2px var(--space-1);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}
.md-reg-ref {
  margin: var(--space-2) calc(-1 * var(--space-3)) 0;
  padding: var(--space-2) var(--space-3);
  background: #c8e8f8;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: var(--fs-sm);
}
.md-reg-code { font-weight: var(--fw-bold); color: #333333; }
.md-reg-name { color: #333333; }
.md-article-ref {
  margin: 0 calc(-1 * var(--space-3));
  padding: 2px var(--space-3);
  background: #c8c8c8;
  border-bottom: 1px solid #f0f0f0;
  font-size: var(--fs-sm);
}
.md-article-ref:last-child { border-bottom: none; }
.md-article-code { font-weight: var(--fw-semibold); color: #333333; }
strong { font-weight: var(--fw-bold); }
em { font-style: italic; }

/* ==================== 表格样式（对齐小程序 tableTagStyle，token 化适配深色） ==================== */
.md-p table,
.chat-bubble table,
.ref-content table,
.ref-explanation table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--c-border-strong);
  margin: var(--space-2) 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.md-p table th,
.chat-bubble table th,
.ref-content table th,
.ref-explanation table th {
  border: 1px solid var(--c-border-strong);
  padding: var(--space-1) var(--space-2);
  font-size: var(--fs-xs);
  text-align: center;
  font-weight: var(--fw-bold);
  background: var(--c-bg-hover);
}
.md-p table td,
.chat-bubble table td,
.ref-content table td,
.ref-explanation table td {
  border: 1px solid var(--c-border-strong);
  padding: var(--space-1) var(--space-2);
  font-size: var(--fs-xs);
  text-align: center;
  word-break: break-word;
}

/* 条文说明/条文正文里的表格：去外层边框/圆角（保留单元格边框），超宽横向滚动 */
.ref-explanation table,
.ref-content table {
  border: none;
  border-radius: 0;
  overflow-x: auto;
}

/* AI 回复中的 Markdown 表格（列数多时支持横向滚动，避免撑破气泡） */
.chat-bubble .md-table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  border: none;            /* 覆盖 .chat-bubble table 的 border，去掉外层表格框 */
  border-radius: 0;       /* 覆盖圆角 */
  margin: var(--space-2) 0;
}
.chat-bubble .md-table th:first-child,
.chat-bubble .md-table td:first-child { text-align: left; }
.chat-bubble .md-table td { white-space: normal; }

/* 依据卡里引用的 CAD 原文表格（<table class="cad-table">）：去外层边框/圆角，限高滚动 + 表头吸顶 */
.ref-content .cad-table {
  border: none;
  border-radius: 0;
}
.ref-content:has(table.cad-table) {
  max-height: 50vh;
  overflow: auto;
}
.ref-content table.cad-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--c-bg-hover);
}

/* ==================== 图纸自查清单 ==================== */
.sc-actions { display:flex; gap:8px; }
/* 图纸自查页头三按钮统一几何：等高、同内边距、统一 1px 边框盒（primary 以透明边框补齐，消除 2px 高差） */
.sc-actions .btn-sm { height: 34px; padding: 0 var(--space-4); border: 1px solid transparent; box-sizing: border-box; border-radius: 8px; }
/* 顶部数据栏+筛选区左右分栏（窄屏回退上下堆叠） */
.sc-top-split {
  display: flex;
  gap: var(--space-3);
  align-items: stretch;
  margin-bottom: var(--space-3);
}
.sc-top-split .sc-stats { margin-bottom: 0; flex: 0 0 auto; }
.sc-top-split .sc-filter-card { margin-bottom: 0; flex: 1 1 auto; min-width: 0; }
@media (max-width: 900px) {
  .sc-top-split { flex-direction: column; }
  .sc-top-split .sc-stats { min-width: 0; }
}
.sc-stats {
  display:flex; flex-direction:column; gap:var(--space-5);
  background: var(--c-bg-elevated); border:1px solid var(--c-border);
  border-radius: var(--radius-lg); padding: var(--space-6) var(--space-6) var(--space-5);
  min-width: 360px;
}
.sc-stats-ring { position:relative; width:160px; height:160px; flex-shrink:0; margin: 0 auto; }
.sc-ring-svg { width:100%; height:100%; }
.sc-ring-bg { fill:none; stroke: var(--c-border); stroke-width:2.5; }
.sc-ring-fg { fill:none; stroke: var(--c-accent); stroke-width:2.5; transition: stroke-dasharray .6s cubic-bezier(.4,0,.2,1); stroke-linecap:round; }
.sc-ring-text { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; line-height:1; }
.sc-ring-text { font-size:48px; font-weight:var(--fw-bold); letter-spacing:-1.5px; font-variant-numeric: tabular-nums; color: var(--c-text); }
.sc-ring-text small { font-size:13px; color: var(--c-text-muted); font-weight:var(--fw-normal); letter-spacing:0; margin-top:6px; }
.sc-stats-nums { display:flex; gap:10px; }
.sc-stat {
  flex: 1;
  display:flex; align-items:stretch; gap:12px;
  padding: 14px 16px;
  background: var(--c-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border);
  min-width: 0;
}
.sc-stat-bar { width:4px; flex-shrink:0; border-radius:2px; background: var(--c-text-muted); }
.sc-stat-total .sc-stat-bar { background: var(--c-accent); }
.sc-stat-pass .sc-stat-bar { background: var(--c-success); }
.sc-stat-fail .sc-stat-bar { background: var(--c-error); }
.sc-stat-main { display:flex; flex-direction:column; justify-content:center; min-width:0; }
.sc-stat-num { font-size:34px; font-weight:var(--fw-bold); line-height:1.1; font-variant-numeric: tabular-nums; }
.sc-stat-pass .sc-stat-num { color: var(--c-success); }
.sc-stat-fail .sc-stat-num { color: var(--c-error); }
.sc-stat-label { font-size:13px; color: var(--c-text-muted); margin-top:4px; }

/* ==================== 筛选面板（白底卡片，三行布局，对标小程序卡片风格） ==================== */
.sc-filter-card {
  background: var(--c-bg-elevated);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 4px 20px;
  margin-bottom: var(--space-3);
}
.sc-filter-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #E0E0E0;
}
.sc-filter-row:last-child { border-bottom: none; }
.sc-filter-label {
  width: 56px;
  flex-shrink: 0;
  font-size: 13px;
  color: #999999;
  letter-spacing: 0.5px;
}

/* 自定义筛选下拉框（下划线风格，去除粗边框） */
.sc-filter-row .sc-select { position: relative; flex: 0 0 auto; min-width: 160px; }
.sc-filter-row .sc-select-trigger {
  height: 32px;
  padding: 0 24px 0 0;
  font-size: 14px;
  border: none;
  border-bottom: 1px solid #E0E0E0;
  background: transparent;
  color: #333333;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  transition: border-color .15s;
}
.sc-filter-row .sc-select-trigger:hover { border-bottom-color: #4A90D9; }
.sc-filter-row .sc-select-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sc-filter-row .sc-select-arrow {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #999999;
  font-size: 10px;
  transition: transform .15s;
}
.sc-filter-row .sc-select.open .sc-select-arrow { transform: translateY(-50%) rotate(180deg); }
.sc-filter-row .sc-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  background: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.sc-filter-row .sc-select.open .sc-select-dropdown { display: block; }
.sc-filter-row .sc-select-option {
  padding: 9px 14px;
  font-size: 13px;
  color: #333333;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s;
}
.sc-filter-row .sc-select-option:hover { background: #F5F5F5; }
.sc-filter-row .sc-select-option.active {
  color: #4A90D9;
  font-weight: 500;
  background: rgba(74, 144, 217, 0.08);
}

/* 关键词搜索框（浅灰底圆角填充式，与上方下划线筛选下拉明确区分） */
.sc-filter-row-search { padding-top: 14px; }
.sc-search-box {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  background: var(--c-bg-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}
.sc-search-box:focus-within { background: #FFFFFF; border-color: var(--c-border); }
/* 关掉 base.css 全局 :focus-visible 蓝色光晕，聚焦时只在胶囊外壳上做轻微变化 */
.sc-search-field:focus-visible { box-shadow: none; }
.sc-search-icon { font-size: 13px; flex-shrink: 0; opacity: 0.6; }
.sc-search-field {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--c-text);
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
}
.sc-search-field::placeholder { color: var(--c-text-muted); }

/* "包含通用"胶囊开关（放在该行下拉框右侧） */
.sc-include-common { margin-left: auto; }
.sc-include-common-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: #666666;
}
.sc-switch {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 10px;
  background: #E0E0E0;
  flex-shrink: 0;
  transition: background .2s;
}
.sc-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform .2s;
}
.sc-switch.on { background: #333333; }
.sc-switch.on .sc-switch-knob { transform: translateX(14px); }
.sc-include-common-wrap:hover .sc-switch:not(.on) { background: #CCCCCC; }
.sc-include-common-label { line-height: 1; letter-spacing: 0.3px; }
#f-include-common-project, #f-include-common-category { display: none; }

.sc-list { display:flex; flex-direction:column; gap: var(--space-2); }
.sc-card { background: var(--c-bg-elevated); border:1px solid var(--c-border); border-radius: var(--radius-md); overflow:hidden; transition:box-shadow .2s; }
/* 勾选状态用 inset 阴影做左侧色带，避免 border 改变盒模型导致文字抖动 */
.sc-card.state-pass { box-shadow: inset 3px 0 0 var(--c-success); }
.sc-card.state-fail { box-shadow: inset 3px 0 0 var(--c-error); }
.sc-card.state-na { box-shadow: inset 3px 0 0 var(--c-text-muted); }
.sc-card-head { display:flex; align-items:center; gap:8px; padding:12px 16px; cursor:pointer; user-select:none; }
.sc-sev-tag { font-size:11px; padding:2px 8px; border-radius:12px; border:1px solid; flex-shrink:0; }
.sc-card-title { flex:1; font-size:15px; font-weight:var(--fw-medium); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* 头部自查按钮组（始终可见，无需展开即可勾选） */
.sc-head-actions { display:flex; align-items:center; gap:4px; flex-shrink:0; }
.sc-check-btn { display:flex; align-items:center; gap:2px; font-size:12px; padding:3px 8px; border-radius: var(--radius-sm); border:1px solid var(--c-border-strong); background: var(--c-bg-elevated); color: var(--c-text-muted); cursor:pointer; transition:all .15s; line-height:1.4; }
.sc-check-btn:hover { background: var(--c-bg-hover); }
.sc-check-btn.pass.active { background: var(--c-success); color:#fff; border-color: var(--c-success); }
.sc-check-btn.fail.active { background: var(--c-error); color:#fff; border-color: var(--c-error); }
.sc-check-btn.na.active { background: var(--c-text-muted); color:#fff; border-color: var(--c-text-muted); }
@media(max-width:600px){ .sc-check-label { display:none; } .sc-check-btn { padding:3px 6px; } }
.sc-expand-icon { color: var(--c-text-muted); transition:transform .2s; }
.sc-card.expanded .sc-expand-icon { transform: rotate(90deg); }
.sc-card-body { display:none; padding:0 16px 14px; }
.sc-card.expanded .sc-card-body { display:block; }
.sc-meta { display:flex; gap:6px; margin-bottom:8px; }
.meta-chip { font-size:11px; background: var(--c-bg-hover); color: var(--c-text-muted); padding:2px 8px; border-radius:10px; }
.sc-desc { font-size:13px; color: var(--c-text-secondary); line-height:1.6; margin-bottom:8px; }
.sc-suggestion { font-size:13px; color: var(--c-text-muted); margin-bottom:8px; }
.sc-tags { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:8px; }
.sc-tag { font-size:11px; color: var(--c-info); background: var(--c-info-bg); padding:1px 6px; border-radius:8px; }
.sc-articles-btn { font-size:13px; color: var(--c-info); cursor:pointer; padding:6px 0; user-select:none; }
.sc-articles-icon { margin-left:4px; }
.sc-articles-view { margin-top:8px; }
.sc-reg-group { border-left:2px solid var(--c-border); padding-left:12px; margin-bottom:10px; }
.sc-reg-title { font-size:12px; color: var(--c-text-muted); margin-bottom:4px; }
.sc-reg-article { padding:6px 0; border-bottom:1px solid var(--c-border); }
.sc-reg-article:last-child { border-bottom:none; }
.sc-article-link { color: var(--c-info); font-size:13px; font-weight:var(--fw-medium); text-decoration:none; }
.sc-article-link:hover { text-decoration:underline; }
.sc-article-content { font-size:12px; color: var(--c-text-secondary); margin-top:4px; line-height:1.5; }
.sc-article-content.content-deprecated { color: var(--c-text-muted); text-decoration:line-through; }
/* 关联条文里的表格样式（与条文详情页一致） */
.sc-article-content table { width:100%; border-collapse:collapse; border:1px solid var(--c-border-strong); margin:6px 0; }
.sc-article-content th { border:1px solid var(--c-border-strong); padding:4px 6px; font-size:12px; text-align:center; font-weight:var(--fw-bold); background: var(--c-bg-hover); }
.sc-article-content td { border:1px solid var(--c-border-strong); padding:4px 6px; font-size:12px; text-align:center; word-break:break-word; }
.sc-check-btn.na.active { background: var(--c-text-muted); color:#fff; border-color: var(--c-text-muted); }
@media(max-width:600px){ .sc-check-label { display:none; } .sc-check-btn { padding:3px 6px; } }
.sc-more { text-align:center; padding:12px; color: var(--c-text-muted); font-size:13px; }

/* 录入弹窗 */
.sc-form-overlay { position:fixed; inset:0; background:rgba(0,0,0,.5); display:flex; align-items:center; justify-content:center; z-index:1000; padding:16px; }
.sc-form-sheet { background: var(--c-bg-elevated); width:100%; max-width:680px; max-height:90vh; display:flex; flex-direction:column; border-radius:16px; }
.sc-form-header { display:flex; align-items:center; justify-content:space-between; padding:14px 16px; border-bottom:1px solid var(--c-border); }
.sc-form-cancel, .sc-form-submit { font-size:14px; cursor:pointer; }
.sc-form-submit { color: var(--c-info); font-weight:var(--fw-medium); }
.sc-form-submit.disabled { color: var(--c-text-muted); pointer-events:none; }
.sc-form-body { padding:16px; overflow-y:auto; }
.sc-ai-row { margin-top:8px; }
.sc-form-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-top:12px; }
@media(max-width:600px){ .sc-form-grid { grid-template-columns:1fr; } }
/* 弹窗 V2（精致版，2026-08-30 试点编辑项目）——批量推广时给其余弹窗加 v2 类即可 */
.sc-form-overlay.v2 { background: rgba(15,23,42,.44); backdrop-filter: blur(6px) saturate(1.1); -webkit-backdrop-filter: blur(6px) saturate(1.1); }
.sc-form-sheet.v2 { border-radius:20px; border:1px solid rgba(15,23,42,.06); box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 12px 32px rgba(15,23,42,.14), 0 32px 80px rgba(15,23,42,.18); overflow:hidden; max-width:560px; animation: sheetIn .24s cubic-bezier(.2,.8,.2,1); }
@keyframes sheetIn { from { opacity:0; transform: translateY(10px) scale(.97); } to { opacity:1; transform:none; } }
.sc-form-sheet.v2 .sc-form-header { padding:18px 24px; border-bottom:1px solid var(--c-divider); }
.sc-form-sheet.v2 .sc-form-title { font-size:16px; font-weight:var(--fw-semibold); letter-spacing:.2px; color:var(--c-text); }
.sc-form-close { cursor:pointer; color:var(--c-text-muted); font-size:14px; line-height:1; width:32px; height:32px; display:flex; align-items:center; justify-content:center; border-radius:8px; transition:all var(--transition-fast); }
.sc-form-close:hover { background:var(--c-bg-hover); color:var(--c-text); }
.sc-form-sheet.v2 .sc-form-body { padding:24px; }
.sc-form-sheet.v2 .field-label { font-size:13px; font-weight:var(--fw-medium); color:var(--c-text-secondary); margin-bottom:6px; }
.sc-form-sheet.v2 .field-input, .sc-form-sheet.v2 .field-select { border-radius:10px; border:1px solid var(--c-border); padding:9px 12px; font-size:14px; background:var(--c-bg-input); transition:border-color var(--transition-fast), box-shadow var(--transition-fast); }
.sc-form-sheet.v2 .field-input:hover, .sc-form-sheet.v2 .field-select:hover { border-color:var(--c-border-strong); }
.sc-form-sheet.v2 .field-input:focus, .sc-form-sheet.v2 .field-select:focus { outline:none; border-color:var(--c-accent); box-shadow:0 0 0 3px rgba(37,99,235,.12); }
.sc-form-footer { display:flex; justify-content:flex-end; gap:10px; padding:14px 24px; border-top:1px solid var(--c-divider); background:var(--c-bg-subtle); }
.sc-form-footer .btn { min-width:92px; border-radius:10px; font-weight:var(--fw-medium); padding:9px 20px; font-size:var(--fs-sm); }
.sc-form-footer .btn-secondary { background:#fff; border:1px solid var(--c-border); color:var(--c-text-secondary); box-shadow:var(--shadow-sm); }
.sc-form-footer .btn-secondary:hover { background:var(--c-bg-hover); border-color:var(--c-border-strong); }
.sc-form-footer .btn-primary { background:var(--c-accent); box-shadow:0 1px 2px rgba(37,99,235,.35), 0 4px 12px rgba(37,99,235,.28); transition:all var(--transition-fast); }
.sc-form-footer .btn-primary:hover { background:var(--c-accent-hover); transform:translateY(-1px); box-shadow:0 2px 4px rgba(37,99,235,.4), 0 6px 16px rgba(37,99,235,.32); }
.sc-form-footer .btn-primary:active { transform:translateY(0); }
.sc-form-footer .btn.disabled { opacity:.55; pointer-events:none; }

/* ==================== 自定义确认弹窗（替代原生 confirm） ==================== */
.cf-overlay { position:fixed; inset:0; background:rgba(15,23,42,.44); backdrop-filter:blur(6px) saturate(1.1); -webkit-backdrop-filter:blur(6px) saturate(1.1); display:flex; align-items:center; justify-content:center; z-index:1100; padding:16px; animation: fadeIn .15s ease; }
.cf-box { background: var(--c-bg-elevated); width:100%; max-width:400px; border-radius:16px; border:1px solid rgba(15,23,42,.06); padding: var(--space-6); box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 12px 32px rgba(15,23,42,.14), 0 32px 80px rgba(15,23,42,.18); animation: sheetIn .24s cubic-bezier(.2,.8,.2,1); }
.cf-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--c-text); }
.cf-message { margin-top: var(--space-2); font-size: var(--fs-sm); color: var(--c-text-secondary); line-height: 1.6; white-space: pre-wrap; }
.cf-actions { display:flex; justify-content:flex-end; gap: 10px; margin-top: var(--space-6); }
.cf-btn { font-size: var(--fs-sm); font-weight: var(--fw-medium); min-width:92px; padding: 9px 20px; border-radius:10px; cursor:pointer; border:none; transition: all var(--transition-fast); }
.cf-btn-cancel { background: #fff; color: var(--c-text-secondary); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm); }
.cf-btn-cancel:hover { background: var(--c-bg-hover); border-color: var(--c-border-strong); }
.cf-btn-confirm { background: var(--c-accent); color: #fff; border: none; box-shadow: 0 1px 2px rgba(37,99,235,.35), 0 4px 12px rgba(37,99,235,.28); }
.cf-btn-confirm:hover { background: var(--c-accent-hover); transform: translateY(-1px); }
.cf-btn-confirm.danger { background: var(--c-error); box-shadow: 0 1px 2px rgba(220,38,38,.35), 0 4px 12px rgba(220,38,38,.28); }
.cf-btn-confirm.danger:hover { background:#b91c1c; }

/* 关联规范检索区 */
.sc-search-section { background: var(--c-bg-input); border-radius: var(--radius-md); padding:12px; margin-top:12px; }
.sc-search-label-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.sc-selected-count { font-size:12px; color: var(--c-text-muted); padding:4px 0 8px; }
.sc-search-results { margin-top:4px; }
.sc-article-check-row { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.sc-checkbox-wrap { display:flex; align-items:center; gap:8px; cursor:pointer; user-select:none; }
.sc-checkbox-box { width:16px; height:16px; border:1.5px solid var(--c-border-strong); border-radius:3px; position:relative; flex-shrink:0; transition:all .15s; }
.sc-checkbox-box.checked { background: var(--c-info); border-color: var(--c-info); }
.sc-checkbox-box.checked::after { content:''; position:absolute; left:4px; top:1px; width:5px; height:9px; border:solid #fff; border-width:0 2px 2px 0; transform:rotate(45deg); }
.sc-article-code { font-size:13px; font-weight:var(--fw-medium); }
.sc-checkbox { display:none; }


/* ==================== 响应式微调 ==================== */
/* 极小屏（<375px）：导航缩小间距、工具箱保持双列紧凑 */
@media (max-width: 374px) {
  .toolbox-grid { gap: var(--space-3); }
  .toolbox-card { padding: var(--space-4) var(--space-3); }
  .calc-label { min-width: 76px; }
}

@media (max-width: 768px) {
  .calc-step {
    flex-wrap: wrap;
    align-items: baseline;
  }
  .calc-formula {
    flex: 1;
    min-width: 0;
    word-break: break-all;
  }
  .chat-bubble { max-width: 90%; }
  .result-metrics { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .density-input-row { flex-wrap: wrap; }
  .unit-switch { flex-shrink: 0; }
}

/* 桌面端：工具箱双列保留、结果指标双列、报告留白更舒适 */
@media (min-width: 769px) {
  .toolbox-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
  .toolbox-card { padding: var(--space-8) var(--space-6); }
  .report { padding: var(--space-6) var(--space-5); }
}

/* 大屏：工具箱支持 2-3 列自适应 */
@media (min-width: 1100px) {
  .toolbox-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==================== AI 效果图生成 ==================== */
/* 上传区 */
.render-upload-zone {
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--c-bg-input);
}
.render-upload-zone:hover,
.render-upload-zone.drag-over {
  border-color: var(--c-brand);
  background: var(--c-bg-elevated);
}
.render-upload-icon { font-size: 40px; line-height: 1; margin-bottom: var(--space-2); }
.render-upload-text { font-size: var(--fs-sm); color: var(--c-text-muted); }

/* 预览区 */
.render-preview-wrap { display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; }
.render-preview-img {
  max-width: 100%;
  max-height: 360px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* 结果对比 */
.render-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-3) 0;
}
.render-compare-item { display: flex; flex-direction: column; gap: var(--space-2); }
.render-compare-label {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  text-align: center;
  letter-spacing: 0.5px;
}
.render-result-img {
  max-width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: block;
}
.render-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.render-actions .btn { flex: none; }

/* 状态提示独占一行，间距收敛 */
.render-status { margin-bottom: var(--space-3); }

/* ============ 多图融合页（#3 双/三图编辑）============ */
/* 新布局：画布区上部三图横排（multiimg-pair-row），下部结果图（multiimg-result-slot）
   内容限宽 760px 居中，与效果图 render-pair / 局部重绘 inpaint-canvas-wrap 统一 */
.multiimg-canvas-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.multiimg-pair-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.multiimg-result-slot { display: flex; flex-direction: column; gap: var(--space-1); align-items: center; }
.multiimg-result-slot .render-pair-img { max-width: 640px; }
.multiimg-result-slot .render-actions { justify-content: center; }
.multiimg-slot {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.multiimg-slot-label {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.multiimg-slot-label .multiimg-tag {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--c-brand);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.multiimg-slot-label .multiimg-optional {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  opacity: 0.7;
}
/* 可选位标签上的 ✕ 清除按钮（已填时显示） */
.multiimg-clear-x {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--c-text-muted);
  font-size: 13px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.multiimg-clear-x:hover { color: var(--c-danger, #d93025); background: rgba(217, 48, 37, 0.08); }
.multiimg-upload-zone {
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-1);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--c-bg-input);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.multiimg-upload-zone:hover,
.multiimg-upload-zone.drag-over {
  border-color: var(--c-brand);
  background: var(--c-bg-elevated);
}
.multiimg-upload-zone.filled {
  padding: 0;
  border-style: solid;
  border-color: var(--c-border);
  cursor: pointer;  /* 已填态点击=替换图片（与效果图页原图一致），保持手型 */
}
.multiimg-preview-img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: var(--radius);
  display: block;
  cursor: pointer;
}
/* 重选/清除按钮行已移除（点击图即替换；可选位用标签 ✕ 清除） */
.multiimg-count-hint {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  margin-top: var(--space-2);
}
.multiimg-count-hint.ready { color: var(--c-success, #2e7d32); }
@media (max-width: 640px) {
  .multiimg-pair-row { grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
}
.render-status:empty { margin-bottom: 0; }

/* 手机端：对比图改单列 */
@media (max-width: 600px) {
  .render-compare { grid-template-columns: 1fr; }
}

/* ==================== AI 局部重绘 ==================== */
.inpaint-canvas-wrap { display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; width: 100%; }
/* 添加调整区域按钮：与图片留出间距、居中、弱化为浅色虚线感 */
.inpaint-edit-range-btn {
  align-self: center;
  margin-top: var(--space-2);
}
.inpaint-canvas-container {
  position: relative;
  width: 100%;      /* 与效果图页 render-pair 半栏同宽（约 360px），canvas 内部 width:100% 自动铺满 */
  max-width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  line-height: 0;
}
.inpaint-canvas {
  display: block;
  width: 100%;
  height: auto;
}
.inpaint-draw-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;      /* 铺满容器（页面预览态）；全屏模式 JS 会内联覆盖尺寸 */
  height: auto;
  cursor: pointer;  /* 页面态点击=替换图片，与效果图页一致；全屏态由 overlay 覆盖为 crosshair */
  touch-action: none;
}
.inpaint-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  width: 100%;
}
.inpaint-tool-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}
.inpaint-range {
  width: 120px;
  cursor: pointer;
}
.inpaint-brush-val {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  min-width: 24px;
  text-align: center;
}
.inpaint-hint {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  text-align: center;
  width: 100%;
}

/* 全屏涂抹模式：黑色遮罩 + 缩放/平移/涂抹画板 */
.inpaint-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
}
.inpaint-fullscreen-canvas-container {
  position: relative;
  line-height: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.inpaint-fullscreen-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 14px;
  background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
  cursor: default;
  z-index: 10;
}
.inpaint-fullscreen-info {
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--fs-xs);
  user-select: none;
}
.inpaint-fullscreen-close {
  margin-left: auto;
  cursor: pointer;
}
/* 全屏顶栏内的笔刷控件（深色底上保证可见） */
.inpaint-fs-tool.inpaint-tool-label {
  color: rgba(255, 255, 255, 0.85);
  cursor: default;
}
.inpaint-fs-tool .inpaint-brush-val {
  color: rgba(255, 255, 255, 0.85);
}
.inpaint-fullscreen-topbar > .inpaint-fullscreen-info:first-of-type {
  margin-left: auto; /* 操作提示推到右侧，工具在左 */
}
/* 笔刷圆圈光标（全屏涂抹模式） */
.inpaint-brush-cursor {
  position: fixed;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  outline: 1px solid rgba(0, 0, 0, 0.5); /* 白圈加深色描边，任何底色上可见 */
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  display: none;
  transform: translate(0, 0);
}

/* ===== AI 出图工作室布局（左参数面板 + 右大画板） ===== */
.studio-layout {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
}
/* 左侧参数面板 */
.studio-sidebar {
  flex: 0 0 320px;
  min-width: 280px;
  max-width: 360px;
  position: sticky;
  top: calc(var(--nav-height) + var(--space-4));
  max-height: calc(100vh - var(--nav-height) - var(--space-8));
  overflow-y: auto;
  padding-right: var(--space-2);
  margin-right: var(--space-2);
}
/* 参数面板内卡片去框，视觉更轻 */
.studio-sidebar .card {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.studio-sidebar .card:last-child { margin-bottom: 0; }
/* 生成按钮全宽 */
.studio-sidebar .btn-row {
  justify-content: stretch;
}
.studio-sidebar .btn-row .btn {
  width: 100%;
  justify-content: center;
}
/* 生成按钮置顶固定（在 sidebar 滚动容器内吸顶） */
.studio-submit-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: var(--space-2);
}
/* 右侧主画板区 */
.studio-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
/* 主画板卡片：承载状态/结果/操作/历史 */
.studio-canvas {
  flex: 1;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
/* 结果对比居中展示 */
.studio-canvas .render-compare {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
/* 操作栏居中 */
.studio-canvas .render-actions {
  justify-content: center;
}
/* inpaint 画布居中 */
.studio-canvas .inpaint-canvas-wrap {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
/* multi-img 上传位已移入画布区（multiimg-pair-row 三列），无侧栏网格规则 */
/* 历史缩略图条 */
.studio-history {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-2) var(--space-1);
  border-top: 1px solid var(--c-divider);
  min-height: 72px;
  align-items: center;
}
.studio-history:empty {
  display: none;
}
.studio-history-label {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.history-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.history-thumb:hover { transform: scale(1.08); }
.history-thumb.active { border-color: var(--c-accent); }
/* 空画板占位 */
.studio-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  padding: var(--space-6);
  text-align: center;
}
.studio-empty-icon { font-size: 48px; opacity: 0.4; }

/* ===== 原图|AI图 并排展示（ai-render） ===== */
.render-stage { display: flex; flex-direction: column; gap: var(--space-3); }
.render-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.render-pair-item { display: flex; flex-direction: column; gap: var(--space-1); }
.render-pair-label {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  text-align: center;
}
.render-pair-img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
.render-pair-img.clickable { cursor: zoom-in; }
/* 生成中占位（高度与左侧原图对齐：由 JS 在注入时按原图实际高度设定） */
.render-slot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  background: var(--c-bg-subtle);
  border-radius: var(--radius);
}
/* 图片放大 modal */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.image-modal img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* 响应式：<900px 单列堆叠 */
@media (max-width: 900px) {
  .studio-layout { flex-direction: column; }
  .studio-sidebar {
    position: static;
    max-height: none;
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding-right: 0;
    margin-right: 0;
  }
}
/* render-pair 小屏单列 */
@media (max-width: 600px) {
  .render-pair { grid-template-columns: 1fr; }
}

/* ==================== 项目管理 ==================== */

/* 项目卡片（左侧色条 + 主体） */
.proj-list { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); }
.proj-card {
  display: flex; background: var(--c-bg-elevated); border: 1px solid var(--c-border);
  border-radius: var(--radius-md); overflow: hidden; cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.proj-card:hover { box-shadow: var(--shadow-sm); border-color: var(--c-accent-border); }
.proj-card-accent { width: 4px; flex-shrink: 0; }
.proj-card-body { flex: 1; padding: var(--space-3) var(--space-4); min-width: 0; }
.proj-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.proj-card-name { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--c-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-del-btn { color: var(--c-text-muted); cursor: pointer; font-size: var(--fs-sm); padding: 2px 6px; border-radius: var(--radius-sm); flex-shrink: 0; }
.proj-del-btn:hover { background: var(--c-error-bg); color: var(--c-error); }
.proj-card-meta { font-size: var(--fs-xs); color: var(--c-text-muted); margin-top: 2px; }
.proj-card-line { font-size: var(--fs-sm); color: var(--c-text-secondary); margin-top: var(--space-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-card-desc { color: var(--c-text-muted); }
.proj-card-actions { margin-top: var(--space-2); }

/* 详情页 Tab 栏 */
.proj-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-divider); margin-top: var(--space-4); }
.proj-tab { padding: var(--space-2) var(--space-4); font-size: var(--fs-sm); color: var(--c-text-secondary); cursor: pointer; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.proj-tab:hover { color: var(--c-text); }
.proj-tab.active { color: var(--c-accent); border-bottom-color: var(--c-accent); font-weight: var(--fw-semibold); }

/* 详情页头部 */
.proj-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.proj-detail-title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--c-text); }
.proj-role-badge { font-size: var(--fs-xs); padding: 2px 8px; border-radius: var(--radius-full); background: var(--c-accent-soft); color: var(--c-accent); }
.proj-info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-2) var(--space-4); margin-top: var(--space-3); }
.proj-info-row { display: flex; gap: var(--space-2); font-size: var(--fs-sm); }
.proj-info-label { color: var(--c-text-muted); flex-shrink: 0; min-width: 5em; }
.proj-info-value { color: var(--c-text-secondary); }

/* 成员列表 */
.proj-member-list { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.proj-member-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--c-border); border-radius: var(--radius-md); }
.proj-member-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--c-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: var(--fs-sm); font-weight: var(--fw-semibold); flex-shrink: 0; }
.proj-member-name { font-size: var(--fs-sm); color: var(--c-text); flex: 1; }
.proj-member-role { font-size: var(--fs-xs); color: var(--c-text-muted); }
.proj-member-role.owner { color: var(--c-accent); }

/* 文档/资料：淡蓝底色上传条（与白底文档卡片区分） */
.doc-upload-zone { display: flex; align-items: center; gap: var(--space-2); background: var(--c-accent-soft); border-radius: var(--radius-md); padding: 10px var(--space-3); cursor: pointer; transition: background .15s, box-shadow .15s; }
.doc-upload-zone:hover { box-shadow: inset 0 0 0 1.5px var(--c-accent); }
.doc-upload-zone.disabled { opacity: .5; cursor: not-allowed; }
.doc-upload-icon { font-size: 16px; line-height: 1; flex-shrink: 0; color: var(--c-accent); }
.doc-upload-main { font-size: var(--fs-sm); color: var(--c-accent); font-weight: var(--fw-medium, 500); white-space: nowrap; }
.doc-upload-hint { font-size: var(--fs-xs); color: var(--c-text-muted); margin-left: auto; white-space: nowrap; }
/* docx/dxf 两个上传区并排 */
.doc-upload-row { display: flex; gap: var(--space-3); margin-bottom: var(--space-3); }
.doc-upload-row .doc-upload-zone { flex: 1; }
@media (max-width: 600px) { .doc-upload-row { flex-direction: column; } }
/* 文件类型标识 */
.doc-type-tag { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: var(--radius-sm); flex-shrink: 0; letter-spacing: 0.5px; }
.doc-type-dxf { background: #e0f2fe; color: #0369a1; }
.doc-type-docx { background: #fef3c7; color: #92400e; }
.doc-type-xlsx { background: #dcfce7; color: #166534; }
.doc-list { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.doc-card { border: 1px solid var(--c-border); border-radius: var(--radius-md); overflow: hidden; }
.doc-card-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); cursor: pointer; }
.doc-card-head:hover { background: var(--c-bg-hover); }
.doc-card-name { font-size: var(--fs-sm); color: var(--c-text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-status-tag { font-size: var(--fs-xs); padding: 2px 8px; border-radius: var(--radius-full); flex-shrink: 0; }
.doc-status-pending { background: var(--c-bg-subtle); color: var(--c-text-muted); }
.doc-status-parsing { background: var(--c-warning-bg); color: var(--c-warning); }
.doc-status-done { background: var(--c-success-bg); color: var(--c-success); }
.doc-status-noplan { background: var(--c-warning-bg); color: var(--c-warning); }
.doc-status-failed { background: var(--c-error-bg); color: var(--c-error); }
.doc-card-meta { font-size: var(--fs-xs); color: var(--c-text-muted); display: flex; gap: var(--space-3); flex-wrap: wrap; }
.doc-card-body { padding: 0 var(--space-3) var(--space-3); }
/* 解析中：状态标签内的迷你 spinner */
.doc-status-tag .doc-parse-spin { display: inline-block; width: 10px; height: 10px; margin-right: 4px; vertical-align: -1px; border: 1.5px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
/* 解析中：body 区的 loading 提示 */
.doc-parse-loading { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-2); color: var(--c-text-muted); font-size: var(--fs-sm); }
.doc-section { border-left: 2px solid var(--c-divider); padding-left: var(--space-3); margin: var(--space-2) 0; }
.doc-section-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-text); }
.doc-section-code { font-size: var(--fs-xs); color: var(--c-accent); margin-right: var(--space-2); }
.doc-section-content { font-size: var(--fs-sm); color: var(--c-text-secondary); line-height: 1.6; margin-top: var(--space-1); }
.doc-section-content img { max-width: 100%; border-radius: var(--radius-sm); margin: var(--space-1) 0; }
/* 文档章节内表格（云函数 normalizeTable 产出的规整表格）
   外框画在外层容器上：border-collapse:collapse 下 table 自身边框会被单元格边框合并吞掉且圆角失效 */
.doc-section-content .doc-table-wrap { border: 1px solid var(--c-border-strong); overflow-x: auto; margin: var(--space-2) 0; }
.doc-section-content .doc-table-wrap table { width: 100%; border-collapse: collapse; }
.doc-section-content .doc-table-wrap table th { border: 1px solid var(--c-border-strong); padding: var(--space-1) var(--space-2); font-size: var(--fs-xs); text-align: center; font-weight: var(--fw-bold); background: var(--c-bg-hover); }
.doc-section-content .doc-table-wrap table td { border: 1px solid var(--c-border-strong); padding: var(--space-1) var(--space-2); font-size: var(--fs-xs); text-align: center; word-break: break-word; }
/* CAD 表格：数据量大（门窗1131/墙体2510），限高 60vh 滚动 + 表头吸顶 */
.doc-section-content .doc-table-wrap:has(table.cad-table) { max-height: 60vh; overflow: auto; }
.doc-section-content .doc-table-wrap table.cad-table thead th { position: sticky; top: 0; z-index: 1; background: var(--c-bg-hover); }
.doc-section-content .doc-table-wrap table.cad-table td:nth-child(1) { text-align: left; }

/* 笔记 */
.note-list { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-3); }
.note-card { border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: var(--space-3); }
.note-card.highlight { border-color: var(--c-warning); box-shadow: 0 0 0 3px var(--c-warning-bg); }
.note-card-head { display: flex; align-items: center; gap: var(--space-2); float: right; margin-left: var(--space-2); }
.note-title { font-size: var(--fs-base); color: var(--c-text); font-weight: var(--fw-medium); margin-bottom: var(--space-1); line-height: 1.5; }
.note-text { font-size: var(--fs-sm); color: var(--c-text-secondary); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.note-author-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--c-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: var(--fs-xs); flex-shrink: 0; }
.note-author { font-size: var(--fs-sm); color: var(--c-text); font-weight: var(--fw-medium); }
.note-time { font-size: var(--fs-xs); color: var(--c-text-muted); margin-left: auto; }
.note-card-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); margin-top: var(--space-2); flex-wrap: wrap; clear: both; }
.note-meta { display: flex; align-items: center; gap: var(--space-1); font-size: var(--fs-xs); color: var(--c-text-muted); flex-shrink: 0; }
.note-meta .note-author-avatar { width: 18px; height: 18px; font-size: 10px; }
.note-meta .note-author { font-size: var(--fs-xs); color: var(--c-text-muted); font-weight: var(--fw-normal); }
.note-meta .note-time { margin-left: 0; }
.note-img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: var(--space-2); margin-top: var(--space-2); }
.note-img-thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; }
.note-img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.note-img-thumb.lg { aspect-ratio: auto; }
.note-img-add { aspect-ratio: 1; border: 2px dashed var(--c-border-strong); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--c-text-muted); font-size: var(--fs-sm); }
.note-img-add:hover { border-color: var(--c-accent); color: var(--c-accent); }
.note-img-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; cursor: pointer; }

/* 活动日志时间线 */
.activity-timeline { position: relative; margin-top: var(--space-3); }
.activity-item { position: relative; padding: var(--space-1) 0 var(--space-3) calc(var(--space-4) + 4px); }
.activity-item::before { content: ''; position: absolute; left: 2px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--c-text-muted); border: 2px solid var(--c-bg-elevated); }
.activity-item.dot-green::before { background: var(--c-success); }
.activity-item.dot-blue::before { background: var(--c-accent); }
.activity-item.dot-red::before { background: var(--c-error); }
.activity-item.dot-gray::before { background: var(--c-text-muted); }
.activity-text { font-size: var(--fs-sm); color: var(--c-text-secondary); }
.activity-text b { color: var(--c-text); font-weight: var(--fw-medium); }
.activity-time { font-size: var(--fs-xs); color: var(--c-text-muted); }

/* 添加成员弹窗输入 */
.proj-add-member-row { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.proj-add-member-row .field-input { flex: 1; }

/* ==================== 设置页 - 分组标题 ==================== */
.settings-group { margin-top: var(--space-5); }
.settings-group:first-of-type { margin-top: var(--space-2); }
.settings-group-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-text-muted); margin-bottom: var(--space-3); padding-left: 2px; letter-spacing: 0.3px; }
.settings-group .card + .card { margin-top: var(--space-3); }

/* ==================== 设置页 - 上传设计标准（演示占位弹窗） ==================== */
.zxw-modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 999; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.zxw-modal { background: var(--c-bg-elevated); border-radius: var(--radius-lg, 12px); width: min(480px, 100%); padding: var(--space-5); box-shadow: var(--shadow-lg, 0 20px 60px rgba(0,0,0,.2)); }
.zxw-modal-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--c-text); margin-bottom: var(--space-2); }
.zxw-modal-desc { font-size: var(--fs-sm); color: var(--c-text-muted); line-height: 1.7; margin-bottom: var(--space-4); }
.zxw-file-box { border: 1.5px dashed var(--c-border-strong); border-radius: var(--radius-md); padding: var(--space-4) var(--space-3); text-align: center; cursor: pointer; font-size: var(--fs-sm); color: var(--c-text-secondary); margin-bottom: var(--space-1); transition: border-color .15s, background .15s; }
.zxw-file-box:hover { border-color: var(--c-accent); background: var(--c-bg-hover); }
.zxw-file-name { font-size: var(--fs-xs); color: var(--c-accent); text-align: center; min-height: 18px; margin-bottom: var(--space-3); word-break: break-all; }
.zxw-modal-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }

/* ==================== AI 问答 - 规则确认卡 ==================== */
.rule-confirm-card { margin-top: var(--space-2); border: 1px solid var(--c-accent-border); background: var(--c-accent-soft); border-radius: var(--radius-md); padding: var(--space-3); font-size: var(--fs-sm); }
.rule-confirm-head { color: var(--c-accent); font-weight: var(--fw-medium); margin-bottom: var(--space-2); }
.rule-confirm-body { color: var(--c-text); line-height: 1.6; margin-bottom: var(--space-2); }
.rule-confirm-body .tag { margin-left: var(--space-2); vertical-align: middle; }
.rule-confirm-actions { display: flex; gap: var(--space-2); }
/* 已保存提示统一用 note-saved-tip（正常字体，仅保留间距），不再做小号/变色处理 */
/* 笔记确认卡（速记）：复用规则确认卡骨架，标题/标签/正文预览/规则类提示 */
.note-confirm-title { font-weight: var(--fw-medium); margin-bottom: var(--space-1); }
.note-confirm-title .tag { margin-left: var(--space-2); vertical-align: middle; }
.note-confirm-body { color: var(--c-text); line-height: 1.6; margin-bottom: var(--space-2); max-height: 180px; overflow-y: auto; }
.note-confirm-hint { margin-bottom: var(--space-2); font-size: var(--fs-xs); color: var(--c-warning); }
/* 笔记相关规范 chips 行 + 笔记标签/筛选（速记 v2） */
.note-confirm-regs { margin-bottom: var(--space-2); font-size: var(--fs-xs); color: var(--c-text-secondary); }
.note-confirm-regs .tag { margin-left: var(--space-1); }
.note-confirm-similar { margin-bottom: var(--space-2); padding: var(--space-2); border-radius: var(--radius-sm); background: var(--c-warning-bg); font-size: var(--fs-xs); color: var(--c-text); line-height: 1.6; }
/* 作废笔记：置灰 + 删除线 + 徽标 */
.note-card.voided { opacity: 0.62; }
.note-card.voided .note-text { text-decoration: line-through; }
.note-voided-badge { padding: 1px 8px; border-radius: 999px; background: var(--c-bg-elevated); border: 1px solid var(--c-border-strong); color: var(--c-text-muted); font-size: var(--fs-xs); margin-left: var(--space-1); }
.note-confirm-actions { flex-wrap: wrap; }
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-2); }
/* 笔记标签药丸样式：与正文明确区分（浅底+描边+主题色） */
.note-tags .tag { background: var(--c-accent-soft); color: var(--c-accent); border: 1px solid transparent; border-radius: 999px; padding: 1px 10px; line-height: 1.6; }
.note-filter-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--space-3) 0; }
.note-filter-chip { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--c-border-strong); font-size: var(--fs-xs); color: var(--c-text-secondary); cursor: pointer; user-select: none; }
.note-filter-chip:hover { color: var(--c-accent); border-color: var(--c-accent); }
.note-filter-chip.active { background: var(--c-accent-soft); color: var(--c-accent); border-color: var(--c-accent); }
/* 笔记已保存提示：正常字体，不做小号/变色处理 */
.note-saved-tip { margin-top: var(--space-2); }
/* 笔记卡片"作废"按钮（编辑/删除旁；按钮样式防与状态标签歧义；已作废的不显示） */
.note-void-btn { font-size: var(--fs-xs); color: var(--c-text-secondary); background: var(--c-bg-elevated); border: 1px solid var(--c-border-strong); border-radius: 999px; padding: 1px 10px; cursor: pointer; user-select: none; transition: all var(--transition-fast); }
.note-void-btn:hover { color: var(--c-warning); border-color: var(--c-warning); }

/* 设置页规则操作按钮：带边框的轻量按钮（btn-ghost 视觉上像纯文字） */
.rule-op-btn { font-size: var(--fs-xs); padding: 3px 10px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); background: var(--c-bg-elevated); color: var(--c-text-secondary); cursor: pointer; line-height: 1.6; transition: border-color .15s, color .15s, background .15s; }
.rule-op-btn:hover { border-color: var(--c-accent); color: var(--c-accent); background: var(--c-accent-soft); }
.rule-op-btn.danger { color: var(--c-error); }
.rule-op-btn.danger:hover { border-color: var(--c-error); color: var(--c-error); background: var(--c-error-bg); }

/* ==================== 登录页（居中极简，2026-09 用户系统） ==================== */
/* 风格基准：OpenAI/Notion 一路的极限克制——品牌行+一句口号+二维码+一行小字，大量留白 */
/* 全屏模式：隐藏导航/侧栏，内容铺满视口（login 页 render 时给 body 加 login-full） */
body.login-full { padding-left: 0 !important; overflow: hidden; }
body.login-full .top-nav,
body.login-full .sidebar { display: none; }
body.login-full #content { padding: 0; min-height: 100vh; }

.login-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* 安静底色：近白底 + 极淡纵向渐变（用户手调参数，无网格无光晕） */
  background: linear-gradient(180deg, #fbfcfe 0%, #f6f7f9 100%);
  padding: 40px 24px;
}
.login-box { display: flex; flex-direction: column; align-items: center; }

/* 品牌行（LOGO 放浅色背景——橙色标志在深色底上效果不佳，2026-09-04 用户口径） */
.login-brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 30px;
}
.login-logo-img { width: 42px; height: auto; display: block; }
.login-brand-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: 0.08em;
}

/* 口号：两行居中，尺寸收敛（极简版式） */
.login-headline {
  font-size: 26px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: 0.01em;
  text-align: center;
  margin: 0 0 10px;
}
.login-sub {
  font-size: 13px;
  color: var(--c-text-muted);
  margin: 0 0 30px;
  letter-spacing: 0.04em;
}
.login-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text);
}
.login-qr-card {
  width: 268px;
  max-width: calc(100vw - 40px);
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 16px 14px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 8px 24px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-qr-holder {
  width: 232px;
  min-height: 232px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
}
.login-qr-holder.mounted { min-height: 0; }
.login-qr-holder iframe { display: block; }
.login-qr-loading { color: var(--c-text-muted); }
.login-err {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--c-error);
  background: var(--c-error-bg);
  border-radius: 8px;
  padding: 8px 14px;
  max-width: calc(100vw - 40px);
}
.login-dev { margin-top: 14px; width: 100%; }
.login-dev summary {
  font-size: 12px;
  color: var(--c-text-muted);
  cursor: pointer;
  text-align: center;
  padding: 4px 0;
  user-select: none;
}
.login-foot {
  margin-top: 16px;
  font-size: 12px;
  color: var(--c-text-muted);
  letter-spacing: 0.01em;
}
.login-copy-right {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--c-text-muted);
}

/* ---- 票据落地/错误态（同底色单栏居中） ---- */
.login-hero-single {
  background: linear-gradient(180deg, #fbfcfe 0%, #f6f7f9 100%);
}
.login-single-box { display: flex; flex-direction: column; align-items: center; }
.login-single-text {
  margin-top: 16px;
  font-size: 14px;
  color: var(--c-text-secondary);
}

/* ============================================================
 * 图纸标准页（cp-*）：对标 Linear/Stripe 的设置页设计系统
 * 库视图/详情钻取互斥；表单 = 头部工具条 + 分组卡片 + 键行网格
 * ============================================================ */

/* ---- 表单卡片与头部工具条 ---- */
.cp-form { padding: 0; overflow: hidden; }
.cp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 14px 20px;
  background: var(--c-bg-subtle);
  border-bottom: 1px solid var(--c-border);
}
.cp-head-kicker { font-size: 11px; color: var(--c-text-muted); letter-spacing: 0.5px; margin-bottom: 3px; }
.cp-head-main { min-width: 0; flex: 1 1 320px; }
.cp-crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--c-accent);
  cursor: pointer;
  margin-bottom: 6px;
  user-select: none;
}
.cp-crumb:hover { text-decoration: underline; }
.cp-head-title { font-size: 15px; font-weight: var(--fw-semibold); color: var(--c-text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cp-head-title b { font-weight: var(--fw-semibold); }
.cp-head-sub { font-size: 11.5px; color: #64748b; font-weight: 400; }
.cp-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.cp-head-sep { width: 1px; height: 20px; background: var(--c-border-strong); margin: 0 4px; }
.cp-form-name {
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  width: 220px;
  font-size: 12.5px;
  background: var(--c-bg-input);
  color: var(--c-text);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.cp-form-name:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.cp-form-name::placeholder { color: var(--c-text-muted); }

/* ---- 分组卡片（details 折叠段）---- */
.cp-form-body { padding: 0 20px 16px; }
.cp-sec { border-top: 1px solid var(--c-divider); }
.cp-form-body > .cp-sec:first-child { border-top: none; }
.cp-sec > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0 10px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.cp-sec > summary::-webkit-details-marker { display: none; }
.cp-sec-chevron { display: inline-flex; color: #64748b; transition: transform .15s; flex-shrink: 0; }
.cp-sec[open] > summary .cp-sec-chevron { transform: rotate(90deg); }
.cp-sec-title { font-size: 13.5px; font-weight: var(--fw-semibold); color: var(--c-text); }
.cp-sec-count {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  color: var(--c-text-muted);
  background: var(--c-bg-subtle);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  padding: 1px 8px;
  white-space: nowrap;
}
.cp-sec-hint { font-size: 11px; color: #64748b; margin-left: auto; }
.cp-sec-intro { font-size: 11.5px; color: #64748b; line-height: 1.6; padding: 0 0 8px 20px; max-width: 640px; }
.cp-sec--adv .cp-sec-title, .cp-sec--red .cp-sec-title { color: var(--c-text-secondary); }

/* ---- 键行网格：左标签右控件 ---- */
.cp-rows { padding-bottom: 4px; }
.cp-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 6px 20px;
  padding: 8px 0 10px;
  border-top: 1px solid var(--c-divider);
}
.cp-rows .cp-row:first-child { border-top: none; }
.cp-row-name { font-size: 13px; font-weight: var(--fw-medium); color: var(--c-text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cp-row-desc { font-size: 11.5px; color: #64748b; line-height: 1.55; margin-top: 4px; }
.cp-row-ctrl { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.cp-key-reset {
  opacity: 0;
  color: var(--c-text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: opacity .12s, color .12s;
  padding: 0 2px;
}
.cp-row:hover .cp-key-reset { opacity: 1; }
.cp-key-reset:hover { color: var(--c-accent); }

/* ---- 徽章（识别 / 已设 / 全局生效中）---- */
.cp-pill {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  font-size: 10.5px;
  line-height: 17px;
  padding: 0 7px;
  border-radius: var(--radius-full);
  border: 1px solid var(--c-border);
  color: var(--c-text-secondary);
  background: var(--c-bg-subtle);
  white-space: nowrap;
  cursor: default;
}
.cp-pill--sniff { color: var(--c-info); background: var(--c-info-bg); border-color: #bfdbfe; }
.cp-pill--warn { color: #b45309; background: var(--c-warning-bg); border-color: #fde68a; }
.cp-pill--set { color: var(--c-warning); background: var(--c-warning-bg); border-color: #fde68a; }
.cp-pill--active { color: var(--c-success); background: var(--c-success-bg); border-color: #bbf7d0; }

/* ---- 输入控件 ---- */
.cp-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: inherit;
  background: var(--c-bg-input);
  color: var(--c-text);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.cp-input:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.cp-input--mono { font-family: var(--font-mono); font-size: 12px; }

/* 组行（模式分组 + 值标签）与名单键锁定组 */
.cp-conds .cp-cond-row--grp { align-items: flex-start; }
.cp-cond-row--grp .cp-cond-del { height: 24px; display: inline-flex; align-items: center; }
.cp-cond-row--raw { align-items: center; }
.cp-cond-mode--lock {
  width: 72px;
  height: 24px;
  line-height: 24px;
  color: var(--c-text-muted);
  font-size: 12px;
  cursor: default;
  text-align: left;
}
.cp-grp {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.cp-gv {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  padding: 0 4px 0 8px;
  border-radius: var(--radius-full);
  background: var(--c-info-bg);
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 12px;
  line-height: 18px;
  max-width: 280px;
  overflow: hidden;
}
.cp-gv-w { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-gv-x {
  cursor: pointer;
  color: #93b4f0;
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  margin-left: 2px;
  border-radius: 50%;
  opacity: 0;
  transition: color .12s, background .12s, opacity .12s;
}
.cp-gv:hover .cp-gv-x { opacity: 1; }
.cp-gv-x:hover { color: var(--c-error); background: var(--c-error-bg); }
.cp-gv-add {
  flex: 1;
  min-width: 140px;
  border: none;
  outline: none;
  font-size: 12px;
  font-family: inherit;
  padding: 4px 0;
  background: transparent;
  color: var(--c-text);
}
.cp-gv-add::placeholder { color: var(--c-text-muted); }

/* ---- 试匹配 ---- */
.cp-try-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  margin-top: 0;
  transition: max-height .16s ease, opacity .12s ease;
}
.cp-row:hover .cp-try-row, .cp-row:focus-within .cp-try-row { max-height: 34px; opacity: 1; pointer-events: auto; }
.cp-try {
  flex: 0 1 340px;
  padding: 3px 10px;
  border: 1px dashed #94a3b8;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-family: inherit;
  background: var(--c-bg-subtle);
  color: var(--c-text-secondary);
  outline: none;
  transition: border-color .12s, background .12s;
}
.cp-try::placeholder { color: var(--c-text-muted); }
.cp-try:focus { border-color: var(--c-accent); border-style: solid; background: var(--c-bg-input); }
.cp-try-out { font-size: 11.5px; font-weight: var(--fw-medium); white-space: nowrap; }

/* ---- 条件构造器（模式键编辑：匹配方式+字面词，用户零正则）---- */
.cp-conds {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-bg-input);
  transition: border-color .12s, box-shadow .12s;
}
.cp-conds:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.cp-cond-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cp-cond-mode {
  flex-shrink: 0;
  width: 72px;
  height: 24px;
  line-height: 24px;
  padding: 0 12px 0 8px;
  border: none;
  border-radius: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  color: var(--c-text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  transition: color .12s;
}
.cp-cond-mode:hover { color: var(--c-accent); }
.cp-cond-mode--raw {
  width: 72px;
  height: 24px;
  line-height: 24px;
  font-size: 11px;
  color: var(--c-text-muted);
  cursor: help;
  text-align: left;
}
.cp-cond-text {
  flex: 1;
  min-width: 0;
  padding: 5px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: inherit;
  background: var(--c-bg-input);
  color: var(--c-text);
  outline: none;
  transition: border-color .12s;
}
.cp-cond-text:focus { border-color: var(--c-accent); }
.cp-cond-text::placeholder { color: var(--c-text-muted); }
.cp-cond-row--raw .cp-cond-text { background: var(--c-bg-subtle); color: var(--c-text-secondary); }
.cp-cond-del {
  flex-shrink: 0;
  cursor: pointer;
  color: var(--c-text-muted);
  font-size: 15px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 50%;
  opacity: 0;
  transition: color .12s, background .12s, opacity .12s;
}
.cp-cond-row:hover .cp-cond-del, .cp-cond-row--raw .cp-cond-del { opacity: 1; }
.cp-cond-del:hover { color: var(--c-error); background: var(--c-error-bg); }
.cp-gv-addpill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--radius-full);
  color: var(--c-text-muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .12s, border-color .12s;
  user-select: none;
}
.cp-gv-addpill:hover { color: var(--c-accent); border-color: var(--c-accent); }
.cp-gv-add {
  flex: 0 1 220px;
  min-width: 130px;
  height: 24px;
  border: none;
  border-bottom: 1px dashed var(--c-border-strong);
  outline: none;
  font-size: 12px;
  font-family: inherit;
  padding: 0 2px;
  background: transparent;
  color: var(--c-text);
}
.cp-gv-add:focus { border-bottom-color: var(--c-accent); }
.cp-gv-add::placeholder { color: var(--c-text-muted); }
.cp-gv-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 20px;
  font-size: 10.5px;
  line-height: 1;
  color: var(--c-accent);
  background: var(--c-accent-soft);
  border-radius: var(--radius-full);
  padding: 0 8px;
  cursor: pointer;
  user-select: none;
}
.cp-gv-num:hover { background: #dbeafe; }
.cp-cond-addgrp {
  align-self: flex-start;
  font-size: 11px;
  color: var(--c-text-muted);
  cursor: pointer;
  padding: 0 4px;
  margin: 2px 0 0 78px;
  user-select: none;
  transition: color .12s;
}
.cp-cond-addgrp:hover { color: var(--c-accent); }

/* ---- 高级设置分组小标题 ---- */
.cp-adv-group { padding: 2px 0 6px; }
.cp-adv-group-title { font-size: 12px; font-weight: var(--fw-semibold); color: var(--c-text-secondary); padding: 10px 0 4px; }

/* ---- 算法参数（只读，仅管理员渲染）---- */
.cp-red-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 2px 0 10px; }
.cp-red-card { background: var(--c-bg-subtle); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 12px 14px; }
.cp-red-title { font-size: 12px; font-weight: var(--fw-semibold); color: var(--c-text-secondary); margin-bottom: 6px; }
.cp-red-kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; font-size: 11.5px; }
.cp-red-kv span { color: var(--c-text-muted); white-space: nowrap; }
.cp-red-kv code { font-family: var(--font-mono); font-size: 11px; color: var(--c-text-secondary); word-break: break-all; text-align: right; }

/* ---- 标准列表（库视图）---- */
.cp-std-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  margin-bottom: 8px;
  background: var(--c-bg-elevated);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.cp-std-item:hover { border-color: var(--c-border-strong); box-shadow: var(--shadow-sm); }
.cp-std-item.is-active { border-color: #bbf7d0; box-shadow: inset 2px 0 0 var(--c-success); }
.cp-std-item-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.cp-std-name { font-size: 13.5px; font-weight: var(--fw-semibold); color: var(--c-text); }
.cp-std-item-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cp-std-go { display: inline-flex; color: var(--c-text-muted); transition: color .12s, transform .12s; }
.cp-std-item:hover .cp-std-go { color: var(--c-accent); transform: translateX(2px); }

/* ---- 窄屏：键行上下堆叠 ---- */
@media (max-width: 680px) {
  .cp-row { grid-template-columns: 1fr; gap: 6px; }
  .cp-head { padding: 12px 14px; }
  .cp-form-body { padding: 0 14px 12px; }
}
