/* ============================================================
   Visio 风格（浅色专业绘图工具）——默认主题
   白色绘图页 + 浅灰功能区 + 蓝色强调色
   ============================================================ */
.theme-visio body {
  background: #f3f3f3;
  color: #262626;
  font-family: "微软雅黑", "Segoe UI", system-ui, sans-serif;
}
.theme-visio body::before,
.theme-visio body::after { display: none; }

/* ---- 顶部：菜单 + 功能区 ---- */
.theme-visio .ide-menubar {
  background: #f3f3f3;
  border: 1px solid #d9d9d9;
  border-bottom: none;
  border-radius: 0;
  color: #333;
  height: 26px;
}
.theme-visio .ide-menubar .menu-item {
  color: #333;
  border-radius: 0;
  padding: 2px 9px;
  transition: background 0.12s;
}
.theme-visio .ide-menubar .menu-item:hover { background: #e5f1fb; color: #1a73c9; }
.theme-visio .ide-menubar .menu-item:first-child { background: #1a73c9; color: #fff; }
.theme-visio .ide-menubar .menu-item:first-child:hover { background: #155ea6; color: #fff; }
.theme-visio .menubar-title { color: #8c8c8c; }
.theme-visio .topbar {
  background: #ffffff;
  border: 1px solid #d9d9d9;
  border-radius: 0;
  box-shadow: none;
  padding: 6px 12px;
}
.theme-visio .brand-logo {
  background: #1a73c9;
  color: #fff;
  border-radius: 3px;
  box-shadow: none;
  width: 30px; height: 30px;
  font-size: 16px;
}
.theme-visio .brand-name { color: #1a1a1a; font-size: 13px; }
.theme-visio .brand-sub { color: #8c8c8c; font-size: 10px; }
.theme-visio .topbar .field-label { color: #595959; }
.theme-visio .input,
.theme-visio .topbar .input {
  background: #ffffff;
  border: 1px solid #bfbfbf;
  color: #262626;
  border-radius: 2px;
  height: 30px;
}
.theme-visio .input:focus,
.theme-visio .topbar .input:focus { border-color: #1a73c9; box-shadow: 0 0 0 2px rgba(26, 115, 201, 0.15); }
.theme-visio .topbar .btn,
.theme-visio .btn {
  background: #ffffff;
  border: 1px solid #bfbfbf;
  color: #262626;
  border-radius: 2px;
  height: 30px;
  font-size: 12px;
}
.theme-visio .topbar .btn:hover,
.theme-visio .btn:hover { background: #e5f1fb; border-color: #1a73c9; color: #1a73c9; }
.theme-visio .btn.primary {
  background: #1a73c9;
  border-color: #1a73c9;
  color: #fff;
  border-radius: 2px;
}
.theme-visio .btn.primary:hover { background: #155ea6; border-color: #155ea6; }
.theme-visio .btn.danger-ghost { background: #fff; border-color: #d9a1a1; color: #b34343; }

/* ---- 三栏 ---- */
.theme-visio #app { gap: 0; padding: 0; }
.theme-visio .main { gap: 0; background: #d9d9d9; }
.theme-visio .palette,
.theme-visio .inspector {
  background: #fafafa;
  border: 1px solid #d9d9d9;
  border-radius: 0;
  box-shadow: none;
}
.theme-visio .palette-head,
.theme-visio .inspector-head {
  background: #f0f0f0;
  color: #262626;
  border-bottom: 1px solid #d9d9d9;
  font-size: 11px;
  font-weight: 700;
  padding: 7px 10px;
}
.theme-visio .palette-search {
  background: #fff;
  border: 1px solid #bfbfbf;
  border-radius: 2px;
  color: #262626;
}
.theme-visio .palette-search:focus { border-color: #1a73c9; box-shadow: none; }
.theme-visio .palette-list { padding: 6px; }
.theme-visio .palette-group { margin-bottom: 8px; }
.theme-visio .palette-group-title {
  color: #595959;
  font-size: 10.5px;
  margin: 2px 4px 5px;
  display: flex;
  justify-content: space-between;
}
.theme-visio .palette-group-title::before { content: "▾"; color: #8c8c8c; background: none; }
.theme-visio .palette-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
.theme-visio .tile {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  padding: 6px 8px;
  transition: background 0.12s, border-color 0.12s;
}
.theme-visio .tile:hover { background: #e5f1fb; border-color: #1a73c9; transform: none; }
.theme-visio .tile::before { display: none; }
.theme-visio .tile-name { color: #262626; font-size: 11.5px; }
.theme-visio .tile-short { color: #8c8c8c; font-size: 9.5px; }
.theme-visio .tile-link { background: #f7f7f7; border-color: #d9d9d9; }
.theme-visio .tile-link .tile-short { color: #1a73c9; }
.theme-visio .tile-link.skip .tile-short { color: #c55a11; }
.theme-visio .palette-tip {
  background: #fafafa;
  border-top: 1px solid #d9d9d9;
  color: #8c8c8c;
  font-size: 10px;
  line-height: 1.6;
}

/* ---- 编辑器标签 → Visio 文档标签 ---- */
.theme-visio .editor-tabs {
  background: #f0f0f0;
  border: 1px solid #d9d9d9;
  border-bottom: 1px solid #d9d9d9;
  border-radius: 0;
  height: 28px;
}
.theme-visio .editor-tab { color: #595959; border-right: 1px solid #e0e0e0; font-size: 11px; }
.theme-visio .editor-tab.active { background: #ffffff; color: #1a1a1a; border-radius: 0; }
.theme-visio .editor-tab.active::before {
  background: #1a73c9;
  height: 2px;
  border-radius: 0;
  top: auto; bottom: 0;
}
.theme-visio .editor-tab .file-dot { background: #1a73c9; }
.theme-visio .editor-tab.python .file-dot { background: #c55a11; }
.theme-visio .editor-tabs .tab-hint { color: #8c8c8c; }

/* ---- 画布：白色绘图页 + 细网格 ---- */
.theme-visio .canvas {
  background-color: #ffffff;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.045) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid #b3b3b3;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px #ffffff, 0 0 18px rgba(0, 0, 0, 0.10);
  margin: 8px;
}
.theme-visio .canvas::after { display: none; }
.theme-visio .canvas-title { color: #b0b0b0; bottom: 6px; right: 10px; }
.theme-visio .marquee {
  border: 1px dashed #1a73c9;
  background: rgba(26, 115, 201, 0.08);
  border-radius: 0;
}

/* ---- 节点：Visio 流程图色块 ---- */
.theme-visio .node {
  background: #cfe4fb;
  border: 1.5px solid #5b9bd5;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  padding: 8px 11px 9px;
}
.theme-visio .node::before { display: none; }
.theme-visio .node:hover { border-color: #1a73c9; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); }
.theme-visio .node.selected {
  border-color: #1a73c9;
  box-shadow: 0 0 0 2px rgba(26, 115, 201, 0.35);
  animation: none;
}
.theme-visio .node-title { color: #1a1a1a; font-family: "微软雅黑", "Segoe UI", sans-serif; font-size: 12px; }
.theme-visio .node-type { color: #5a6b7d; font-size: 9px; }
.theme-visio .node-summary { color: #3f4d5c; font-size: 10px; }
.theme-visio .node-shape {
  background: #ffffff;
  border: 1px solid #9dc3e6;
  color: #1f4e79;
  border-radius: 2px;
  font-family: Consolas, monospace;
}
.theme-visio .node.has-error { border-color: #c00000; background: #fde9e9; }
.theme-visio .port {
  background: #ffffff;
  border: 2px solid #1a73c9;
  border-radius: 2px;
  width: 9px; height: 9px;
}
.theme-visio .port:hover { background: #1a73c9; box-shadow: 0 0 0 2px rgba(26, 115, 201, 0.2); }

/* ---- 块：Visio 组合形状 ---- */
.theme-visio .node.block {
  border: 2px solid #2e75b6;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}
.theme-visio .node.block::after { border: none; }
.theme-visio .node.block.circle { border-radius: 50%; }
.theme-visio .node.block .block-name { color: #1a1a1a; font-family: "微软雅黑", sans-serif; font-weight: 700; }
.theme-visio .node.block .block-meta { color: #2f4f66; opacity: 0.9; }
.theme-visio .node.block:hover { transform: none; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.24); }

/* ---- 连线：Visio 细直角连接线 ---- */
.theme-visio .edge-path { stroke: #404040; stroke-width: 1.5; }
.theme-visio .edge-path.edge-skip { stroke: #c55a11; stroke-width: 1.8; }
.theme-visio .edge-path.edge-selected { stroke: #1a73c9 !important; stroke-width: 2.2; }
.theme-visio .edge-plus { fill: #c55a11; }
.theme-visio .edge-g:hover .edge-path:not(.edge-skip) { stroke: #1a73c9; }
.theme-visio .edge-g:hover .edge-path.edge-skip { stroke: #e06b1f; }
.theme-visio .edge-temp { stroke: #1a73c9; }
.theme-visio #arrow path { fill: #404040; }
.theme-visio #arrow-skip path { fill: #c55a11; }

/* ---- 右侧大小和位置 ---- */
.theme-visio .insp-title { color: #1a1a1a; }
.theme-visio .insp-sub { color: #8c8c8c; }
.theme-visio .insp-shape {
  background: #e5f1fb;
  border: 1px solid #9dc3e6;
  color: #1f4e79;
  border-radius: 2px;
}
.theme-visio .insp-section-title { color: #8c8c8c; }
.theme-visio .field-row label { color: #404040; }
.theme-visio .field-row:hover { background: #f0f0f0; }
.theme-visio .field-row input[type="number"],
.theme-visio .field-row input[type="text"],
.theme-visio .field-row select {
  background: #ffffff;
  border: 1px solid #bfbfbf;
  color: #262626;
  border-radius: 2px;
  height: 26px;
}
.theme-visio .field-row input:focus { border-color: #1a73c9; }
.theme-visio .switch { background: #e0e0e0; border: 1px solid #bfbfbf; border-radius: 3px; }
.theme-visio .switch::after { background: #8c8c8c; border-radius: 2px; }
.theme-visio .switch.on { background: #cfe4fb; border-color: #5b9bd5; }
.theme-visio .switch.on::after { background: #1a73c9; }
.theme-visio .insp-error { background: #fde9e9; border: 1px solid #e8b4b4; color: #a23b3b; }

/* ---- 状态栏：Visio 页面状态 ---- */
.theme-visio .statusbar {
  background: #f0f0f0;
  border: 1px solid #d9d9d9;
  border-top: none;
  color: #595959;
  height: 26px;
  border-radius: 0;
}
.theme-visio .status-left { font-size: 10.5px; }
.theme-visio .chip { background: transparent; border: none; color: #595959; font-size: 10.5px; padding: 0; }
.theme-visio .chip .dot { background: #1a73c9; }
.theme-visio #zoomText { color: #595959; }
.theme-visio .icon-btn {
  background: #ffffff;
  border: 1px solid #bfbfbf;
  color: #262626;
  border-radius: 2px;
  width: 24px; height: 20px;
  font-size: 11px;
}
.theme-visio .icon-btn:hover { background: #e5f1fb; border-color: #1a73c9; }
.theme-visio .ide-status-item { color: #8c8c8c; }
.theme-visio .statusbar::before {
  content: "第 1 页 / 共 1 页  ·  12:15";
  order: 99;
  margin-left: auto;
  margin-right: 8px;
  color: #8c8c8c;
  font-size: 10px;
}

/* ---- 弹窗 ---- */
.theme-visio .modal-mask { background: rgba(0, 0, 0, 0.28); backdrop-filter: none; }
.theme-visio .modal {
  background: #ffffff;
  border: 1px solid #bfbfbf;
  border-radius: 4px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}
.theme-visio .modal-head {
  background: #f0f0f0;
  color: #262626;
  border-bottom: 1px solid #d9d9d9;
  border-radius: 4px 4px 0 0;
}
.theme-visio .modal-foot {
  background: #f7f7f7;
  border-top: 1px solid #d9d9d9;
  border-radius: 0 0 4px 4px;
}
.theme-visio .modal-field > label { color: #595959; }
.theme-visio .code-view {
  background: #fafafa;
  border: 1px solid #d9d9d9;
  color: #262626;
  border-radius: 2px;
}
.theme-visio .shape-option { background: #fff; border: 1px solid #bfbfbf; border-radius: 2px; color: #404040; }
.theme-visio .shape-option.active { background: #e5f1fb; border-color: #1a73c9; color: #1a73c9; }
.theme-visio .shape-option .shape-preview { border-color: #8c8c8c; }

/* ---- 修正：形状面板分组标题 / 状态栏按钮 ---- */
.theme-visio .palette-group-title { justify-content: flex-start; gap: 4px; }
.theme-visio .palette-group-title::before { content: "▾"; }
.theme-visio .icon-btn.wide { width: auto; padding: 0 10px; white-space: nowrap; }

/* ---- Visio 形状分类配色（按层的类别上色） ---- */
.theme-visio .node { background: #eef3f9; border-color: #5b9bd5; }
.theme-visio .node[data-category="conv"] { background: #dae8f7; border-color: #5b9bd5; }
.theme-visio .node[data-category="pool"] { background: #fff2cc; border-color: #d6b656; }
.theme-visio .node[data-category="activation"] { background: #d5e8d4; border-color: #82b366; }
.theme-visio .node[data-category="norm"] { background: #e1d5e7; border-color: #9673a6; }
.theme-visio .node[data-category="fc"] { background: #f8cecc; border-color: #b85450; }
.theme-visio .node[data-category="input"] { background: #f5f5f5; border-color: #808080; }
.theme-visio .node[data-category="upsample"] { background: #d0f0ee; border-color: #3fa39b; }
.theme-visio .node[data-category="attention"] { background: #ffe6cc; border-color: #d79b00; }
.theme-visio .node[data-category="regular"] { background: #eeeeee; border-color: #999999; }
.theme-visio .node[data-category="tool"] { background: #eaeaea; border-color: #7f7f7f; }
.theme-visio .node[data-category] .node-shape { background: #ffffff; }

/* 去掉画布网格：纯色绘图页 */
.theme-visio .canvas { background-image: none; }

/* ================= Visio 功能区 ================= */
.theme-visio .ribbon-tabs {
  display: flex; align-items: center; height: 24px;
  background: #1a73c9; padding: 0 8px; gap: 2px; flex-shrink: 0;
}
.theme-visio .rtab { color: #dbeaf9; font-size: 11px; padding: 3px 10px; border-radius: 2px 2px 0 0; cursor: default; }
.theme-visio .rtab:hover { background: rgba(255,255,255,.15); color: #fff; }
.theme-visio .rtab.active { background: #f3f3f3; color: #1a1a1a; }
.theme-visio .rtab-spacer { flex: 1; }
.theme-visio .rtab-hint { color: #cfe4fb; font-size: 10px; }
.theme-visio .ribbon {
  display: flex; align-items: stretch; gap: 0; flex-shrink: 0;
  background: #f0f0f0; border: 1px solid #d9d9d9; border-bottom: none;
  padding: 0 6px; height: 62px; overflow: hidden;
}
.theme-visio .ribbon-group {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 5px 10px 2px; border-right: 1px solid #dcdcdc; min-width: 0;
}
.theme-visio .ribbon-group.grow { margin-left: auto; border-right: none; }
.theme-visio .rg-body { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.theme-visio .rg-label { font-size: 9px; color: #8c8c8c; text-align: center; padding-top: 2px; }
.theme-visio .rbtn {
  background: transparent; border: 1px solid transparent; border-radius: 2px;
  font-size: 11px; color: #262626; padding: 3px 8px; cursor: pointer; white-space: nowrap;
}
.theme-visio .rbtn:hover { background: #dbeaf9; border-color: #9dc3e6; }
.theme-visio .rbtn.icon { font-size: 11px; padding: 2px 5px; }
.theme-visio .rbtn.primary { background: #1a73c9; color: #fff; border-color: #1a73c9; }
.theme-visio .rbtn.primary:hover { background: #155ea6; }
.theme-visio .rselect, .theme-visio .rinput {
  height: 21px; border: 1px solid #bfbfbf; background: #fff; color: #262626;
  font-size: 10.5px; border-radius: 2px; padding: 0 4px;
}
.theme-visio .rselect.small { width: 52px; }
.theme-visio .rfield { display: flex; align-items: center; gap: 4px; font-size: 10px; color: #595959; }
.theme-visio .rinput { width: 92px; }
.theme-visio .rg-font { gap: 3px; }
.theme-visio .rg-font .rselect { width: 76px; }

/* ================= 标尺 + 页标签 ================= */
.theme-visio .workspace { position: relative; }
.theme-visio .ruler-top {
  position: absolute; left: 18px; right: 0; top: 28px; height: 16px;
  background:
    repeating-linear-gradient(90deg, #e6e6e6 0 1px, transparent 1px 10px),
    repeating-linear-gradient(90deg, #b3b3b3 0 1px, transparent 1px 50px),
    #f7f7f7;
  border-bottom: 1px solid #d9d9d9; z-index: 4; pointer-events: none;
}
.theme-visio .ruler-left {
  position: absolute; left: 0; top: 44px; bottom: 26px; width: 18px;
  background:
    repeating-linear-gradient(180deg, #e6e6e6 0 1px, transparent 1px 10px),
    repeating-linear-gradient(180deg, #b3b3b3 0 1px, transparent 1px 50px),
    #f7f7f7;
  border-right: 1px solid #d9d9d9; z-index: 4; pointer-events: none;
}
.theme-visio .canvas { margin: 16px 8px 6px 18px; }
.theme-visio .page-tabs {
  display: flex; align-items: center; gap: 2px; padding: 0 8px; height: 22px;
  background: #f0f0f0; border-top: 1px solid #d9d9d9; flex-shrink: 0;
}
.theme-visio .ptab {
  font-size: 10px; padding: 2px 10px; border: 1px solid transparent;
  border-bottom: none; color: #595959; background: transparent; cursor: default;
}
.theme-visio .ptab.active { background: #fff; border-color: #d9d9d9; color: #1a1a1a; }
.theme-visio .ptab-add { font-size: 11px; color: #8c8c8c; padding: 0 6px; }

/* 组件库形状图标：Visio 模具小色块 */
.theme-visio .tile .tile-icon {
  display: inline-flex; width: 12px; height: 12px; border-radius: 2px;
  background: var(--cat, #8b86a8); opacity: 0.9; margin-right: 5px;
  font-size: 0;
}
.theme-visio .tile .tile-top { gap: 0; }

/* 功能区存在时隐藏旧顶栏，界面更接近 Visio */
.theme-visio .topbar { display: none; }
.theme-visio .ruler-top { top: 32px; height: 16px; left: 18px; }
.theme-visio .ruler-left { top: 32px; bottom: 26px; }
.theme-visio .canvas { margin: 18px 8px 6px 18px; }

/* ================= 收敛：功能区更素 ================= */
.theme-visio .ribbon-tabs { background: #f0f0f0; border-bottom: 1px solid #d9d9d9; }
.theme-visio .rtab { color: #595959; }
.theme-visio .rtab:hover { background: #e0e0e0; color: #1a1a1a; }
.theme-visio .rtab.active { background: #ffffff; color: #1a73c9; box-shadow: inset 0 -2px 0 #1a73c9; }
.theme-visio .rtab-hint { color: #a6a6a6; }
.theme-visio .ribbon { background: #fafafa; height: 52px; padding: 0 4px; }
.theme-visio .ribbon-group { padding: 3px 8px 1px; border-right: 1px solid #e8e8e8; }
.theme-visio .rg-label { font-size: 8.5px; color: #b0b0b0; }
.theme-visio .rbtn { font-size: 10.5px; color: #404040; padding: 2px 7px; }
.theme-visio .rbtn:hover { background: #e8f1fb; border-color: #c9dff2; }
.theme-visio .rbtn.primary { background: #1a73c9; color: #fff; }
.theme-visio .rselect, .theme-visio .rinput { height: 20px; font-size: 10px; }
/* 组件库恢复纯净：不显示彩色模具块 */
.theme-visio .tile .tile-icon { display: none; }
.theme-visio .tile { padding: 7px 9px 6px; }
.theme-visio .palette-group-title .group-count { color: #b3b3b3; font-weight: 500; }
.theme-visio .palette-head .ph-badge { background: transparent; color: #a6a6a6; }
.theme-visio .palette-tip .tip-key { color: #a6a6a6; font-weight: 500; }

/* 收敛：只保留功能工具栏，不复制 Visio 装饰 */
.theme-visio .ide-menubar,
.theme-visio .ribbon-tabs,
.theme-visio .editor-tabs,
.theme-visio .page-tabs,
.theme-visio .ruler-top,
.theme-visio .ruler-left { display: none !important; }
.theme-visio .ribbon { height: 56px; border-top: none; }
.theme-visio .canvas { margin: 8px; }
.theme-visio .workspace { gap: 8px; }

/* 版式兜底：固定三栏，忽略残留装饰节点 */
.theme-visio .editor-tab, .theme-visio .tab-hint, .theme-visio .ribbon-tabs .rtab { display: none !important; }
.theme-visio .palette { position: fixed; left: 0; top: 56px; bottom: 30px; width: 252px; z-index: 6; }
.theme-visio .inspector { position: fixed; right: 0; top: 56px; bottom: 30px; width: 300px; z-index: 6; }
.theme-visio .workspace {
  position: fixed; left: 252px; right: 300px; top: 56px; bottom: 30px; z-index: 5;
  display: flex; flex-direction: column; padding: 6px 8px 0;
}
.theme-visio .canvas { flex: 1; min-height: 0; margin: 0; border-radius: 0; }
.theme-visio .statusbar { flex-shrink: 0; }
.theme-visio .ribbon { height: 56px; }

.theme-visio .workspace > *:not(#canvas):not(.statusbar):not(.code-drawer) { display: none !important; }
.theme-visio .ribbon { align-items: center; }

/* 画布铺满工作区：无限画布 */
.theme-visio .workspace { padding: 0; background: #ffffff; }
.theme-visio .canvas { flex: 1; margin: 0; border-radius: 0; }
