.seo-map {
  --seo-dot: color-mix(in srgb, var(--rn-muted) 26%, transparent);
  --seo-track: color-mix(in srgb, var(--rn-muted) 39%, transparent);
  --seo-map-bg: color-mix(in srgb, var(--rn-soft) 69%, var(--rn-bg));
  --seo-root: #fff0c6;
  --seo-root-ink: #553608;
  --seo-root-border: #c18c28;
  color: var(--rn-text);
  border: 1px solid var(--rn-line);
  border-radius: 12px;
  background: var(--rn-bg);
  min-width: 0;
  container-type: inline-size;
}
.dark .seo-map, html:not(.light-ui) .seo-map {
  --seo-root: #3a2e1b;
  --seo-root-ink: #ffe1a0;
  --seo-root-border: #af8237;
}
.seo-map-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 17px 19px;
  border-bottom: 1px solid var(--rn-line);
}
.seo-map h2 { font-size: 19px; font-weight: 650; margin: 0 0 3px; }
.seo-map p { font-size: 13px; color: var(--rn-muted); margin: 0; }
.seo-map a { color: var(--rn-accent); text-decoration: underline; text-underline-offset: 3px; }
.seo-map a:focus-visible { outline: 2px solid var(--rn-accent); outline-offset: 3px; border-radius: 3px; }
.seo-search {
  background: var(--rn-soft);
  border: 1px solid var(--rn-line);
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  width: min(100%, 300px);
  color: var(--rn-muted);
}
.seo-search:focus-within { outline: 2px solid var(--rn-accent); outline-offset: 2px; }
.seo-search svg, .seo-open svg { flex: none; }
.rp-main-new .seo-search input {
  min-height: 42px;
  width: 100%;
  min-width: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--rn-text);
  font: inherit;
  font-size: 14px;
}
.seo-search input::placeholder { color: var(--rn-muted); }
.rp-main-new .seo-search input:focus-visible { outline: none; }
.seo-map-body { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.seo-canvas-shell { min-width: 0; display: grid; grid-template-rows: 1fr auto; }
.seo-canvas {
  position: relative;
  min-width: 0;
  overflow: clip;
  isolation: isolate;
  background: radial-gradient(var(--seo-dot) 0.8px, transparent 0) 50% 50% / 17px 17px, var(--seo-map-bg);
  user-select: none;
  touch-action: pan-y;
  cursor: grab;
}
.seo-canvas[data-zoomed=true] { touch-action: none; }
.seo-canvas[data-dragging=true] { cursor: grabbing; }
.seo-canvas:focus-visible { outline-offset: -3px; }
.seo-stage, .seo-edges { position: absolute; inset: 0; width: 100%; height: 100%; }
.seo-edges { pointer-events: none; fill: none; stroke: var(--seo-track); stroke-width: 1.5; }
.seo-edges path { vector-effect: non-scaling-stroke; }
.seo-edges path[data-active=true] { stroke: var(--rn-accent); stroke-width: 2.5; }
.rp-main-new .seo-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  /* Позиционирование узла сохраняется при общем сбросе transform на hover. */
  translate: -50% -50%;
  border: 1px solid var(--rn-line);
  border-radius: 9px;
  padding: 8px 11px;
  min-height: 0;
  text-align: left;
  color: var(--rn-text);
  background: var(--rn-bg);
  box-shadow: 0 2px 6px #10183012;
  line-height: 1.2;
}
.rp-main-new .seo-node[aria-pressed=true]:not([data-root=true]), .rp-main-new .seo-node:hover {
  border-color: var(--rn-accent);
  background: var(--rn-active);
}
.rp-main-new .seo-node[data-root=true] {
  background: var(--seo-root);
  color: var(--seo-root-ink);
  border-color: var(--seo-root-border);
}
.seo-node-icon {
  flex: none;
  display: grid;
  place-items: center;
  background: var(--rn-soft);
  border-radius: 6px;
  color: var(--rn-accent);
  width: 32px;
  height: 32px;
}
.seo-node[data-root=true] .seo-node-icon { background: transparent; color: var(--seo-root-ink); }
.seo-node-copy { min-width: 0; }
.seo-node-copy strong, .seo-node-copy small { display: block; }
.seo-node-copy strong { font-size: 13px; font-weight: 650; }
.seo-node-copy small { font-size: 12px; margin-top: 3px; color: var(--rn-muted); }
.seo-node[data-root=true] .seo-node-copy strong { font-size: 15px; }
.seo-node[data-root=true] .seo-node-copy small { color: inherit; }
.seo-canvas-toolbar {
  min-height: 58px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--rn-line);
  color: var(--rn-muted);
  font-size: 12px;
}
.seo-zoom { display: flex; align-items: center; gap: 4px; }
.rp-main-new .seo-zoom button {
  display: grid;
  place-items: center;
  padding: 0;
  width: 36px;
  min-height: 36px;
  font-size: 17px;
}
.seo-zoom output { min-width: 42px; color: var(--rn-text); text-align: center; font-variant-numeric: tabular-nums; }
.seo-detail {
  border-left: 1px solid var(--rn-line);
  padding: 14px;
  min-width: 0;
  max-height: 498px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.seo-detail-heading { display: grid; gap: 7px; margin-bottom: 12px; }
.seo-detail h3 { margin: 0; overflow-wrap: anywhere; font-size: 16px; font-weight: 650; }
.seo-detail :is(ul,li) { margin: 0; padding: 0; list-style: none; }
.seo-open { display: inline-flex; align-items: center; width: fit-content; gap: 5px; font-size: 13px; min-height: 32px; }
.rp-main-new .seo-detail .seo-return { width: fit-content; min-height: 32px; padding: 4px 7px; font-size: 12px; }
.seo-detail .seo-topic, .seo-branch-list li { border-top: 1px solid var(--rn-line); }
.rp-main-new .seo-detail :is(.seo-branch-list button, .seo-topic > button) {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto 12px;
  gap: 6px;
  min-height: 43px;
  width: 100%;
  padding: 7px 3px;
  color: var(--rn-text);
  background: transparent;
  border: 0;
  border-radius: 3px;
  font-size: 13px;
  text-align: left;
}
.seo-detail button:hover { color: var(--rn-accent); background: var(--rn-active); }
.seo-detail button small, .seo-page-list small { color: var(--rn-muted); font-size: 12px; }
.seo-detail .seo-page-list { margin: 0 0 5px; }
.seo-page-list li { border-top: 1px solid var(--rn-line); }
.seo-page-list li[data-highlighted=true] { background: var(--rn-active); box-shadow: inset 2px 0 var(--rn-accent); }
.seo-page-list a {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 48px;
  gap: 7px;
  padding: 7px 4px;
  color: var(--rn-text);
  text-decoration: none;
}
.seo-page-list a:hover { color: var(--rn-accent); }
.seo-page-list svg { color: var(--rn-accent); }
.seo-page-list strong, .seo-page-list small { display: block; overflow-wrap: anywhere; }
.seo-page-list strong { font-size: 13px; line-height: 1.35; font-weight: 550; }
.seo-page-list small { margin-top: 3px; }
.rp-main-new .seo-page-list button { min-height: 32px; margin: 0 0 8px; padding: 4px 7px; font-size: 12px; }
.rp-main-new .seo-more { margin: 6px 0 4px; font-size: 13px; }

@container (max-width: 875px) {
  .seo-map-body { grid-template-columns: minmax(0, 1fr); }
  .seo-detail { border-left: 0; border-top: 1px solid var(--rn-line); max-height: none; }
  .seo-map-body[data-search=true] .seo-detail { order: -1; border-top: 0; border-bottom: 1px solid var(--rn-line); }
}
@container (max-width: 500px) {
  .seo-map-heading { align-items: stretch; flex-direction: column; padding: 13px 12px; gap: 10px; }
  .seo-search { width: 100%; }
  .seo-search input { font-size: 16px; }
  .rp-main-new .seo-node { gap: 6px; padding: 6px 7px; }
  .seo-node-icon { width: 24px; height: 28px; }
  .seo-node-icon svg { width: 16px; }
  .seo-node-copy strong { font-size: 12px; }
  .seo-node-copy small { font-size: 11px; }
  .rp-main-new .seo-zoom button { width: 44px; min-height: 44px; }
}

.rp-main-new .seo-plan-primary {
  background: var(--rn-active);
  border-color: var(--rn-accent);
  color: var(--rn-accent);
  font-weight: 650;
}
.rp-main-new .seo-plan-add { flex: none; margin-left: -5px; min-height: 44px; white-space: nowrap; }
.seo-map-heading > div:first-child { flex: 1; }
.seo-plan-item { padding: 9px 5px 2px !important; overflow-wrap: anywhere; }
.seo-plan-item a { min-height: auto; padding: 0; }
.seo-plan-item .seo-plan-status {
  display: inline-block;
  background: var(--rn-active);
  color: var(--rn-accent);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  margin: 5px 0;
}
.seo-plan-item .seo-plan-note { margin: 2px 0 7px; white-space: pre-wrap; }
.seo-plan-item button + button { margin-left: 5px; }
.seo-detail .seo-plan-empty { padding: 4px 4px 11px; }
.seo-detail .seo-plan-feedback { padding: 12px 0 4px; }
.seo-plan-feedback button { margin-top: 5px; }
.seo-plan-editor {
  background: var(--rn-bg);
  color: var(--rn-text);
  border: 1px solid var(--rn-line);
  border-radius: 12px;
  padding: 24px;
  width: min(480px, calc(100% - 24px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
.seo-plan-editor::backdrop { background: #11182791; }
.seo-plan-editor form { display: grid; gap: 13px; }
.seo-plan-editor h2 { margin: 0 0 3px; }
.seo-plan-editor label { display: grid; gap: 5px; color: var(--rn-muted); font-size: 13px; font-weight: 550; }
.rp-main-new .seo-plan-editor :is(input, select, textarea) {
  min-height: 44px;
  width: 100%;
  min-width: 0;
  border-radius: 7px;
  padding: 8px 10px;
  background: var(--rn-soft);
  border: 1px solid var(--rn-line);
  color: var(--rn-text);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
}
.seo-plan-editor textarea { resize: vertical; }
.seo-plan-editor textarea:focus-visible { outline: 3px solid var(--rn-accent); outline-offset: 3px; }
.seo-plan-editor-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 7px; }
.seo-plan-editor-actions button { min-height: 42px; }
.rp-main-new .seo-plan-editor-actions .seo-plan-danger { color: #9b2235; border-color: currentColor; background: var(--rn-bg); }
html:not(.light-ui) .rp-main-new .seo-plan-editor-actions .seo-plan-danger { color: #ffc0c9; }
.seo-plan-delete-title { overflow-wrap: anywhere; }

@container (max-width: 500px) {
  .seo-map-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .seo-search { grid-column: 1 / -1; grid-row: 2; }
  .rp-main-new .seo-plan-add { margin-left: 0; }
  .seo-plan-editor { padding: 17px; }
  .rp-main-new .seo-plan-editor :is(input, select, textarea) { font-size: 16px; }
  .seo-plan-editor-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seo-plan-editor-actions button { min-height: 44px; }
  .seo-plan-editor-actions .seo-plan-danger[type=button] { grid-column: 1 / -1; justify-self: start; }
}
