/* ============================================================
   POWER MAP styles
   ============================================================ */
.pm-stage{
  position: relative;
  width: 100%;
  overflow: visible;
}
.pm-canvas{
  position: absolute; top: 0; left: 0;
  transform-origin: top left;
}
.pm-svg{ position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.pm-edge{ transition: stroke-width .25s, opacity .35s; }

.pm-elabel{
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 10.5px; font-weight: 500; letter-spacing: .01em;
  color: var(--ec, var(--ink-2));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
  box-shadow: var(--sh-1);
  text-align: center;
  transform: translateX(-50%);
  margin-left: 50%;
  line-height: 1.3;
}

/* ---------- Node ---------- */
.pm-node{
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 11px;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 5px;
  padding: 11px 14px;
  cursor: pointer;
  box-shadow: var(--sh-1);
  font-family: var(--ff-sans);
  transition: box-shadow .2s, border-color .2s, transform .28s cubic-bezier(.4,.5,.2,1), opacity .3s, left .42s cubic-bezier(.4,.4,.2,1), top .42s cubic-bezier(.4,.4,.2,1);
  border-top: 3px solid var(--nc);
}
.pm-node:hover{
  box-shadow: var(--sh-2);
  border-color: color-mix(in srgb, var(--nc) 45%, var(--line));
  transform: translate(-50%, -50%) translateY(-2px);
}
.pm-node.is-sel{
  border-color: var(--nc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--nc) 18%, transparent), var(--sh-2);
}
.pm-node.is-dashed{ border-style: dashed; border-top-style: solid; background: var(--surface-2); }
.pm-node.is-wide{ border-radius: 14px; }

.pm-node-ic{
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 5px;
}
.pm-node-body{ display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pm-node-label{ font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); line-height: 1.15; }
.pm-node-tag{ font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.pm-node.is-wide .pm-node-label{ font-size: 15px; }
.pm-node.is-wide .pm-node-tag{ font-size: 11px; }
.pm-node-stat{
  margin-left: auto; flex: none;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  padding-left: 10px;
}

/* ---------- Node style variants (tweakable) ---------- */
/* minimal: drop the icon chip, lighter card */
.nodestyle-minimal .pm-node{ padding: 9px 14px; border-radius: 999px; box-shadow: var(--sh-1); }
.nodestyle-minimal .pm-node-ic{
  width: 12px; height: 12px; border-radius: 999px; background: var(--nc) !important; color: transparent !important;
}
.nodestyle-minimal .pm-node-ic svg{ display: none; }
.nodestyle-minimal .pm-node.is-wide{ border-radius: 22px; }

/* solid: filled with branch tint, stronger identity */
.nodestyle-solid .pm-node{
  background: var(--nsoft);
  border-color: color-mix(in srgb, var(--nc) 30%, var(--line));
  border-top-width: 1.5px;
}
.nodestyle-solid .pm-node-ic{ background: var(--surface) !important; }
.nodestyle-solid .pm-node-label{ color: color-mix(in srgb, var(--nc) 72%, #11161f); }

/* ---------- Map toolbar ---------- */
.pm-toolbar{
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.pm-seg{
  display: inline-flex; align-items: center;
  background: var(--bg-2);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.pm-seg button{
  font-family: var(--ff-sans);
  font-size: 13px; font-weight: 600;
  border: none; background: transparent; color: var(--ink-2);
  padding: 6px 13px; border-radius: 7px; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.pm-seg button:hover{ color: var(--ink); }
.pm-seg button.is-on{ background: var(--surface); color: var(--accent-ink); box-shadow: var(--sh-1); }
.pm-seg.pm-seg--layout button.is-on{ color: var(--ink); }

.pm-tool-label{
  font-family: var(--ff-mono);
  font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint);
  margin-right: -6px;
}
.pm-hint{ font-size: 12.5px; color: var(--muted); margin-left: auto; display:flex; align-items:center; gap:7px; }

/* ---------- Legend ---------- */
.pm-legend{
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 11px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.pm-legend .li{ display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.pm-legend .sw{ width: 11px; height: 11px; border-radius: 3px; }
.pm-legend .li.note{ margin-left: auto; color: var(--muted); font-size: 11.5px; }

/* ---------- Drawer ---------- */
.pm-drawer-scrim{
  position: absolute; inset: 0;
  background: rgba(20,26,36,.10);
  backdrop-filter: blur(1px);
  border-radius: var(--r-lg);
  animation: fadeIn .2s ease;
  z-index: 8;
}
.pm-drawer{
  position: absolute; top: 12px; right: 12px; bottom: 12px;
  width: 372px; max-width: calc(100% - 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-pop);
  z-index: 9;
  display: flex; flex-direction: column;
  animation: drawerIn .26s cubic-bezier(.2,.7,.2,1);
  overflow: hidden;
}
.pm-drawer-head{ padding: 18px 18px 14px; border-bottom: 1px solid var(--line-2); position: relative; }
.pm-drawer-x{
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--muted);
  transition: background .15s, color .15s;
}
.pm-drawer-x:hover{ background: var(--bg-2); color: var(--ink); }
.pm-drawer-branch{ display:inline-flex; align-items:center; gap:7px; font-family: var(--ff-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.pm-drawer-title{ font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin: 9px 0 3px; }
.pm-drawer-sub{ font-size: 13px; color: var(--muted); }
.pm-drawer-body{ padding: 16px 18px; overflow-y: auto; flex: 1; }
.pm-sect{ margin-bottom: 18px; }
.pm-sect h4{ font-family: var(--ff-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: 9px; }
.pm-list{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pm-list li{ display: flex; gap: 9px; font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.pm-list li svg{ flex: none; margin-top: 2px; color: var(--nc); }
.pm-tags{ display: flex; flex-wrap: wrap; gap: 7px; }
.pm-tag{ font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--bg-2); border-radius: 7px; padding: 5px 10px; }
.pm-note{ font-size: 12.5px; color: var(--ink-2); background: var(--c-justice-soft); border: 1px solid #cfe5df; border-radius: 9px; padding: 11px 12px; display:flex; gap:9px; line-height: 1.45; }
.pm-note svg{ flex: none; color: var(--c-justice); margin-top: 1px; }
.pm-drawer-actions{ padding: 14px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; flex-wrap: wrap; background: var(--surface-2); }
.pm-keystat{ display:flex; gap: 10px; }
.pm-keystat .ks{ flex:1; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 12px; }
.pm-keystat .ks .v{ font-family: var(--ff-mono); font-size: 18px; font-weight: 600; color: var(--ink); }
.pm-keystat .ks .k{ font-size: 11px; color: var(--muted); margin-top: 2px; }
