/* =========================================================
   数据仓库原理 & 实战 · main.css
   默认暗色主题;亮色用 :root[data-theme='light'] 切换。
   ========================================================= */

/* ---------- 默认:暗色主题 ---------- */
:root {
  color-scheme: dark;
  --c-bg: #0f172a;
  --c-bg-soft: #1e293b;
  --c-bg-code: #0d1117;
  --c-text: #f1f5f9;
  --c-text-dim: #cbd5e1;
  --c-text-mute: #94a3b8;
  --c-border: #334155;
  --c-border-soft: #1e293b;
  --c-primary: #60a5fa;
  --c-primary-dark: #3b82f6;
  --c-accent: #c084fc;
  --c-success: #4ade80;
  --c-warning: #fbbf24;
  --c-danger: #f87171;
  --c-mysql: #2dd4bf;
  --c-hdfs: #fbbf24;
  --c-ods:  #94a3b8;
  --c-dwd:  #60a5fa;
  --c-dws:  #a78bfa;
  --c-ads:  #f87171;
  --c-export: #34d399;
  --card-bg: #1e293b;
  --card-hover: #334155;
  --code-text: #e6edf3;
  --link-bg: rgba(96, 165, 250, 0.12);
  --c-inline-code-bg: rgba(148, 163, 184, 0.2);
  --c-inline-code-text: #fca5a5;
  --c-error-bg: rgba(248, 113, 113, 0.1);
  --c-error-border: rgba(248, 113, 113, 0.35);
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-w: 280px;
  --topbar-h: 52px;
  --max-content: 1140px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Monaco,
    "Courier New", monospace;
}

/* ---------- 亮色主题 ---------- */
:root[data-theme='light'] {
  color-scheme: light;
  --c-bg: #ffffff;
  --c-bg-soft: #f6f8fa;
  --c-bg-code: #1e2227;
  --c-text: #1f2328;
  --c-text-dim: #57606a;
  --c-text-mute: #8b949e;
  --c-border: #d0d7de;
  --c-border-soft: #e6e9ec;
  --c-primary: #2c6ecb;
  --c-primary-dark: #1f4e8c;
  --c-accent: #9333ea;
  --c-success: #1a7f37;
  --c-warning: #b45309;
  --c-danger: #cf222e;
  --c-mysql: #00758f;
  --c-hdfs: #ffc107;
  --c-ods:  #6b7280;
  --c-dwd:  #3b82f6;
  --c-dws:  #8b5cf6;
  --c-ads:  #ef4444;
  --c-export: #10b981;
  --card-bg: #ffffff;
  --card-hover: #f8fbfe;
  --code-text: #e6edf3;
  --link-bg: rgba(44, 110, 203, 0.08);
  --c-inline-code-bg: rgba(110, 118, 129, 0.14);
  --c-inline-code-text: #b91c1c;
  --c-error-bg: #fef2f2;
  --c-error-border: #fecaca;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== 顶部栏 ========== */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #1e293b;
  color: #f8fafc;
  /* 用 fixed 替代 sticky,确保滚动时顶栏始终钉在视口顶、绝不透明 */
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; }
.brand {
  color: #f8fafc !important;
  font-size: 17px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.brand:hover { text-decoration: none; }
.brand-icon { font-size: 22px; }
.brand-sub { font-weight: 400; color: #94a3b8; font-size: 13px; }
.icon-btn {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.topbar-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.topbar-btn:hover { background: rgba(255, 255, 255, 0.16); text-decoration: none; }
.topbar-btn.ghost { background: transparent; }

/* ========== 整体布局 ========== */
.layout {
  display: flex;
  /* 顶栏已 fixed,这里留出对应高度,避免顶部内容被遮 */
  padding-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

/* ========== 侧栏目录 ========== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-bg-soft);
  border-right: 1px solid var(--c-border-soft);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  transition: transform 0.2s ease;
}
.toc { padding: 14px 6px; }
.toc-group { margin-bottom: 12px; }
.toc-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-text-mute);
  padding: 6px 14px 4px;
  border-bottom: 1px dashed var(--c-border-soft);
  margin-bottom: 4px;
}
.toc-item {
  display: block;
  padding: 7px 14px;
  font-size: 13.5px;
  color: var(--c-text);
  border-radius: var(--radius);
  border-left: 3px solid transparent;
  line-height: 1.4;
}
.toc-item:hover { background: rgba(0, 0, 0, 0.04); text-decoration: none; color: var(--c-primary-dark); }
.toc-item.active {
  background: var(--link-bg);
  border-left-color: var(--c-primary);
  color: var(--c-primary-dark);
  font-weight: 500;
}
.toc-item.tag::after { /* 可执行章节标记 */
  content: "▶";
  font-size: 9px;
  color: var(--c-accent);
  margin-left: 6px;
  vertical-align: middle;
}
.sidebar-footer {
  padding: 12px 16px;
  font-size: 11px;
  color: var(--c-text-mute);
  border-top: 1px solid var(--c-border-soft);
  display: flex;
  flex-direction: column;
}
.sidebar-footer .dim { opacity: 0.7; font-size: 10.5px; }

/* ========== 主内容区 ========== */
.main {
  flex: 1;
  min-width: 0;
  outline: none;
  background: var(--c-bg);
}
.content {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 36px 32px 120px;
}

/* ========== Markdown 渲染样式 ========== */
.content h1 {
  font-size: 28px;
  margin: 0 0 8px;
  color: var(--c-text);
  border-bottom: 2px solid var(--c-border);
  padding-bottom: 10px;
  font-weight: 700;
}
.content h2 {
  font-size: 22px;
  margin: 36px 0 12px;
  color: var(--c-text);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--c-border-soft);
}
.content h3 {
  font-size: 18px;
  margin: 28px 0 10px;
  color: var(--c-text);
}
.content h4 { font-size: 15.5px; margin: 22px 0 8px; }
.content p { margin: 10px 0; }
.content ul, .content ol { margin: 10px 0; padding-left: 26px; }
.content li { margin: 4px 0; }
.content blockquote {
  border-left: 4px solid var(--c-primary);
  background: var(--c-bg-soft);
  margin: 14px 0;
  padding: 10px 14px;
  color: var(--c-text-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.content code {
  font-family: var(--font-mono);
  background: var(--c-inline-code-bg);
  padding: 1.5px 5px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--c-inline-code-text);
}
.content pre {
  background: var(--c-bg-code);
  color: #e6edf3;
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  margin: 14px 0;
  position: relative;
}
.content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
  display: block;
  margin: 12px auto;
}
/* 图床失败降级占位 */
.content img.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: linear-gradient(135deg, var(--c-bg-soft) 0%, var(--c-border-soft) 100%);
  color: var(--c-text-mute);
  font-size: 13px;
  text-align: center;
  padding: 20px;
  box-shadow: inset 0 0 0 1px var(--c-border);
}
.content table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
  font-size: 13.5px;
}
.content th, .content td {
  border: 1px solid var(--c-border);
  padding: 6px 10px;
  text-align: left;
}
.content th { background: var(--c-bg-soft); font-weight: 600; }
.content hr { border: none; border-top: 1px solid var(--c-border-soft); margin: 24px 0; }

/* 代码块复制按钮 */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e6edf3;
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.content pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: rgba(255, 255, 255, 0.22); }
.code-copy-btn.copied { background: var(--c-success); border-color: var(--c-success); }

/* ========== 章节头部面包屑 ========== */
.section-meta {
  font-size: 12px;
  color: var(--c-text-mute);
  margin-bottom: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.section-meta .pill {
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-soft);
}
.section-meta .pill.runnable { background: rgba(147, 51, 234, 0.1); border-color: rgba(147, 51, 234, 0.3); color: var(--c-accent); }

/* ========== 章节导航 ========== */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 50px;
  padding-top: 22px;
  border-top: 1px solid var(--c-border-soft);
  gap: 12px;
}
.chapter-nav a {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--c-text);
}
.chapter-nav a:hover { background: var(--c-bg-soft); text-decoration: none; }
.chapter-nav a.prev { text-align: left; }
.chapter-nav a.next { text-align: right; }
.chapter-nav .nav-label { display: block; font-size: 11px; color: var(--c-text-mute); margin-bottom: 2px; }
.chapter-nav .nav-title { color: var(--c-primary-dark); font-weight: 500; }

/* ========== 数据流浮窗 ========== */
.flow-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: 60vh;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  z-index: 40;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.flow-panel.hidden { display: none; }
.flow-panel-header {
  padding: 8px 12px;
  background: var(--c-bg-soft);
  border-bottom: 1px solid var(--c-border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.flow-mount { padding: 12px; overflow-y: auto; }

/* ========== 阅读进度条 ========== */
.read-progress {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
  width: 0%;
  z-index: 60;
  transition: width 0.05s linear;
}

/* ========== noscript ========== */
.noscript-banner {
  background: var(--c-warning);
  color: white;
  padding: 12px 20px;
  text-align: center;
}

/* ========== 通用按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-primary);
  color: white;
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s;
}
.btn:hover { background: var(--c-primary-dark); }
.btn.secondary { background: var(--c-bg-soft); color: var(--c-text); border: 1px solid var(--c-border); }
.btn.secondary:hover { background: var(--card-hover); }
.btn.success { background: var(--c-success); }
.btn.danger { background: var(--c-danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== 首页 hero ========== */
.hero {
  text-align: center;
  padding: 60px 20px 30px;
}
.hero-title {
  font-size: 36px;
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: 10px;
  line-height: 1.25;
}
.hero-sub {
  font-size: 17px;
  color: var(--c-text-dim);
  max-width: 640px;
  margin: 0 auto 24px;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 30px;
}
.hero-badge {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-soft);
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  color: var(--c-text-dim);
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-actions .btn { padding: 10px 22px; font-size: 14px; }

/* 首页课程介绍横幅 */
.course-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, var(--link-bg) 0%, var(--c-bg-soft) 100%);
  border: 1px solid var(--c-border);
  border-left: 4px solid #fc8bab;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin: 20px 0;
  flex-wrap: wrap;
}
.course-banner-icon { font-size: 32px; flex-shrink: 0; }
.course-banner-body { flex: 1; min-width: 240px; }
.course-banner-title { font-size: 16px; font-weight: 700; color: var(--c-text); margin-bottom: 4px; }
.course-banner-sub { font-size: 13px; color: var(--c-text-dim); line-height: 1.6; }
.course-banner-sub a { color: var(--c-primary); }
.course-banner-sub a:hover { text-decoration: underline; }
.course-banner-btn {
  flex-shrink: 0;
  background: #fc8bab;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
}
.course-banner-btn:hover { background: #fb7c9f; text-decoration: none; }

/* 首页亮点卡片网格 */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 40px 0;
}
.feature-card {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: left;
}
.feature-card .ft-icon { font-size: 24px; margin-bottom: 8px; }
.feature-card h3 { margin: 0 0 6px; font-size: 15.5px; color: var(--c-text); border: none; padding: 0; }
.feature-card p { margin: 0; font-size: 13px; color: var(--c-text-dim); }

/* ========== 数据流图(全屏页与浮窗共用) ========== */
.dw-flow-svg { width: 100%; }
.flow-layer {
  cursor: pointer;
  transition: opacity 0.2s;
}
.flow-layer.active rect { stroke-width: 3; }
.flow-layer.dim { opacity: 0.4; }
.flow-layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  border-left: 4px solid var(--c-border);
  margin-bottom: 6px;
  background: var(--c-bg-soft);
  font-size: 13px;
}
.flow-layer-row.mysql { border-left-color: var(--c-mysql); }
.flow-layer-row.hdfs { border-left-color: var(--c-hdfs); }
.flow-layer-row.ods  { border-left-color: var(--c-ods); }
.flow-layer-row.dwd  { border-left-color: var(--c-dwd); }
.flow-layer-row.dws  { border-left-color: var(--c-dws); }
.flow-layer-row.ads  { border-left-color: var(--c-ads); }
.flow-layer-row.export { border-left-color: var(--c-export); }
.flow-layer-row.active { background: var(--link-bg); }
.flow-layer-row .count {
  margin-left: auto;
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  padding: 1px 7px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--c-text-dim);
}

/* ========== 沙箱样式(JS 追加,先占位) ========== */
.sandbox {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  background: var(--c-bg);
  margin: 22px 0;
  overflow: hidden;
}
.sandbox-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--c-bg-soft);
  border-bottom: 1px solid var(--c-border-soft);
  flex-wrap: wrap;
}
.sandbox-title { font-weight: 600; font-size: 13.5px; margin-right: auto; }
.sandbox-db-status {
  font-size: 12px;
  color: var(--c-text-dim);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sandbox-db-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-text-mute);
}
.sandbox-db-dot.ready { background: var(--c-success); }
.sandbox-db-dot.loading { background: var(--c-warning); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.example-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border-soft);
}
.example-btn {
  background: rgba(147, 51, 234, 0.08);
  border: 1px solid rgba(147, 51, 234, 0.25);
  color: var(--c-accent);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-sans);
}
.example-btn:hover { background: rgba(147, 51, 234, 0.15); }

.sandbox-editor-wrap {
  display: flex;
  background: var(--c-bg-code);
}
.sandbox-linenum {
  padding: 12px 8px 12px 12px;
  color: #6e7681;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  text-align: right;
  user-select: none;
  background: var(--c-bg-code);
  white-space: pre;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.sandbox-editor {
  flex: 1;
  background: var(--c-bg-code);
  color: #e6edf3;
  border: none;
  outline: none;
  resize: vertical;
  min-height: 140px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}
.sandbox-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: var(--c-bg-soft);
  border-top: 1px solid var(--c-border-soft);
  align-items: center;
}
details.sql-transform-preview {
  width: 100%;
  margin-top: 6px;
  background: var(--c-bg);
  border-top: 1px solid var(--c-border-soft);
}
details.sql-transform-preview summary {
  cursor: pointer;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--c-text-dim);
}
details.sql-transform-preview pre {
  margin: 0;
  border-radius: 0;
  font-size: 12px;
}

/* 结果表 */
.sandbox-result {
  border-top: 1px solid var(--c-border-soft);
  max-height: 380px;
  overflow: auto;
}
.sandbox-result.empty { padding: 20px; text-align: center; color: var(--c-text-mute); font-size: 13px; }
.sandbox-result-meta {
  padding: 6px 12px;
  background: var(--c-bg-soft);
  font-size: 12px;
  color: var(--c-text-dim);
  border-bottom: 1px solid var(--c-border-soft);
}
.sandbox-result table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-family: var(--font-mono);
  background: var(--c-bg);
}
.sandbox-result thead th {
  background: var(--c-bg-soft);
  position: sticky;
  top: 0;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  font-weight: 600;
  font-family: var(--font-sans);
  white-space: nowrap;
}
.sandbox-result tbody td {
  padding: 4px 10px;
  border-bottom: 1px solid var(--c-border-soft);
  white-space: nowrap;
}
.sandbox-result tbody tr:hover { background: var(--link-bg); }

.sandbox-error {
  background: var(--c-error-bg);
  color: var(--c-danger);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  border-top: 1px solid var(--c-error-border);
}

/* ========== Azkaban DAG ========== */
.dag-wrap {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 20px 0;
}
.dag-tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--c-border); }
.dag-tab {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--c-text-dim);
}
.dag-tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }
.dag-svg { width: 100%; height: auto; }
.dag-node {
  cursor: pointer;
}
.dag-node rect { transition: fill 0.3s, stroke 0.3s; }
.dag-node text { font-size: 12px; font-family: var(--font-sans); }
.dag-controls { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.dag-node-detail {
  margin-top: 12px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  display: none;
}
.dag-node-detail.visible { display: block; }

/* 微缩 DAG 链 */
.mini-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  font-size: 11px;
  font-family: var(--font-mono);
}
.mini-flow .mini-step {
  padding: 2px 8px;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-soft);
  border-radius: 3px;
  color: var(--c-text-dim);
}
.mini-flow .mini-arrow { color: var(--c-text-mute); }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
  .content { padding: 24px 18px 100px; }
  .hero-title { font-size: 28px; }
}
@media (max-width: 780px) {
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 45;
    transform: translateX(-100%);
    box-shadow: 4px 0 16px rgba(0,0,0,0.2);
    width: 268px;
  }
  .sidebar.open { transform: translateX(0); }
  .flow-panel { right: 8px; left: 8px; width: auto; bottom: 8px; }
  .content { padding: 20px 14px 90px; }
}
@media (max-width: 480px) {
  .hero-title { font-size: 22px; }
  .content h1 { font-size: 22px; }
  .content h2 { font-size: 18px; }
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); background-clip: padding-box; border: 2px solid transparent; }
/* Hive 工作站:流程步骤卡片 */
.flow-steps {
  background: linear-gradient(180deg, #fafbfc 0%, var(--c-bg-soft) 100%);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 10px;
  margin: 0 0 8px 0;
}
.flow-steps-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text-mute);
  letter-spacing: 0.3px;
  padding: 4px 4px 8px;
}
.flow-step-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.flow-step-card:hover {
  border-color: var(--c-primary);
  box-shadow: 0 1px 4px rgba(44, 110, 203, 0.12);
}
.flow-step-card.executed {
  border-left: 3px solid var(--c-success);
  background: var(--card-bg);
}
.flow-step-card.executed .flow-step-no { background: var(--c-success); }
.flow-step-card.executed .flow-step-title { color: var(--c-success); }
  width: 24px; height: 24px;
  flex-shrink: 0;
  background: var(--c-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.flow-step-card.executed .flow-step-no { background: var(--c-success); }
.flow-step-body { flex: 1; min-width: 0; }
.flow-step-title { font-size: 13.5px; font-weight: 600; color: var(--c-text); }
.flow-step-desc {
  font-size: 12px;
  color: var(--c-text-mute);
  margin-top: 2px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.flow-step-run { flex-shrink: 0; }

.sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
.sandbox-editor::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }

/* ========================================================= */
/* 产品视角 — 架构图 / 工作站 / Tab / 拖拽  (新增样式)        */
/* ========================================================= */

/* 顶部导航按钮的 active 状态 */
.topbar-right .topbar-btn.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* ---------- 首页架构图 ---------- */
.architecture-hero {
  text-align: center;
  padding: 36px 20px 14px;
}
.arch-title { font-size: 30px; font-weight: 800; color: var(--c-text); margin-bottom: 8px; }
.arch-sub   { font-size: 15px; color: var(--c-text-dim); max-width: 720px; margin: 0 auto 18px; }
.arch-actions { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.arch-graph {
  background: linear-gradient(180deg, #fafbfc 0%, var(--c-bg-soft) 100%);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin: 18px 0;
  overflow-x: auto;
}
.arch-svg { width: 100%; min-width: 760px; height: auto; }
.arch-svg .arch-node { cursor: pointer; }
.arch-svg .arch-node-rect { transition: fill 0.3s, stroke-width 0.2s; }
.arch-svg .arch-flow-line {
  stroke-dasharray: 6 8;
  animation: arch-flow-dash 1.2s linear infinite;
  opacity: 0.7;
}
@keyframes arch-flow-dash {
  to { stroke-dashoffset: -28; }
}

/* ---------- 工作站通用三栏 ---------- */
.workbench-head { padding: 26px 4px 10px; border-bottom: 2px solid var(--c-border); margin-bottom: 14px; }
.wb-title   { font-size: 22px; font-weight: 700; color: var(--c-text); }
.wb-icon    { display: inline-block; margin-right: 8px; }
.wb-sub     { color: var(--c-text-dim); font-size: 13.5px; margin-top: 4px; }

.workbench-body {
  display: block;
  /* 兜底:防止内容(长 SQL/表格)把工作站撑爆到视口外 */
  max-width: 100%;
  overflow-x: hidden;
}
/* 工作站两栏:左栏紧凑(220px),右栏自适应 */
.wb-grid {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  max-width: 100%;
}
@media (max-width: 800px) {
  .wb-grid { grid-template-columns: 1fr; }
}
.wb-left, .wb-right {
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 12px;
  min-height: 200px;
  /* grid 子项默认 min-width: auto,会被宽内容(长 SQL/表格)撑破溢出
     强制 min-width:0,让内部 overflow:auto 收敛 */
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.wb-right { overflow: visible; }
.wb-panel-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-text-mute);
  margin-bottom: 8px;
}
.wb-actions { display: flex; gap: 8px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.wb-status  { font-size: 12px; color: var(--c-text-dim); }
.btn.small  { padding: 4px 10px; font-size: 12.5px; }

/* 业务表卡片(紧凑) */
.wb-table-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }

/* ---------- 工作站上下两层布局 ---------- */
.wb-tier {
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.wb-tier-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.wb-tier-presets { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.wb-tier-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-text-mute);
}
/* 水平 chip 栏:表卡片自动换行平铺 */
.wb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.wb-chips .wb-table-card { width: auto; flex: 0 0 auto; }
.wb-chips .wb-table-card.miss { opacity: 0.55; cursor: not-allowed; }
.wb-chips .wb-table-icon { display: inline-flex; align-items: center; }
.hive-inline-preview { margin-top: 6px; max-height: 320px; }
#hive-panel-title { margin-top: 6px; }
.wb-table-card {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: var(--font-sans);
  color: var(--c-text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.wb-table-card:hover { border-color: var(--c-primary); background: var(--card-hover); }
.wb-table-card.active { border-color: var(--c-primary); background: var(--link-bg); }
.wb-table-icon { font-size: 15px; flex-shrink: 0; }
.wb-table-info { flex: 1; min-width: 0; overflow: hidden; }
.wb-table-name { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-table-name .dim { font-family: var(--font-sans); color: var(--c-text-mute); font-weight: 400; font-size: 11px; margin-left: 4px; }
.wb-table-desc { font-size: 10.5px; color: var(--c-text-mute); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* MySQL 数据预览表 */
.mysql-preview, .mysql-result { overflow: auto; max-height: 380px; border: 1px solid var(--c-border-soft); border-radius: var(--radius); background: var(--card-bg); }
.mysql-table-wrap table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
.mysql-table-wrap thead th { background: var(--c-bg-soft); position: sticky; top: 0; padding: 6px 8px; text-align: left; font-family: var(--font-sans); border-bottom: 1px solid var(--c-border); }
.mysql-table-wrap tbody td { padding: 3px 8px; border-bottom: 1px solid var(--c-border-soft); white-space: nowrap; }
.mysql-table-wrap tbody tr:hover { background: var(--link-bg); }
.mysql-sql-input {
  width: 100%;
  /* 把最小高度从 80 提到 200,放得下多行预设 SQL;仍允许 resize: vertical 用户拖大 */
  min-height: 200px;
  background: var(--c-bg-code); color: #e6edf3;
  border: 1px solid var(--c-border-soft); border-radius: var(--radius);
  padding: 10px 12px; font-family: var(--font-mono); font-size: 12.5px;
  line-height: 1.55;
  resize: vertical; outline: none;
  /* textarea 默认行为:内容溢出时滚动条出现 */
  overflow-y: auto;
}

/* ---------- Sqoop 拖拽 ---------- */
.sqoop-source-list { display: flex; flex-direction: column; gap: 6px; }
.sqoop-source-card { position: relative; user-select: none; }
.sqoop-source-card.dragging { opacity: 0.5; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.sqoop-plus {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: var(--c-primary); color: #fff;
  border-radius: 50%; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
}
.sqoop-source-card:hover .sqoop-plus { transform: translateY(-50%) scale(1.15); }

.sqoop-target-pane {
  border: 2px dashed var(--c-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  min-height: 100px;
  background: var(--c-bg-soft);
  transition: border-color 0.2s, background 0.2s;
}
.sqoop-target-pane .drag-over,
.sqoop-target-list.drag-over + * { border-color: var(--c-primary); }
.sqoop-target-list.drag-over { background: var(--link-bg); }
.sqoop-target-empty { text-align: center; color: var(--c-text-mute); font-size: 13px; padding: 20px; line-height: 1.6; }
.sqoop-target-empty .dim { font-size: 11.5px; }

.sqoop-target-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-bg); border: 1px solid var(--c-border-soft);
  border-radius: var(--radius); padding: 6px 10px; margin-bottom: 6px;
  font-size: 12.5px;
  animation: drop-in 0.25s ease-out;
  min-width: 0;
}
@keyframes drop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.wb-left .wb-panel-title { margin-bottom: 6px; }
.sqoop-target-tick { color: var(--c-success); font-weight: 700; flex-shrink: 0; }
.sqoop-target-name { font-family: var(--font-mono); flex-shrink: 0; }
.sqoop-target-extra { flex: 1; font-size: 11.5px; color: var(--c-text-mute); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sqoop-target-del { background: transparent; border: none; color: var(--c-danger); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 3px; }
.sqoop-target-del:hover { background: rgba(207, 34, 46, 0.1); }

.sqoop-options { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.sqoop-options label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.sqoop-input { padding: 4px 8px; border: 1px solid var(--c-border); border-radius: 4px; font-family: var(--font-mono); font-size: 12.5px; width: 140px; }

.sqoop-animation { background: #0d1117; color: #e6edf3; padding: 12px; border-radius: var(--radius); margin-top: 10px; font-family: var(--font-mono); font-size: 12px; min-height: 50px; border: 1px solid #21262d; }
.sqoop-anim-line { padding: 3px 0; }
.sqoop-anim-line code { background: rgba(255,255,255,0.12); padding: 1px 5px; border-radius: 3px; color: #79c0ff; }
.sqoop-progress { color: #fbbf24; }
.sqoop-anim-done { color: #4ade80; font-weight: 600; padding: 6px 0; }

/* ---------- Hive Tab ---------- */
.layer-tabs, .azkaban-tabs {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--c-border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.layer-tab {
  background: transparent; border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--c-text-dim);
  cursor: pointer;
  font-family: var(--font-sans);
  margin-bottom: -2px;
}
.layer-tab:hover { color: var(--c-primary); }
.layer-tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }

.hive-grid { margin-top: 4px; }
.hive-left { font-size: 12.5px; }
.layer-tree { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.layer-tree-row { display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: var(--c-bg); border: 1px solid var(--c-border-soft); border-radius: var(--radius); font-size: 12.5px; min-width: 0; }
.layer-tree-row:not(.miss) { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.layer-tree-row:not(.miss):hover { border-color: var(--c-primary); background: var(--link-bg); }
.layer-tree-row.miss { color: var(--c-text-mute); opacity: 0.7; }
.layer-tree-tick { font-size: 12px; flex-shrink: 0; }
.layer-tree-row:not(.miss) .layer-tree-tick { color: var(--c-success); }
.layer-tree-name { font-family: var(--font-mono); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-tree-count { font-family: var(--font-mono); font-size: 11px; color: var(--c-text-mute); background: var(--c-bg-soft); padding: 1px 6px; border-radius: 99px; flex-shrink: 0; }
.layer-tree-view {
  background: transparent; border: none; cursor: pointer; padding: 2px 4px;
  font-size: 13px; line-height: 1; border-radius: 3px; flex-shrink: 0;
  opacity: 0.5; transition: opacity 0.15s;
}
.layer-tree-row:not(.miss):hover .layer-tree-view { opacity: 1; }
.layer-tree-view:hover { background: rgba(44,110,203,0.15); }
.layer-tree-empty, .layer-tree-loading { text-align: center; color: var(--c-text-mute); font-size: 12px; padding: 14px; line-height: 1.6; }

/* Hive 表预览浮层 */
.preview-modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
}
.preview-modal.visible { display: flex; }
.preview-modal-card {
  background: var(--c-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%; max-width: 1000px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: preview-in 0.2s ease-out;
}
@keyframes preview-in { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: none; } }
.preview-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border-soft);
  background: var(--c-bg-soft);
}
.preview-modal-title { font-size: 14px; font-weight: 600; color: var(--c-text); }
.preview-modal-title code { font-family: var(--font-mono); background: rgba(0,0,0,0.05); padding: 1px 6px; border-radius: 3px; }
.preview-modal-close { background: transparent; border: none; cursor: pointer; font-size: 16px; color: var(--c-text-mute); padding: 4px 8px; border-radius: 4px; }
.preview-modal-close:hover { background: rgba(0,0,0,0.08); color: var(--c-text); }
.preview-modal-body { overflow: auto; padding: 12px 16px; }
.preview-loading, .preview-empty { text-align: center; padding: 30px; color: var(--c-text-mute); font-size: 13px; }
.preview-meta { font-size: 12px; color: var(--c-text-dim); margin-bottom: 8px; padding: 4px 0; }
.preview-table-wrap {
  overflow: auto; max-height: 55vh;
  border: 1px solid var(--c-border-soft); border-radius: var(--radius);
}
.preview-table-wrap table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
.preview-table-wrap thead th { background: var(--c-bg-soft); position: sticky; top: 0; padding: 6px 10px; text-align: left; font-family: var(--font-sans); border-bottom: 1px solid var(--c-border); white-space: nowrap; }
.preview-table-wrap tbody td { padding: 3px 10px; border-bottom: 1px solid var(--c-border-soft); white-space: nowrap; }
.preview-table-wrap tbody tr:hover { background: var(--link-bg); }
.preview-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.preview-actions code { font-family: var(--font-mono); background: rgba(0,0,0,0.05); padding: 1px 5px; border-radius: 3px; font-size: 11.5px; }

.sandbox-wrap { padding: 0; }

/* ---------- Azkaban 工作站 ---------- */
.azkaban-host { margin: 10px 0; }
.azkaban-tip  { background: var(--c-bg-soft); border-left: 3px solid var(--c-primary); padding: 10px 14px; font-size: 12.5px; color: var(--c-text-dim); border-radius: 0 var(--radius) var(--radius) 0; line-height: 1.6; }
.azkaban-tip code { background: rgba(0,0,0,0.05); padding: 1px 5px; border-radius: 3px; }

/* ---------- 底部参考资料 ---------- */
.workbench-ref-host { margin-top: 30px; }
.workbench-ref, .workbench-ref summary {
  font-family: var(--font-sans);
  cursor: pointer;
}
.workbench-ref {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
}
.workbench-ref summary { font-size: 14px; font-weight: 600; color: var(--c-text); }
.workbench-ref[open] summary { margin-bottom: 10px; }
.workbench-ref-body { background: var(--c-bg); border-top: 1px solid var(--c-border-soft); padding: 12px; border-radius: 0 0 var(--radius) var(--radius); margin: 0 -4px -4px; }
.ref-tabbar { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--c-border-soft); padding-bottom: 8px; margin-bottom: 12px; }
.ref-tab { background: transparent; border: 1px solid var(--c-border-soft); border-radius: 99px; padding: 4px 12px; font-size: 12px; cursor: pointer; color: var(--c-text-dim); }
.ref-tab.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.ref-pane { max-height: 480px; overflow-y: auto; padding-right: 8px; }
.ref-pane .content h1 { font-size: 22px; }
.preview-pane .content { max-width: none; padding: 0; }

/* ---------- 浅色提示按钮(Hive 表预览"放入编辑器") ---------- */
.btn-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef3c7;            /* 浅琥珀,与 btn second 蓝区分 */
  color: #92400e;                  /* 深琥珀字 */
  border: 1px solid #fcd34d;
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  margin-left: 12px;
}
.btn-hint:hover {
  background: #fde68a;
  border-color: #f59e0b;
  transform: translateY(-1px);
}
.btn-hint:active { transform: translateY(0); }
.btn-hint code {
  background: rgba(146, 64, 14, 0.12);
  color: #78350f;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ---------- 进度模态(init_data 用) ---------- */
.pm-modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 110;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
}
.pm-modal.visible { display: flex; }
.pm-card {
  background: var(--c-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  width: 100%; max-width: 540px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: pm-in 0.18s ease-out;
}
@keyframes pm-in { from { opacity:0; transform: translateY(20px) scale(0.98); } to { opacity:1; transform:none; } }
.pm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border-soft);
  background: var(--c-bg-soft);
}
.pm-title { font-size: 15px; font-weight: 600; color: var(--c-text); }
.pm-close {
  background: transparent; border: none; cursor: pointer;
  font-size: 14px; color: var(--c-text-mute);
  padding: 4px 10px; border-radius: var(--radius);
}
.pm-close:hover { background: rgba(0,0,0,0.08); color: var(--c-text); }
.pm-progress { padding: 14px 16px 6px; display: flex; align-items: center; gap: 10px; }
.pm-bar {
  flex: 1; height: 10px;
  background: var(--c-bg-soft);
  border-radius: 99px; overflow: hidden;
}
.pm-bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg,#3b82f6,#9333ea);
  border-radius: 99px;
  transition: width 0.4s ease, background 0.4s ease;
}
.pm-pct { font-size: 12px; color: var(--c-text-mute); font-family: var(--font-mono); width: 36px; text-align: right; }
.pm-log {
  padding: 0 16px 16px;
  max-height: 320px; overflow-y: auto;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--c-text-dim);
}
.pm-log-line {
  padding: 5px 0;
  border-bottom: 1px dashed var(--c-border-soft);
  display: flex; gap: 6px; align-items: start;
}
.pm-log-line:last-child { border-bottom: none; }
.pm-log-line .pm-tick { color: var(--c-primary); font-weight: 700; flex-shrink: 0; }
.pm-log-line.done { color: var(--c-success); }
.pm-log-line.done .pm-tick { color: var(--c-success); }
.pm-log-line.error { color: var(--c-danger); }
.pm-log-line.error .pm-tick { color: var(--c-danger); }
.pm-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  padding: 12px 0 6px;
  margin-top: 8px;
  border-top: 1px solid var(--c-border-soft);
  font-family: var(--font-sans); font-size: 12px; color: var(--c-text-mute);
}
.pm-stat { display: flex; flex-direction: column; gap: 2px; text-align: center; padding: 6px; background: var(--c-bg-soft); border-radius: var(--radius); }
.pm-stat span { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--c-primary); }

/* ---------- BI 看板 ---------- */
.bi-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.bi-kpi-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  border-left-width: 4px;
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.bi-kpi-icon { font-size: 26px; }
.bi-kpi-label { font-size: 11.5px; color: var(--c-text-mute); text-transform: uppercase; letter-spacing: 0.3px; }
.bi-kpi-value { font-size: 17px; font-weight: 700; color: var(--c-text); margin-top: 2px; font-family: var(--font-mono); }
.bi-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 900px) { .bi-charts-grid { grid-template-columns: 1fr; } }
.bi-chart-card { padding: 14px 16px; }
.bi-svg { width: 100%; height: auto; }
.bi-empty {
  text-align: center;
  color: var(--c-text-mute);
  padding: 36px 14px;
  font-size: 13px;
  background: var(--c-bg-soft);
  border-radius: var(--radius);
}
.bi-funnel { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.bi-funnel-row { display: flex; align-items: center; gap: 10px; }
.bi-funnel-label { width: 130px; font-size: 12.5px; color: var(--c-text-dim); flex-shrink: 0; }
.bi-funnel-bar-wrap { flex: 1; min-width: 0; background: var(--c-bg-soft); border-radius: 6px; overflow: hidden; height: 32px; }
.bi-funnel-bar {
  height: 100%;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 0 8px;
  line-height: 32px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: width 0.5s ease;
  border-radius: 6px;
}
.bi-gmv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bi-gmv-table th, .bi-gmv-table td { padding: 8px 10px; border-bottom: 1px solid var(--c-border-soft); text-align: left; vertical-align: middle; }
.bi-gmv-table th { background: var(--c-bg-soft); color: var(--c-text-mute); font-weight: 600; font-size: 12px; }
.bi-gmv-dual { display: flex; flex-direction: column; gap: 3px; min-width: 160px; }
.bi-gmv-bar-gmv, .bi-gmv-bar-pay { height: 8px; border-radius: 3px; transition: width 0.5s ease; }
.bi-gmv-bar-gmv { background: #3b82f6; }
.bi-gmv-bar-pay { background: #16a34a; }
.bi-legend { margin-top: 10px; font-size: 12px; color: var(--c-text-dim); display: flex; gap: 16px; }
.bi-leg-gmv::before { content: ''; display: inline-block; width: 10px; height: 10px; background: #3b82f6; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.bi-leg-pay::before { content: ''; display: inline-block; width: 10px; height: 10px; background: #16a34a; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

