:root {
  /* 让浏览器原生 UI（滚动条、下拉箭头、自动填充背景）跟随当前主题 */
  color-scheme: light;
  --color-primary: #2563EB;
  --color-primary-hover: #1D4ED8;
  --color-primary-light: #DBEAFE;
  /* 链接/强调文字色：与按钮背景色分开。按钮要"深"（白字可读），
     链接文字在浅蓝底上要"更深"才达 AA。之前共用 primary 导致对比度仅 4.24。 */
  --color-link: #1D4ED8;
  --color-bg: #FFFFFF;
  --color-surface: #F8FAFC;
  --color-surface-hover: #F1F5F9;
  --color-border: #E2E8F0;
  --color-border-focus: #93C5FD;
  --color-text: #1E293B;
  /* 次级/弱化文字：已按 WCAG AA 校准（白底对比度 secondary≈7.4、muted≈4.8）
     之前 muted 用 #94A3B8 对比度仅 2.45，按钮文字太浅不可读 */
  --color-text-secondary: #4A5568;
  --color-text-muted: #64748B;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-toast-bg: #1E293B;
  --color-toast-text: #FFFFFF;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  /* 交互反馈令牌：卡片/按钮悬浮抬升与键盘聚焦环。
     之前各处硬编码 5 种不同 rgba 阴影、5 种过渡时长，导致悬浮手感不一致 */
  --shadow-hover: 0 6px 18px rgba(15, 23, 42, 0.10);
  --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.18);
  --radius-pill: 999px;
  --transition-slow: 250ms ease;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
  --sidebar-width: 240px;
  --header-height: 56px;
  --transition: 150ms ease;
}

/* ===== Dark Theme ===== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #2563EB;
  --color-primary-hover: #3B82F6;
  --color-primary-light: rgba(59,130,246,0.16);
  /* 深色模式下按钮背景要够深白字才可读（#3B82F6 白字仅 3.68 不达标，改 #2563EB → 5.16），
     而链接文字要够亮（#60A5FA 在深色底上 5.8~7.1 达标） */
  --color-link: #60A5FA;
  --color-bg: #0F172A;
  --color-surface: #1E293B;
  --color-surface-hover: #334155;
  --color-border: #334155;
  --color-border-focus: #3B82F6;
  --color-text: #E2E8F0;
  /* 次级/弱化文字：深色背景上要够亮才可读
     之前 muted 用 #64748B 在深色底上对比度仅 3.08，已调亮到 #94A3B8（≈5.8~7.0） */
  --color-text-secondary: #A8B5C4;
  --color-text-muted: #94A3B8;
  --color-success: #34D399;
  --color-warning: #FBBF24;
  --color-danger: #F87171;
  --color-toast-bg: #334155;
  --color-toast-text: #F8FAFC;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
  /* 深色底上阴影要更重才可见；聚焦环用更亮的蓝保证可见性 */
  --shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.45);
  --shadow-focus: 0 0 0 3px rgba(96, 165, 250, 0.30);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 60px; } /* 60px = 顶栏高度，避免 hash 跳转时被 sticky 顶栏盖住 */

/* 图标占位尺寸：本地 icon-local.js 会把 <span class="iconify"> 替换成 <svg width/height=1em>，
   替换前空 span 没有盒子，首屏后注入会导致整块重排（CLS）。这里先预留 1em 盒子，注入后尺寸一致、零重排 */
.iconify { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }
::-webkit-scrollbar-track { background: transparent; }

/* Firefox 滚动条主题化：WebKit 用上方 ::-webkit-scrollbar，Firefox 不支持，需 scrollbar-color/width 才能与主题一致（否则 Firefox 仍是默认系统滚动条） */
html { scrollbar-color: var(--color-border) var(--color-surface); scrollbar-width: thin; }

/* App Layout */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
}

/* protocol-banner（file:// 检测横幅）
   说明：浏览器禁止 file:// 协议加载 ES module，此横幅提示用户改用 http 打开
   实现：横幅在 body 内但用 fixed 定位浮在顶部，z-index 高于 topbar */
.protocol-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 16px;
  background: #fff8e1;
  border-bottom: 1px solid #f5c518;
  color: #5d4200;
  font-size: 13px;
  line-height: 1.5;
  box-sizing: border-box;
}
[data-theme='dark'] .protocol-banner {
  background: #3a2e00;
  border-bottom-color: #806000;
  color: #ffd866;
}
.protocol-banner > .iconify { flex-shrink: 0; font-size: 18px; margin-top: 2px; color: #b8860b; }
[data-theme='dark'] .protocol-banner > .iconify { color: #ffcc44; }
.protocol-banner .pb-body { flex: 1; min-width: 0; }
.protocol-banner .pb-body ol { margin: 6px 0 0; padding-left: 20px; }
.protocol-banner .pb-body li { margin-bottom: 2px; }
.protocol-banner .pb-body code {
  background: rgba(0,0,0,.06);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}
[data-theme='dark'] .protocol-banner .pb-body code { background: rgba(255,255,255,.08); }
.protocol-banner .pb-close {
  flex-shrink: 0;
  background: none; border: 0; cursor: pointer;
  color: inherit; padding: 2px 6px;
  font-size: 18px; line-height: 1;
  opacity: .65;
  transition: opacity var(--transition);
}
.protocol-banner .pb-close:hover { opacity: 1; }

.menu-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 24px; color: var(--color-text);
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: var(--color-surface); }

.mobile-logo {
  flex: 1;
  font-size: 18px; font-weight: 700;
  color: var(--color-link);
  white-space: nowrap;   /* 顶部按钮增多后，避免 logo 被挤成两行 */
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
/* 移动端触控目标：图标按钮与语言按钮都提到 36px 以上（原 32/19 低于 WCAG AA 的 24px） */
.mobile-actions .icon-btn { width: 36px; height: 36px; }
.mobile-actions .lang-toggle { padding: 0 10px; min-height: 36px; }
/* 顶部（桌面）图标按钮同理加大，保证点击区域 */
.site-actions .site-action-btn { min-width: 36px; min-height: 36px; }

/* Sidebar */
.sidebar {
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  /* 顶部让出 sticky 的顶部导航条高度（60px），否则滚动后第一项会被它盖住 */
  top: 60px;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
  overflow-y: auto;
  z-index: 50;
  transition: background-color var(--transition-slow);
}

/* 侧边栏品牌区已移除（顶部导航栏已有品牌，避免重复）；.logo-icon 仍被 .site-brand 使用 */
.logo-icon { font-size: 28px; width: 28px; height: 28px; }

.nav-list {
  list-style: none;
  padding: 8px;
  flex: 1;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 14px; font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--color-primary-light);
  color: var(--color-link);
  font-weight: 600;
  box-shadow: inset 0 0 0 1.5px var(--color-primary);
}

.nav-item .iconify { font-size: 20px; flex-shrink: 0; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 18px;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--color-surface-hover); color: var(--color-text); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 40;
}

/* Main Content */
.main-content {
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  /* 预留视口高度：SPA 的模块内容由延迟加载的 app.js 动态渲染，
     首屏 main-content 为空时若不给高度，页脚会先停在顶部、内容渲染后再被推下，
     造成移动端 CLS 偏高（实测 0.127）。预留高度后页脚位置从首屏即稳定。 */
  min-height: calc(100dvh - var(--header-height, 60px));
}

.module-section { display: none; animation: fadeIn var(--transition-slow); }
.module-section.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.module-header { margin-bottom: 24px; }
.module-header h2 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.module-desc { color: var(--color-text-secondary); font-size: 14px; }

/* Footer */
.site-footer {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  color: var(--color-text-muted);
  font-size: 13px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

/* Responsive */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: minmax(0, 1fr);
    padding-top: var(--header-height);
  }

  .mobile-header { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    /* 顶部让出移动端头部高度：否则 fixed 的 mobile-header（z-index 更高）
       会盖住侧边栏第一项，导致「CSV 解析预览」点不到 */
    padding-top: var(--header-height);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 60;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-overlay { display: block; }

  .main-content { padding: 16px; }

  .module-header h2 { font-size: 20px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-width: 200px; }
  .main-content { padding: 24px; }
}

@media (min-width: 1280px) {
  .main-content { max-width: 1280px; }
}

/* 页脚在 app-layout 内跨两列 → 保持整页宽度，同时让侧边栏 sticky 能粘到页面底部 */
.app-layout > .site-footer { grid-column: 1 / -1; }

/* 功能详解：每个工具下方挂一个可展开面板（功能说明 / 使用方法 / 常见问题） */
.feature-doc {
  margin-top: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  overflow: hidden;
}

.feature-doc summary {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
  transition: background-color var(--transition);
}
.feature-doc summary::-webkit-details-marker { display: none; }
.feature-doc summary:hover { background: var(--color-surface-hover); }
.feature-doc[open] summary { border-bottom: 1px solid var(--color-border); }
.feature-doc .doc-icon { font-size: 1.1rem; color: var(--color-link); flex-shrink: 0; }
.feature-doc .doc-title { flex: 1; margin: 0; font-size: inherit; font-weight: 600; line-height: 1.4; }
.feature-doc summary::after {
  content: '+';
  font-size: 1.05rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.feature-doc[open] summary::after { content: '−'; }

.feature-doc .doc-body { padding: 12px 16px 16px; font-size: 0.86rem; line-height: 1.75; }
.feature-doc .doc-body h4 {
  margin: 12px 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-link);
}
.feature-doc .doc-body h4:first-child { margin-top: 0; }
.feature-doc .doc-body p { margin: 0 0 8px; }
.feature-doc .doc-body ol { margin: 0 0 8px; padding-left: 20px; }
.feature-doc .doc-body li { margin-bottom: 3px; }
.feature-doc .doc-body dl { margin: 0; }
.feature-doc .doc-body dt { font-weight: 600; color: var(--color-text); margin-top: 8px; }
.feature-doc .doc-body dd { margin: 2px 0 0; }
.feature-doc .doc-body strong { color: var(--color-text); font-weight: 600; }
.feature-doc .doc-body code {
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  word-break: break-word;
}

@media (max-width: 768px) {
  .feature-doc { margin-top: 16px; }
  .feature-doc summary { padding: 11px 12px; }
  .feature-doc .doc-body { padding: 10px 12px 14px; }
}

/* ===== Generate (Mock Data) Module ===== */
.gen-cols-header,
.gen-col-row {
  display: grid;
  grid-template-columns: 28px 1.2fr 1fr 1.8fr 36px;
  gap: 10px;
  align-items: center;
  padding: 6px 2px;
}
.gen-cols-header {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 4px;
}
.gen-col-row input,
.gen-col-row select {
  width: 100%;
  min-width: 0;
  padding: 6px 10px;
  height: 34px;
  box-sizing: border-box;
}
.gen-col-row .gen-col-range,
.gen-col-row .gen-col-options,
.gen-col-row .gen-col-daterange {
  display: flex;
  gap: 6px;
  align-items: center;
  grid-column: 4;
}
.gen-col-row .gen-col-range input[type="number"],
.gen-col-row .gen-col-options input[type="text"],
.gen-col-row .gen-col-daterange input[type="date"] {
  width: 100%;
  min-width: 0;
}
.gen-col-del {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  justify-self: center;
  align-self: center;
  transition: color var(--transition), background-color var(--transition);
}
.gen-col-del:hover {
  color: var(--color-danger);
  background: var(--color-surface-hover);
}
@media (max-width: 720px) {
  .gen-cols-header { display: none; }
  .gen-col-row {
    grid-template-columns: 1fr 36px;
    grid-template-areas:
      "name name"
      "type range"
      "type remove" ;
  }
  .gen-col-row .gen-col-range,
  .gen-col-row .gen-col-options,
  .gen-col-row .gen-col-daterange { grid-area: range; }
}
.gen-preview-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}
.gen-preview-table th { white-space: nowrap; }
.gen-preview-table td { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Module 11: Diff Compare ===== */
.src-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  vertical-align: 2px;
  margin-right: 6px;
}
.src-tag-base { background: var(--color-primary, #2563EB); color: #fff; }
.src-tag-target { background: var(--color-warning, #f59e0b); color: #fff; }
[data-theme='dark'] .src-tag-base { background: #3b82f6; }
[data-theme='dark'] .src-tag-target { background: #d97706; }
.src-meta { color: var(--color-text-secondary, #64748b); font-size: 13px; }
.diff-base-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diff-base-row strong { font-size: 14px; }

.diff-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.diff-stat {
  flex: 1 1 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border, #e2e8f0);
  background: var(--color-bg, #fff);
  font-size: 13px;
  min-width: 110px;
}
.diff-stat b { font-size: 22px; line-height: 1; }
.diff-stat-added b { color: #16a34a; }
.diff-stat-removed b { color: #dc2626; }
.diff-stat-changed b { color: #d97706; }

.diff-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.diff-tab {
  padding: 6px 14px;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-sm);
  background: var(--color-bg, #fff);
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text, #1e293b);
}
.diff-tab.active {
  background: var(--color-primary, #2563EB);
  border-color: var(--color-primary, #2563EB);
  color: #fff;
  font-weight: 600;
}

/* 行内复选标签（对比选项 / 表单通用） */
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.checkbox-inline input { margin: 0; }

/* 对比选项区域：两列网格，底部对齐（左：数值容差 + 提示，右：比较方式 checkbox） */
.diff-options-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr);
  gap: 16px 24px;
  align-items: end;
}
.diff-options-grid .opt-block { display: flex; flex-direction: column; gap: 4px; }
.diff-options-grid .opt-block label,
.diff-options-grid .opt-block .opt-label {
  font-size: 13px; font-weight: 500; color: var(--color-text-secondary);
}
.diff-options-grid .opt-hint { font-size: 12px; color: var(--color-text-muted); }
.diff-options-grid .opt-check-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; padding-bottom: 2px; }
@media (max-width: 600px) {
  .diff-options-grid { grid-template-columns: 1fr; }
}

/* 忽略列勾选区：可换行的小标签网格 */
.diff-ignore-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--color-surface, #f1f5f9);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-sm, 6px);
  max-height: 160px;
  overflow: auto;
}
.diff-ignore-list .ignore-col {
  flex: 0 0 auto;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  overflow: hidden;
}
.diff-table th {
  position: sticky;
  top: 0;
  background: var(--color-surface, #f1f5f9);
  color: var(--color-text, #1e293b);
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #e2e8f0);
  white-space: nowrap;
  font-weight: 600;
}
.diff-table td {
  padding: 6px 10px;
  border: 1px solid var(--color-border, #e2e8f0);
  max-width: 280px;
  overflow-wrap: anywhere;
}
.diff-table tbody tr:hover td { background: var(--color-surface-hover, #f8fafc); }
/* diff-table zebra striping (v1.0.35): 偶数行浅底；改动的单元格保持警告高亮 */
.diff-table tbody tr:nth-child(even) td { background: var(--color-surface, #f1f5f9); }
.diff-table tbody tr:nth-child(even) td.diff-changes-cell,
.diff-table tbody tr:hover td.diff-changes-cell { background: var(--warning-light, #fffbeb); }
.diff-changes-cell { background: var(--warning-light, #fffbeb); }
.diff-cell-change { margin: 4px 0; line-height: 1.5; }
.dc-field {
  display: inline-block;
  background: var(--color-primary-light, #dbeafe);
  color: var(--color-primary, #1d4ed8);
  border-radius: 3px;
  padding: 0 6px;
  font-size: 12px;
  margin-right: 4px;
}
[data-theme='dark'] .dc-field { background: rgba(59, 130, 246, .2); color: #93c5fd; }
[data-theme='dark'] .diff-changes-cell { background: rgba(217, 119, 6, .12); }

@media (max-width: 768px) {
  .diff-stat { flex-basis: 90px; min-width: 90px; }
  .diff-stat b { font-size: 18px; }
  .diff-table { font-size: 12px; }
}

/* ===== Operation Recipes (Workflow) ===== */
.recipe-steps { list-style: none; counter-reset: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recipe-steps:not(.recipe-step-empty) { counter-reset: step; }
.recipe-step {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--color-surface, #f1f5f9);
  border: 1px solid var(--color-border, #e2e8f0); border-radius: var(--radius-sm, 6px);
  font-size: 13px;
}
.recipe-step-no {
  min-width: 22px; height: 22px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-primary, #2563EB); color: #fff;
  border-radius: 50%; font-size: 12px; font-weight: 600;
}
.recipe-step-sum { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipe-step-acts { display: flex; gap: 2px; flex: 0 0 auto; }
.recipe-step-empty { color: var(--color-text-muted, #64748b); font-style: italic; padding: 8px 10px; }
#recipeParamForm .form-row { align-items: flex-end; }
#recipeParamForm .diff-ignore-list { margin-top: 0; }
#recipeRecordBtn.recording {
  background: var(--color-danger, #dc2626); border-color: var(--color-danger, #dc2626); color: #fff;
  animation: recipe-pulse 1.4s ease-in-out infinite;
}
@keyframes recipe-pulse { 0%,100% { opacity: 1; } 50% { opacity: .65; } }
[data-theme='dark'] .recipe-step { background: rgba(255,255,255,.04); }

/* ===== SQL Query ===== */
.sql-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  padding: 4px 10px; border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-pill); background: var(--color-surface, #f1f5f9);
  font-size: 12px; cursor: pointer; color: var(--color-text, #1e293b);
}
.chip:hover { background: var(--color-primary-light, #dbeafe); border-color: var(--color-primary, #2563EB); }
#sqlSchema { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
#sqlInput {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.5; padding: 10px;
}
.sql-result-table { font-size: 13px; }
[data-theme='dark'] .chip { background: rgba(255,255,255,.06); }

/* ===== Print Styles =====
   打印 / 导出 PDF 时隐藏导航、操作按钮等交互元素，只保留数据表格做干净输出 */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .sidebar, .mobile-header, .site-topbar, .site-footer, .quick-bar,
  .menu-toggle, .sidebar-overlay,
  .module-header, .icon-btn, .btn, .form-row, .form-group, .tool-options,
  .upload-zone, .output-actions, .pagination, .batch-bar,
  .modal-overlay, .no-data-hint, .tool-card h3,
  .tool-hint, .parse-options, .parse-export-bar {
    display: none !important;
  }
  .app-layout { display: block; }
  .main-content { max-width: none !important; padding: 0 !important; margin: 0; }
  .module-section { display: block !important; break-before: auto; }
  .tool-card { box-shadow: none !important; border: none !important; padding: 0 !important; margin-bottom: 16px; }
  .table-container, .table-wrapper { overflow: visible !important; }
  .data-table, .gen-preview-table, .diff-table, .pivot-table { font-size: 9.5px !important; }
  .data-table th, .data-table td,
  .gen-preview-table th, .gen-preview-table td,
  .diff-table th, .diff-table td,
  .pivot-table th, .pivot-table td {
    border-color: #cbd5e1 !important;
    break-inside: avoid;
  }
  .data-table tr, .diff-table tr { break-inside: avoid; }
  thead { display: table-header-group; }
}

/* v1.0.30 低风险样式增强：焦点可见性 / 文本选中高亮 / 表格行悬停反馈 */
:focus-visible { outline: 2px solid rgba(79,124,255,.75); outline-offset: 1px; border-radius: 2px; }
::selection { background: rgba(37, 99, 235, 0.20); color: var(--color-text); }
:root[data-theme="dark"] ::selection { background: rgba(96, 165, 250, 0.35); color: var(--color-text); }
.data-table tbody tr:hover,
#filterTable tbody tr:hover,
#pivotTable tbody tr:hover,
#sortPreviewTable tbody tr:hover,
#diffTable tbody tr:hover,
#groupSummaryTable tbody tr:hover,
#freqDistTable tbody tr:hover,
#colProfileTable tbody tr:hover { background-color: rgba(99,102,241,.07); }
.data-table tbody tr,
#filterTable tbody tr,
#pivotTable tbody tr,
#sortPreviewTable tbody tr { transition: background-color .12s ease; }
