/* ═══════════════════════════════════════════════════════════════
   Netfold UI kit · верхний тулбар, название карты, вкладки,
   плавающая панель форматирования (#floating-md-toolbar)
   ═══════════════════════════════════════════════════════════════ */

.nf-bar[hidden] { display: none !important; }
/* общая «плашка» для всех плавающих элементов редактора */
.nf-bar {
  display: flex; align-items: center; gap: 2px; box-sizing: border-box;
  background: var(--nf-panel-bg); color: var(--nf-ink);
  border: var(--nf-panel-bw) solid var(--nf-panel-line); border-radius: calc(var(--nf-panel-r) - 4px);
  box-shadow: var(--nf-float-shadow);
  font: 500 13.5px/1 var(--nf-font-ui);
}
body.theme-netfold .nf-bar { box-shadow: 3px 3px 0 #16181D; }
body.theme-botanical .nf-bar { border-radius: 999px; }
.nf-bar svg { width: var(--nf-icon); height: var(--nf-icon); flex: none; }
.nf-bar :focus-visible { outline: 2px solid var(--nf-focus); outline-offset: 1px; }

/* ── Название карты + статус синхронизации ── */
.nf-mapname { height: var(--nf-toolbar-h); padding: 0 6px 0 14px; gap: 10px; max-width: 340px; }
.nf-mapname .nm-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--nf-title-font); font-weight: var(--nf-title-weight); font-size: 14px; letter-spacing: -.01em;
}
.nf-sync { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border-radius: 8px; font: 500 11px var(--nf-font-mono); color: var(--nf-muted); white-space: nowrap; }
.nf-sync svg { width: 16px; height: 16px; }
.nf-sync.is-ok svg { color: #2E9E5B; }
body.theme-midnight .nf-sync.is-ok svg { color: #5EEAA0; }
.nf-sync.is-offline { background: color-mix(in srgb, var(--nf-accent-2) 22%, transparent); color: var(--nf-ink); }

/* ── Тулбар ── */
.nf-toolbar { height: var(--nf-toolbar-h); padding: 0 5px; }
.nf-tb {
  height: 34px; min-width: 34px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: var(--nf-ctl-r); background: transparent; color: inherit; cursor: pointer; font: inherit; white-space: nowrap;
}
body.theme-botanical .nf-tb { border-radius: 999px; }
.nf-tb:hover { background: var(--nf-ctl-bg-hover); }
.nf-tb[aria-pressed="true"] { background: var(--nf-ctl-on-bg); color: var(--nf-ctl-on-fg); }
.nf-tb:disabled { opacity: .35; cursor: default; background: none; }
.nf-tb .caret { width: 14px; height: 14px; opacity: .6; margin-left: -2px; }
.nf-tb.is-label { padding: 0 10px 0 8px; }
.nf-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--nf-line); flex: none; }
body.theme-netfold .nf-sep { background: rgba(22,24,29,.18); }
@media (pointer: coarse) { .nf-tb { height: 40px; min-width: 40px; } .nf-toolbar, .nf-mapname { height: 50px; } }

/* выпадающее меню «Вид» */
.nf-menu { position: absolute; min-width: 230px; padding: 6px; flex-direction: column; align-items: stretch; gap: 0; }
.nf-menu .mi { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--nf-ctl-r); border: 0; background: none; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.nf-menu .mi:hover { background: var(--nf-ctl-bg-hover); }
.nf-menu .mi span { flex: 1; }
.nf-menu .mi kbd { font: 500 11px var(--nf-font-mono); color: var(--nf-muted); }
.nf-menu .mi .on { width: 16px; height: 16px; color: var(--nf-accent); }
body.theme-netfold .nf-menu .mi .on { color: #2F45FF; }
.nf-menu hr { border: 0; border-top: 1px solid var(--nf-line); margin: 6px 4px; }

/* ── Вкладки открытых карт ── */
.nf-maptabs { display: flex; align-items: center; gap: 6px; }
.map-tab {
  height: 32px; max-width: 220px; display: inline-flex; align-items: center; gap: 6px; padding: 0 6px 0 12px;
  border-radius: var(--nf-ctl-r); border: 1px solid var(--nf-line); background: var(--nf-panel-bg); color: var(--nf-ink);
  font: 500 12.5px var(--nf-font-ui); cursor: pointer;
}
.map-tab .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-tab .x { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; opacity: .55; }
.map-tab .x svg { width: 13px; height: 13px; }
.map-tab:hover .x, .map-tab.active .x { opacity: .9; }
.map-tab.active { background: var(--nf-ctl-on-bg); color: var(--nf-ctl-on-fg); border-color: transparent; }
.map-tab-add { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--nf-ctl-r); border: 1.5px dashed color-mix(in srgb, var(--nf-ink) 35%, transparent); background: transparent; color: var(--nf-muted); cursor: pointer; }
.map-tab-add svg { width: 16px; height: 16px; }
body.theme-netfold .map-tab { border: 1.5px solid #16181D; box-shadow: 2px 2px 0 #16181D; }
body.theme-netfold .map-tab.active { background: #2F45FF; color: #fff; border-color: #16181D; }
body.theme-midnight .map-tab { font-family: var(--nf-font-mono); font-size: 12px; }
body.theme-midnight .map-tab.active { background: #0D1220; color: #6EE7FF; border-color: #6EE7FF; }
body.theme-botanical .map-tab, body.theme-botanical .map-tab-add { border-radius: 999px; }
body.theme-atelier .map-tab { font-family: var(--nf-font-head); }

/* ── Плавающая панель форматирования ── */
.nf-float { height: 42px; padding: 0 4px; position: absolute; z-index: 30; }
.nf-float .nf-tb { height: var(--nf-ctl-h-sm); min-width: var(--nf-ctl-h-sm); padding: 0 6px; }
.nf-float .nf-tb svg { width: 17px; height: 17px; }
.nf-float .ff-font { width: 104px; justify-content: space-between; padding: 0 6px 0 10px; font-weight: 500; }
.nf-float .ff-size { display: inline-flex; align-items: center; height: var(--nf-ctl-h-sm); border-radius: var(--nf-ctl-r); background: var(--nf-ctl-bg); }
.nf-float .ff-size .nf-tb { min-width: 24px; padding: 0; }
.nf-float .ff-size .nf-tb svg { width: 13px; height: 13px; }
.nf-float .ff-size output { min-width: 22px; text-align: center; font: 600 12.5px var(--nf-font-mono); }
.nf-float::after { /* хвостик к ноде */
  content: ""; position: absolute; left: var(--tail, 40px); bottom: -7px; width: 12px; height: 12px;
  background: var(--nf-panel-bg); transform: rotate(45deg);
  border-right: var(--nf-panel-bw) solid var(--nf-panel-line); border-bottom: var(--nf-panel-bw) solid var(--nf-panel-line);
}
body.theme-netfold .nf-float::after { border-color: #16181D; border-width: 0 1.5px 1.5px 0; }
body.theme-botanical .nf-float::after { display: none; }
@media (max-width: 700px) {
  /* на телефоне панель форматирования прилипает над клавиатурой и прокручивается вбок */
  .nf-float { position: fixed; left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(keyboard-inset-height, 0px)); overflow-x: auto; }
  .nf-float::after { display: none; }
}

/* ── Подсказка снизу: только для новых пользователей, исчезает после первых действий ── */
.nf-hint { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); height: 36px; padding: 0 14px; gap: 10px; font-size: 13px; }
.nf-hint kbd { font: 600 11.5px var(--nf-font-mono); padding: 3px 6px; border-radius: 6px; background: var(--nf-ctl-bg); }
.nf-zoom { position: absolute; right: 16px; bottom: 16px; height: 36px; padding: 0 3px; }
.nf-zoom output { min-width: 46px; text-align: center; font: 600 12px var(--nf-font-mono); }
.nf-zoom .nf-tb { height: 30px; min-width: 30px; padding: 0; }
.nf-zoom .nf-tb svg { width: 16px; height: 16px; }
