:root {
  --proj-blue: #3b82f6;
  --proj-violet: #8b5cf6;
  --proj-green: #22c55e;
  --proj-warm: #f97316;
  --proj-rose: #ec4899;
  --proj-gray: #94a3b8;
  --st-todo: #a8b0bd;
  --st-doing: #2f7ef7;
  --st-blocked: #e5484d;
  --st-done: #2fa96b;
  --st-skip: #cdd3dc;
  --radius: 10px;
  --node-w: 236px;
  /* 模块卡片字号档位，由 JS 按 config.uiScale 写在 html 上；卡片内文字全部按 em 同比缩放 */
  --fs: 1;
  --font: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

html[data-theme="light"] {
  --bg: #f7f7f5;
  --bg-2: #ffffff;
  --grid: #e3e3de;
  --ink: #1d1f24;
  --ink-2: #5c6473;
  --ink-3: #98a1b0;
  --line-1: #9aa4b2;
  --accent: #e2590b;
  --accent-soft: #fdf0e6;
  --warm: #d98a04;
  --danger: #d8352c;
  --border: #e2e2dd;
  --shadow: 0 1px 2px rgba(20, 22, 28, 0.06), 0 6px 18px rgba(20, 22, 28, 0.06);
  --scrim: rgba(28, 30, 36, 0.34);
}

html[data-theme="dark"] {
  --bg: #14161a;
  --bg-2: #1c1f25;
  --grid: #23272f;
  --ink: #e8eaef;
  --ink-2: #a5adbb;
  --ink-3: #6e7787;
  --line-1: #6e7787;
  --accent: #ff8a3d;
  --accent-soft: #2a2118;
  --warm: #ffc44d;
  --danger: #ff6b63;
  --border: #2a2f38;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
  --scrim: rgba(6, 8, 12, 0.6);
  --st-todo: #6e7787;
  --st-skip: #454c58;
}

* { box-sizing: border-box; }
/* 作者样式会盖掉 hidden 属性的 UA 默认值，这里统一兜底，保证 hidden 真的能隐藏 */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; }
kbd {
  font: 11px var(--mono);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  color: var(--ink-3);
  background: var(--bg);
}
code { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--ink-3); }
.tiny { font-size: 11.5px; }
.grow { flex: 1; }
.sep { width: 1px; height: 18px; background: var(--border); }

/* ---------- 布局 ---------- */
/* 列宽必须写 minmax(0,1fr)：1fr 的最小值是 auto，顶栏/状态栏那排不换行的按钮会把整列撑得比屏幕宽，
   画布跟着变宽之后贴在画布右缘的滚动条就跑到工作区中间去了。 */
#app { display: grid; height: 100dvh; max-width: 100vw; }
#app[data-nav="top"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "topbar" "navzone" "stage" "status";
}
#app[data-nav="right"] {
  grid-template-columns: minmax(0, 1fr) 244px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "topbar topbar" "stage navzone" "status navzone";
}
/* 左侧竖排：和右侧镜像，列宽一致，画布让出的空间也一样多 */
#app[data-nav="left"] {
  grid-template-columns: 244px minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "topbar topbar" "navzone stage" "navzone status";
}
#topbar { grid-area: topbar; }
#navzone { grid-area: navzone; }
#stage { grid-area: stage; }
#statusbar { grid-area: status; }

#topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  height: 46px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; letter-spacing: 0.2px; display: flex; align-items: center; gap: 7px; }
.brand-mark { color: var(--accent); font-size: 17px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.save { font-size: 12px; color: var(--ink-3); min-width: 86px; text-align: right; }
.save.is-error { color: var(--danger); font-weight: 600; }

#statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  height: 42px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}
.zoombox { display: flex; align-items: center; gap: 3px; }
#zoom-reset { min-width: 52px; }

/* ---------- 项目导航 ---------- */
#navzone {
  background: var(--bg-2);
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  min-width: 0;
}
#app[data-nav="top"] #navzone { border-bottom: 1px solid var(--border); padding: 6px 12px; }
#app[data-nav="right"] #navzone {
  flex-direction: column;
  align-items: stretch;
  border-left: 1px solid var(--border);
  padding: 10px;
  gap: 10px;
}
#nav { display: flex; gap: 8px; overflow: auto; scrollbar-width: thin; flex: 1; min-width: 0; }
#app[data-nav="right"] #nav { flex-direction: column; align-items: stretch; overflow-y: auto; }
#app[data-nav="left"] #navzone {
  flex-direction: column;
  align-items: stretch;
  border-right: 1px solid var(--border);
  padding: 10px;
  gap: 10px;
}
#app[data-nav="left"] #nav { flex-direction: column; align-items: stretch; overflow-y: auto; }
.nav-empty { color: var(--ink-3); font-size: 12.5px; padding: 6px 8px; }
.nav-add {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--radius);
  padding: 6px 11px;
  white-space: nowrap;
}
.nav-add:hover { border-color: var(--accent); color: var(--accent); }

.pitem {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px 6px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  position: relative;
  max-width: 260px;
}
.pitem::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--pc);
  opacity: 0.55;
}
.pitem:hover { border-color: var(--pc); }
.pitem.is-active { background: var(--accent-soft); border-color: var(--accent); }
.pitem.is-active::before { opacity: 1; }
.pitem-icon { color: var(--pc); font-weight: 700; }
.pitem-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pitem-count { font-size: 11px; color: var(--ink-3); background: var(--bg-2); border-radius: 8px; padding: 1px 6px; }
.pitem-pin { color: var(--warm); font-size: 11px; }
.pitem-menu { border: 0; background: transparent; color: var(--ink-3); padding: 0 3px; border-radius: 5px; }
.pitem-menu:hover { color: var(--ink); background: var(--bg-2); }

/* ---------- 画布 ---------- */
#stage { position: relative; overflow: hidden; }
#canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: default;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid) 1.1px, transparent 1.1px);
  background-size: 22px 22px;
}
#canvas.is-panning { cursor: grabbing; }
#world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
#edge-svg { position: absolute; pointer-events: none; overflow: visible; }
#node-layer { position: absolute; left: 0; top: 0; }
.hint {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translateX(-50%);
  text-align: center;
  color: var(--ink-3);
  line-height: 2;
  pointer-events: none;
  max-width: 520px;
}

/* ---------- 工作备注条（画布顶部常驻，可折叠） ---------- */
/* right 让开 13px，否则贴在右缘的竖向滚动条会被盖住 */
.notebar {
  position: absolute;
  left: 0;
  top: 0;
  right: 14px;
  z-index: 16;
  background: color-mix(in srgb, var(--bg-2) 94%, transparent);
  border-bottom: 1px solid var(--border);
}
.nb-head { display: flex; align-items: center; gap: 8px; padding: 4px 10px; min-height: 28px; }
.nb-toggle {
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.nb-toggle:hover { background: var(--bg); color: var(--ink); }
.nb-peek {
  flex: 1;
  margin: 0;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nb-peek.is-empty { color: var(--ink-3); }
.nb-edit {
  display: none;
  width: calc(100% - 20px);
  margin: 0 10px 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.7;
  resize: vertical;
}
.nb-edit:focus { outline: none; border-color: var(--accent); }
.notebar.is-open .nb-edit { display: block; }
.notebar.is-open .nb-peek { display: none; }

/* ---------- 连线 ---------- */
.edge .hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.edge .wire { fill: none; stroke-width: 1.6; stroke-linecap: round; pointer-events: none; }
.edge.c-line .wire { stroke: var(--line-1); }
.edge.c-accent .wire { stroke: var(--accent); }
.edge.c-warm .wire { stroke: var(--warm); }
.edge.c-danger .wire { stroke: var(--danger); }
.edge.is-dash .wire { stroke-dasharray: 6 5; }
.edge.is-sel .wire { stroke-width: 2.6; }
.edge:hover .wire { stroke-width: 2.4; }
.edge-label rect { fill: var(--bg); stroke: var(--border); }
.edge-label text { font-size: 11px; fill: var(--ink-2); text-anchor: middle; }
.temp { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-dasharray: 5 4; }

/* ---------- 模块卡片 ---------- */
.node {
  position: absolute;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0 0 0.5em;
  font-size: calc(14px * var(--fs));
  user-select: none;
  cursor: grab;
}
.node:hover { border-color: var(--nc); }
/* 位置锁定后卡片不能拖，把手型光标收掉，别让「 grabbing」骗人手 */
#canvas.is-locked .node { cursor: default; }
.node.is-sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.node.is-link-target { border-color: var(--accent); border-style: dashed; }
.node.is-flash { animation: flash 1.3s ease-out; }
@keyframes flash {
  0%, 100% { box-shadow: var(--shadow); }
  30% { box-shadow: 0 0 0 5px var(--accent); }
}
.node-grip {
  display: flex;
  align-items: center;
  gap: 0.29em;
  padding: 0.36em 0.43em 0 0.57em;
  border-top: 3px solid var(--nc);
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--nc) 9%, transparent), transparent);
}
.node-grip .icon-btn { padding: 0.1em 0.36em; font-size: 0.95em; }
.node-status {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--nc);
  font-size: 0.786em;
  font-weight: 700;
  border-radius: 20px;
  padding: 0.08em 0.57em;
}
.node-status:hover { background: var(--nc); color: #fff; border-color: transparent; }
.node-collapse, .node-more { margin-left: auto; }
.node-more { margin-left: 0; }
.node-title {
  font-weight: 700;
  padding: 0.43em 0.72em 0.14em;
  line-height: 1.35;
  outline: none;
  cursor: text;
  word-break: break-word;
}
.node-title:empty::before, .node-body:empty::before { content: attr(data-ph); color: var(--ink-3); font-weight: 400; }
.node-title:focus, .node-body:focus, .rich-editor:focus { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.node-body {
  padding: 0 0.72em 0.29em;
  color: var(--ink-2);
  font-size: 0.893em;
  line-height: 1.6;
  outline: none;
  cursor: text;
  word-break: break-word;
  max-height: calc(190px * var(--fs));
  /* 卡片文字多时靠这条内部滚动条上下看，滚动条走 `canvas.js` 的
     onWheel：正文还能滚就让它自己滚，滚到头才轮到工作区平移。 */
  overflow-x: hidden;
  overflow-y: auto;
}
.node-body p { margin: 0 0 0.29em; }
.node-subs { list-style: none; margin: 0.14em 0 0; padding: 0 0.72em; }
.node-subs li { display: flex; gap: 0.43em; font-size: 0.857em; color: var(--ink-2); padding: 0.14em 0; border-top: 1px dashed var(--border); }
.node-subs li:first-child { border-top: 0; }
.node-subs li::before { content: "·"; color: var(--nc); font-weight: 700; }
.sub-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-n { color: var(--ink-3); font-size: 0.917em; }
.node-att { display: flex; flex-wrap: wrap; gap: 0.29em; padding: 0.29em 0.72em 0; }
.chip {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0.43em;
  font-size: 0.786em;
  padding: 0.14em 0.43em;
  color: var(--ink-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-missing { border-color: var(--danger); color: var(--danger); }
.node-foot { display: flex; gap: 0.43em; padding: 0.36em 0.72em 0; flex-wrap: wrap; }
.meta { font-size: 0.786em; color: var(--ink-3); }
.tag { font-size: 0.786em; color: var(--accent); }
.node.is-collapsed .node-foot { display: none; }
.node.is-collapsed { padding-bottom: 0.43em; }
.port {
  position: absolute;
  top: 50%;
  width: calc(11px * var(--fs));
  height: calc(11px * var(--fs));
  margin-top: calc(-5.5px * var(--fs));
  border-radius: 50%;
  background: var(--bg-2);
  border: 1.5px solid var(--line-1);
  opacity: 0.6;
  transition: opacity 0.12s, transform 0.12s;
}
.node:hover .port, .node.is-sel .port { opacity: 1; }
.port-in { left: calc(-6px * var(--fs)); }
.port-out { right: calc(-6px * var(--fs)); cursor: crosshair; border-color: var(--accent); background: var(--accent-soft); }
.port:hover { transform: scale(1.4); box-shadow: 0 0 0 3px var(--accent-soft); }
/* 拖动磁吸时出现的临时中心线参考，松手即消失 */
.guide {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
  opacity: 0.9;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}
/* 画布右缘 / 底缘滚动条：world 是 transform 位移，用自定义条表示当前位置 */
.scroll {
  position: absolute;
  z-index: 14;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  transition: opacity 0.15s;
}
.scroll.is-h { left: 0; right: 13px; bottom: 2px; height: 11px; cursor: ew-resize; }
.scroll.is-v { top: 0; bottom: 13px; right: 2px; width: 11px; cursor: ns-resize; }
.scroll .thumb { position: absolute; background: var(--line-1); border-radius: 8px; opacity: 0.5; }
.scroll:hover .thumb { opacity: 0.9; }
.scroll.is-h .thumb { top: 2px; bottom: 2px; min-width: 24px; cursor: grab; }
.scroll.is-v .thumb { left: 2px; right: 2px; min-height: 24px; cursor: grab; }
.scroll.is-idle { opacity: 0.3; }
.scroll.is-idle:hover { opacity: 1; }
#marquee {
  position: absolute;
  inset: auto;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  pointer-events: none;
  z-index: 5;
}

/* ---------- 通用控件 ---------- */
.btn {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 7px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
a.btn { text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn--primary:hover { filter: brightness(1.06); color: #fff; }
.btn--ghost { background: transparent; }
.btn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.icon-btn { border: 0; background: transparent; color: var(--ink-3); border-radius: 6px; padding: 2px 5px; }
.icon-btn:hover { color: var(--ink); background: var(--bg); }
.mini { border: 1px solid var(--border); background: var(--bg-2); border-radius: 6px; padding: 2px 8px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.mini:hover { border-color: var(--accent); color: var(--accent); }
.mini.is-danger:hover { border-color: var(--danger); color: var(--danger); }
.field {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  border-radius: 7px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.field:focus { border-color: var(--accent); background: var(--bg-2); }
.field.is-num { width: 74px; }
.field.is-kind { width: 96px; flex: none; }
.field.is-wide { flex: 1; min-width: 0; }
textarea.field { resize: vertical; line-height: 1.6; }
.rich-editor {
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px;
  background: var(--bg);
  font-size: 13px;
  line-height: 1.7;
  outline: none;
}
.segment { display: flex; flex-wrap: wrap; gap: 4px; }
.seg {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--ink-2);
}
.seg:hover { border-color: var(--seg, var(--accent)); }
.seg.is-on { background: var(--seg, var(--accent)); border-color: transparent; color: #fff; font-weight: 600; }

/* ---------- 详情抽屉 ---------- */
#inspector {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 372px;
  max-width: 88vw;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 26px rgba(0, 0, 0, 0.08);
  transform: translateX(102%);
  transition: transform 0.18s ease-out;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
#inspector.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.drawer-head strong { flex: 1; }
#drawer-body { overflow: auto; padding: 12px; flex: 1; scrollbar-width: thin; }
.drawer-head-line { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.node-tag { font-size: 11px; font-weight: 700; color: var(--nc, var(--accent)); border: 1px solid currentColor; border-radius: 20px; padding: 1px 7px; }
.sec { margin: 0 0 16px; padding: 0; border: 0; }
.sec h4 { font-size: 12px; margin: 0 0 7px; color: var(--ink-3); font-weight: 700; letter-spacing: 0.4px; display: flex; gap: 8px; align-items: baseline; }
.sec-hint { font-weight: 400; font-size: 11px; color: var(--ink-3); }
.rows { display: flex; flex-direction: column; gap: 7px; }
.lrow { display: grid; grid-template-columns: 78px 1fr; gap: 8px; align-items: center; }
.lrow:has(> .segment) { align-items: start; }
.llabel { font-size: 12px; color: var(--ink-2); }
.itemrow, .attrow, .edgerow { display: flex; gap: 5px; align-items: center; }
.attrow { flex-wrap: wrap; }
.edgerow .oname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.edgerow .dir { color: var(--accent); font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tipbox {
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

/* ---------- 弹层 / 菜单 / 提示 ---------- */
#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.scrim { position: absolute; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; pointer-events: auto; }
.dialog {
  pointer-events: auto;
  width: min(460px, 92vw);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 14px 16px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.dialog.is-wide { width: min(780px, 94vw); }
.dialog h3 { margin: 0 0 8px; font-size: 15px; }
.dialog-body { color: var(--ink-2); font-size: 13px; line-height: 1.7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.dialog-scroll { overflow: auto; }
.dialog-scroll h5 { margin: 14px 0 6px; font-size: 12.5px; color: var(--accent); }
.dialog-scroll p { margin: 0 0 8px; line-height: 1.8; font-size: 13px; color: var(--ink-2); }
.dialog-head { display: flex; align-items: center; margin-bottom: 6px; }
.dialog-head h3 { flex: 1; margin: 0; }
.kv { font-size: 12.5px; color: var(--ink-2); }
.keys { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.keys td { border-bottom: 1px solid var(--border); padding: 5px 6px; color: var(--ink-2); }
.keys td:first-child { color: var(--ink); font-family: var(--mono); white-space: nowrap; width: 40%; }
.menu {
  position: absolute;
  pointer-events: auto;
  min-width: 190px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 5px;
  z-index: 95;
}
.menu-item {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: baseline;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 13px;
}
.menu-item:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.menu-item:disabled { color: var(--ink-3); cursor: default; font-weight: 600; }
.menu-item.is-danger { color: var(--danger); }
.menu-label { flex: 1; }
.menu-hint { font-size: 11px; color: var(--ink-3); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.toast {
  position: absolute;
  left: 50%;
  bottom: 62px;
  transform: translate(-50%, 12px);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ink-3);
  border-radius: 9px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  transition: 0.2s;
  pointer-events: auto;
  max-width: 74vw;
}
.toast.is-in { opacity: 1; transform: translate(-50%, 0); }
.toast--ok { border-left-color: var(--st-done); }
.toast--warn { border-left-color: var(--warm); }
.toast--info { border-left-color: var(--proj-blue); }
.banner { background: var(--danger); color: #fff; padding: 10px 14px; font-size: 13px; }

/* ---------- 搜索面板 ---------- */
#search { position: fixed; inset: 0; z-index: 80; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; padding-top: 8vh; }
.search-inner { width: min(620px, 92vw); background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); padding: 10px; }
.search-top { display: flex; align-items: center; gap: 8px; }
.search-top .icon-btn { flex: none; }
#search-input { flex: 1; min-width: 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--ink); font: inherit; font-size: 15px; padding: 6px 4px 9px; outline: none; }
#search-results { max-height: 52vh; overflow: auto; margin-top: 6px; }
.sres {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0 10px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 7px 9px;
  align-items: baseline;
}
.sres:hover, .sres.is-first { background: var(--accent-soft); }
.sres-proj { font-size: 11.5px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sres-title { font-weight: 600; font-size: 13px; }
.sres-snip { grid-column: 2; font-size: 12px; color: var(--ink-3); line-height: 1.6; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
