/* ============================================================
   思维导图 · 界面样式
   设计语言参考 XMind 桌面版：浅灰工具条 + 白色面板 + 蓝色强调色
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --brand: #2f6bff;
  --brand-weak: #eaf0ff;
  --brand-strong: #1d4fd8;

  --bg-app: #ffffff;
  --bg-chrome: #fbfbfc;
  --bg-stage: #fafafa;
  --bg-panel: #ffffff;
  --bg-hover: #f1f2f4;
  --bg-active: #e8eaee;
  --bg-input: #ffffff;

  --line: #e6e8eb;
  --line-strong: #d6d9de;

  --text: #1f2329;
  --text-2: #5c636e;
  --text-3: #8f959e;
  --text-inv: #ffffff;

  --radius: 7px;
  --radius-lg: 12px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-2: 0 8px 28px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .06);
  --shadow-3: 0 18px 50px rgba(16, 24, 40, .18);

  --topbar-h: 50px;
  --toolbar-h: 46px;
  --pane-w: 286px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html[data-mode="dark"] {
  --brand: #5b8cff;
  --brand-weak: #1e2740;
  --brand-strong: #7ba4ff;

  --bg-app: #17181b;
  --bg-chrome: #1c1d21;
  --bg-stage: #202124;
  --bg-panel: #1c1d21;
  --bg-hover: #26282d;
  --bg-active: #2f3238;
  --bg-input: #26282d;

  --line: #2c2e34;
  --line-strong: #3a3d44;

  --text: #e8eaed;
  --text-2: #a8adb7;
  --text-3: #7c828c;

  --shadow-1: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, .55);
  --shadow-3: 0 18px 50px rgba(0, 0, 0, .65);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-app);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
/* 图标样式只作用于界面外壳，绝不要碰画布里的引擎 SVG
   （写全局 svg{} 会把画布压成 18px，画布就"看起来是空的"） */
.topbar svg, .toolbar svg, .pane svg, .zoombar svg, .fab svg,
.drawer svg, .popmenu svg, .modal svg, .empty svg, .docitem svg, .findbar svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
[hidden] { display: none !important; }
kbd {
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-active); border: 1px solid var(--line-strong);
  border-radius: 4px; padding: 2px 5px;
}

.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 12px;
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--line);
  -webkit-app-region: drag;
}
.topbar button, .topbar input { -webkit-app-region: no-drag; }
.topbar__left, .topbar__right { display: flex; align-items: center; gap: 4px; }

.brand {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 9px 5px 6px; border-radius: var(--radius);
}
.brand:hover { background: var(--bg-hover); }
.brand__mark { width: 21px; height: 21px; color: var(--brand); stroke-width: 1.7; }
.brand__mark circle { fill: var(--brand-weak); }
.brand__text { font-weight: 600; font-size: 13.5px; letter-spacing: .2px; }

.docbar { display: flex; align-items: center; gap: 8px; padding-left: 6px; margin-left: 4px;
          border-left: 1px solid var(--line); height: 22px; }
.docbar__name {
  font-size: 13px; color: var(--text-2); padding: 3px 7px;
  border-radius: 5px; max-width: 260px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.docbar__name:hover { background: var(--bg-hover); color: var(--text); }
.docbar__state { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.docbar__state[data-state="saving"] { color: var(--brand); }
.docbar__state[data-state="dirty"] { color: #d98800; }
.docbar__state[data-state="error"] { color: #e5484d; }

/* ---------- 按钮 ---------- */
.tbtn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px; border-radius: var(--radius);
  color: var(--text-2); font-size: 12.5px; white-space: nowrap;
  transition: background .12s, color .12s;
}
.tbtn:hover { background: var(--bg-hover); color: var(--text); }
.tbtn:active { background: var(--bg-active); }
.tbtn.is-on { background: var(--brand-weak); color: var(--brand); }
.tbtn--primary { background: var(--brand); color: var(--text-inv); padding: 0 13px; font-weight: 500; }
.tbtn--primary:hover { background: var(--brand-strong); color: var(--text-inv); }
.tbtn--icon { padding: 0 7px; }
.tbtn svg { width: 16px; height: 16px; }
html[data-mode="dark"] .ico-sun { display: none; }
html[data-mode="light"] .ico-moon, :root:not([data-mode="dark"]) .ico-moon { display: none; }

.vsep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; flex: 0 0 auto; }

/* ---------- 工具条 ---------- */
.toolbar {
  height: var(--toolbar-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: 2px;
  padding: 0 10px; background: var(--bg-app);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }
.toolbar__group { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; }
.toolbar__end { margin-left: auto; padding-left: 14px; flex: 0 0 auto; }
.hint { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

.ibtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 32px; min-width: 32px; padding: 0 7px; border-radius: var(--radius);
  color: var(--text-2); flex: 0 0 auto;
  transition: background .12s, color .12s;
}
.ibtn:hover { background: var(--bg-hover); color: var(--text); }
.ibtn:active { background: var(--bg-active); }
.ibtn.is-disabled { opacity: .34; pointer-events: none; }
.ibtn.is-on { background: var(--brand-weak); color: var(--brand); }
.ibtn svg { width: 17px; height: 17px; }
.ibtn span { font-size: 12.5px; }
.ibtn--wide { padding: 0 8px; }
.ibtn--wide .caret { width: 13px; height: 13px; opacity: .55; }

/* ---------- 工作区 ---------- */
.work { flex: 1 1 auto; display: flex; min-height: 0; background: var(--bg-stage); }

.stage { flex: 1 1 auto; position: relative; min-width: 0; overflow: hidden; }
.canvas { position: absolute; inset: 0; }

/* ---------- 侧栏面板 ---------- */
.pane {
  flex: 0 0 var(--pane-w); width: var(--pane-w);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-panel); z-index: 5;
}
.pane--left { border-right: 1px solid var(--line); }
.pane--right { border-left: 1px solid var(--line); }
.pane__head {
  height: 42px; flex: 0 0 auto; display: flex; align-items: center;
  justify-content: space-between; padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px;
}
.pane__close {
  width: 26px; height: 26px; border-radius: 5px; color: var(--text-3);
  font-size: 17px; line-height: 1; display: grid; place-items: center;
}
.pane__close:hover { background: var(--bg-hover); color: var(--text); }
.pane__body { flex: 1 1 auto; overflow: auto; min-height: 0; }
.pane__foot {
  flex: 0 0 auto; display: flex; gap: 6px; padding: 10px;
  border-top: 1px solid var(--line);
}
.pane__foot .btn { flex: 1 1 0; }

/* ---------- 大纲 ---------- */
.outline { padding: 8px 6px 20px; }
.ol-node { display: flex; flex-direction: column; }
.ol-row {
  display: flex; align-items: flex-start; gap: 5px;
  padding: 3px 6px; border-radius: 5px; cursor: default; position: relative;
}
.ol-row:hover { background: var(--bg-hover); }
.ol-row.is-active { background: var(--brand-weak); }
.ol-row.is-active .ol-text { color: var(--brand); font-weight: 500; }
.ol-toggle {
  width: 16px; height: 18px; flex: 0 0 16px; display: grid; place-items: center;
  color: var(--text-3); font-size: 10px; border-radius: 3px;
}
.ol-toggle:hover { background: var(--bg-active); }
.ol-toggle.is-leaf { visibility: hidden; }
.ol-text {
  flex: 1 1 auto; font-size: 12.5px; line-height: 18px; color: var(--text);
  word-break: break-word; white-space: pre-wrap;
}
.ol-badge { font-size: 10px; color: var(--text-3); flex: 0 0 auto; }
.ol-children { margin-left: 13px; border-left: 1px solid var(--line); padding-left: 2px; }
.ol-children[hidden] { display: none; }
.ol-empty { padding: 30px 16px; text-align: center; color: var(--text-3); font-size: 12.5px; }

/* ---------- 缩放条 ---------- */
.zoombar {
  position: absolute; right: 16px; bottom: 16px; z-index: 4;
  display: flex; align-items: center; gap: 1px;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: var(--shadow-1); padding: 3px;
}
.zoombar__btn {
  width: 28px; height: 28px; border-radius: 6px; color: var(--text-2);
  display: grid; place-items: center; font-size: 16px;
}
.zoombar__btn:hover { background: var(--bg-hover); color: var(--text); }
.zoombar__btn svg { width: 15px; height: 15px; }
.zoombar__val {
  min-width: 48px; height: 28px; border-radius: 6px; color: var(--text-2);
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.zoombar__val:hover { background: var(--bg-hover); color: var(--text); }
.zoombar__sep { width: 1px; height: 16px; background: var(--line); margin: 0 2px; }

/* ---------- 浮动命令条 ---------- */
.fab {
  position: absolute; z-index: 6; display: flex; gap: 1px;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow-2); padding: 2px;
}
.fab__btn {
  width: 26px; height: 26px; border-radius: 6px; color: var(--text-2);
  font-size: 14px; line-height: 1; display: grid; place-items: center;
}
.fab__btn:hover { background: var(--brand-weak); color: var(--brand); }

/* ---------- 搜索条 ---------- */
.findbar {
  position: absolute; top: 12px; right: 16px; z-index: 7;
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: var(--shadow-2); padding: 4px 5px;
}
.findbar input {
  width: 190px; height: 28px; padding: 0 8px; border: 0; outline: 0;
  background: transparent; font-size: 12.5px;
}
.findbar__count { font-size: 11.5px; color: var(--text-3); min-width: 42px; text-align: center;
                  font-variant-numeric: tabular-nums; }
.findbar__nav, .findbar__close {
  width: 26px; height: 26px; border-radius: 6px; color: var(--text-2); font-size: 13px;
  display: grid; place-items: center;
}
.findbar__nav:hover, .findbar__close:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- 空状态 ---------- */
.empty {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 30px; text-align: center; background: var(--bg-stage);
}
.empty__icon svg { width: 54px; height: 54px; color: var(--brand); stroke-width: 1.4; }
.empty__icon svg circle { fill: var(--brand-weak); }
.empty h2 { margin: 10px 0 0; font-size: 17px; font-weight: 600; }
.empty p { margin: 0; color: var(--text-2); font-size: 12.5px; }
.empty__acts { display: flex; gap: 8px; margin-top: 16px; }

/* ---------- 面板控件 ---------- */
.sec { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec__title {
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  letter-spacing: .4px; margin-bottom: 9px; text-transform: uppercase;
}
.row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.row:last-child { margin-bottom: 0; }
.row__label { flex: 0 0 52px; font-size: 12px; color: var(--text-2); }
.row__ctl { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; }

.shapes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.shape {
  aspect-ratio: 1; border-radius: 5px; display: grid; place-items: center;
  border: 1px solid transparent; color: var(--text-2);
}
.shape:hover { background: var(--bg-hover); }
.shape.is-on { background: var(--brand-weak); border-color: var(--brand); color: var(--brand); }
.shape svg { width: 20px; height: 20px; }

.swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.swatch {
  aspect-ratio: 1; border-radius: 5px; border: 1px solid rgba(0,0,0,.09);
  position: relative;
}
html[data-mode="dark"] .swatch { border-color: rgba(255,255,255,.14); }
.swatch:hover { transform: scale(1.12); }
.swatch.is-on { box-shadow: 0 0 0 2px var(--bg-panel), 0 0 0 3.5px var(--brand); }
.swatch--none {
  background-image: linear-gradient(45deg, transparent 44%, #e5484d 44%, #e5484d 56%, transparent 56%);
  background-color: var(--bg-input);
}
.swatch--transparent { background-image:
  linear-gradient(45deg, #cfd3d8 25%, transparent 25%, transparent 75%, #cfd3d8 75%),
  linear-gradient(45deg, #cfd3d8 25%, transparent 25%, transparent 75%, #cfd3d8 75%);
  background-size: 8px 8px; background-position: 0 0, 4px 4px; background-color: #fff; }

.sel, .num, .txt {
  height: 30px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--bg-input); color: var(--text); padding: 0 8px;
  outline: 0; width: 100%; min-width: 0; font-size: 12.5px;
}
.sel:focus, .num:focus, .txt:focus { border-color: var(--brand); }
.sel { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
                    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
.num { width: 62px; flex: 0 0 62px; text-align: center; }

.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg__btn {
  flex: 1 1 0; height: 28px; display: grid; place-items: center;
  color: var(--text-2); font-size: 12.5px; border-right: 1px solid var(--line-strong);
}
.seg__btn:last-child { border-right: 0; }
.seg__btn:hover { background: var(--bg-hover); }
.seg__btn.is-on { background: var(--brand-weak); color: var(--brand); font-weight: 500; }
.seg__btn svg { width: 15px; height: 15px; }

.btn {
  height: 32px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--bg-input);
  color: var(--text); font-size: 12.5px; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-hover); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--text-inv); font-weight: 500; }
.btn--primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn--block { width: 100%; }
.btn--danger { color: #e5484d; border-color: transparent; background: transparent; }
.btn--danger:hover { background: rgba(229,72,77,.1); }

.muted { color: var(--text-3); font-size: 11.5px; line-height: 1.6; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 主题网格 ---------- */
.themegrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; padding: 12px; }
.themecard {
  border: 1px solid var(--line); border-radius: 9px; overflow: hidden;
  padding: 0; background: var(--bg-input); text-align: left;
  transition: border-color .12s, box-shadow .12s;
}
.themecard:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.themecard.is-on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.themecard__view { height: 64px; padding: 8px; display: flex; align-items: center; gap: 6px; }
.themecard__dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.themecard__bars { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }
.themecard__bar { height: 5px; border-radius: 3px; opacity: .85; }
.themecard__bar:nth-child(2) { width: 74%; opacity: .62; }
.themecard__bar:nth-child(3) { width: 52%; opacity: .42; }
.themecard__name {
  padding: 6px 9px; font-size: 11.5px; color: var(--text-2);
  border-top: 1px solid var(--line); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.themecard.is-on .themecard__name { color: var(--brand); font-weight: 500; }

/* ---------- 抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer__mask { position: absolute; inset: 0; background: rgba(16,24,40,.32); }
.drawer__panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 342px;
  background: var(--bg-panel); box-shadow: var(--shadow-3);
  display: flex; flex-direction: column;
  animation: slideIn .18s ease;
}
@keyframes slideIn { from { transform: translateX(-16px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer__head {
  height: 48px; flex: 0 0 auto; display: flex; align-items: center;
  justify-content: space-between; padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line); font-weight: 600;
}
.drawer__body { flex: 1 1 auto; overflow: auto; padding: 8px; }
.drawer__foot { flex: 0 0 auto; padding: 10px; display: flex; flex-direction: column; gap: 7px;
                border-top: 1px solid var(--line); }
.drawer__note { flex: 0 0 auto; padding: 0 14px 14px; font-size: 11px; color: var(--text-3); line-height: 1.6; }

.docitem {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 8px; text-align: left; margin-bottom: 2px;
}
.docitem:hover { background: var(--bg-hover); }
.docitem.is-on { background: var(--brand-weak); }
.docitem__ico { width: 20px; height: 20px; flex: 0 0 auto; color: var(--brand); }
.docitem__main { flex: 1 1 auto; min-width: 0; }
.docitem__name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docitem.is-on .docitem__name { color: var(--brand); font-weight: 500; }
.docitem__meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.docitem__more {
  width: 26px; height: 26px; border-radius: 6px; color: var(--text-3);
  flex: 0 0 auto; display: grid; place-items: center; font-size: 15px; line-height: 1;
}
.docitem__more:hover { background: var(--bg-active); color: var(--text); }

/* ---------- 弹出菜单 ---------- */
.popmenu {
  position: fixed; z-index: 60; min-width: 178px; max-height: 70vh; overflow: auto;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: var(--shadow-2); padding: 5px;
}
.popmenu__item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border-radius: 6px; font-size: 12.5px; text-align: left;
  color: var(--text);
}
.popmenu__item:hover { background: var(--bg-hover); }
.popmenu__item.is-on { background: var(--brand-weak); color: var(--brand); font-weight: 500; }
.popmenu__item svg { width: 16px; height: 16px; color: var(--text-3); flex: 0 0 auto; }
.popmenu__item.is-on svg { color: var(--brand); }
.popmenu__item[disabled] { opacity: .4; pointer-events: none; }
.popmenu__item.has-sub { align-items: flex-start; }
.popmenu__label { flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.popmenu__sub { font-size: 11px; color: var(--text-3); font-weight: 400; line-height: 1.45; }
.popmenu__item.has-sub svg { margin-top: 2px; }
.popmenu__hint { font-size: 11px; color: var(--text-3); flex: 0 0 auto; }
.popmenu__sep { height: 1px; background: var(--line); margin: 5px 4px; }
.popmenu__head {
  padding: 6px 9px 4px; font-size: 11px; font-weight: 600;
  color: var(--text-3); letter-spacing: .3px;
}

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; }
.modal__mask { position: absolute; inset: 0; background: rgba(16,24,40,.36); }
.modal__panel {
  position: relative; width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 80px); display: flex; flex-direction: column;
  background: var(--bg-panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3); overflow: hidden;
}
.modal__head {
  height: 50px; flex: 0 0 auto; display: flex; align-items: center;
  justify-content: space-between; padding: 0 10px 0 18px;
  border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px;
}
.modal__body { flex: 1 1 auto; overflow: auto; padding: 18px; }
.modal__foot {
  flex: 0 0 auto; display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--line);
}
.modal textarea.txt { height: 168px; padding: 9px 10px; resize: vertical; line-height: 1.62;
                      font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field__label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }

/* ---------- 节点图标选择器 ---------- */
.iconpicker { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; max-height: 340px; overflow: auto; }
.iconpicker__group { grid-column: 1 / -1; font-size: 11px; color: var(--text-3); padding: 8px 0 2px; font-weight: 600; }
.iconpicker__item {
  aspect-ratio: 1; border-radius: 6px; display: grid; place-items: center;
  font-size: 18px; line-height: 1; border: 1px solid transparent;
}
.iconpicker__item:hover { background: var(--bg-hover); }
.iconpicker__item.is-on { background: var(--brand-weak); border-color: var(--brand); }
.iconpicker__item img, .iconpicker__item svg { width: 20px; height: 20px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  z-index: 90; background: rgba(28,32,38,.94); color: #fff;
  padding: 9px 17px; border-radius: 9px; font-size: 12.5px;
  box-shadow: var(--shadow-2); animation: toastIn .18s ease;
  max-width: 70vw; text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 小地图 ---------- */
.smm-minimap {
  position: absolute !important; right: 16px; bottom: 62px; z-index: 4;
  border: 1px solid var(--line) !important; border-radius: 9px;
  box-shadow: var(--shadow-1); overflow: hidden;
  background: var(--bg-panel) !important;
}

/* ---------- 引擎内部元素适配 ---------- */

/* ★ 必须清零节点内容里富文本元素的默认边距。
   引擎把节点文字放在 <foreignObject> 里的 <p> 中，而 foreignObject 会把内容
   裁剪到自身高度（约 20px）；<p> 默认的 1em 上下边距会把文字整个顶出裁剪区，
   表现为「节点框画出来了，但框里一个字都没有」，且没有任何报错。
   这条规则缺失时整张导图的文字全部不可见。 */
.smm-richtext-node-wrap,
.smm-richtext-node-wrap *,
.smm-text-node-wrap,
.smm-text-node-wrap * {
  margin: 0;
  padding: 0;
}

.smm-node-text-edit, .smm-node-note-tooltip, .smm-associative-line-text-edit {
  font-family: var(--font) !important;
}
.smm-node-note-tooltip { border-radius: 8px !important; box-shadow: var(--shadow-2) !important; }
.smm-richtext-edit { border-radius: 8px !important; }

/* 关联线/外框等操作触点颜色跟随品牌色 */
html[data-mode="dark"] .smm-minimap { opacity: .92; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .pane { --pane-w: 252px; }
  .hint { display: none; }
}
@media (max-width: 860px) {
  .pane { position: absolute; top: 0; bottom: 0; box-shadow: var(--shadow-3); }
  .pane--left { left: 0; }
  .pane--right { right: 0; }
  .docbar { display: none; }
  .toolbar { padding: 0 6px; }
  .ibtn span { display: none; }
  .ibtn--wide span { display: inline; }
  .zoombar { right: 10px; bottom: 10px; }
  .brand__text { display: none; }
}
@media (max-width: 620px) {
  .tbtn span { display: none; }
  .themegrid { grid-template-columns: 1fr; }
}
