.bb-network-map {
    --nm-panel: #132130;
    --nm-ink: #e5edf6;
    color: var(--ink, var(--nm-ink));
    font:
        14px system-ui,
        sans-serif;
    min-width: 0;
}
.nm-tools {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 0;
}
.nm-tools button,
.nm-tools select,
.nm-details button {
    background: var(--raised, #203447);
    color: inherit;
    border: 1px solid #7892ab35;
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
}
.nm-tools label {
    font-size: 12px;
    display: flex;
    gap: 6px;
    align-items: center;
    color: var(--muted, #9cb0c4);
}
.nm-search {
    flex: 1;
    min-width: 180px;
}
.nm-search input {
    width: 100%;
    background: var(--surface, #132130);
    border: 1px solid #7892ab45;
    border-radius: 12px;
    padding: 11px;
    color: inherit;
    box-sizing: border-box;
}
.nm-status {
    font-size: 12px;
    color: var(--muted, #9cb0c4);
    padding: 6px 0 12px;
}
.nm-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 12px;
    position: relative;
}
.nm-canvas {
    position: relative;
    overflow: hidden;
    min-height: 440px;
    height: min(68vh, 800px);
    background:
        radial-gradient(circle, #7892ab22 1px, transparent 1px),
        radial-gradient(ellipse at 40% 40%, #253e5330, transparent 65%), var(--bg, #0c151f);
    background-size:
        23px 23px,
        auto,
        auto;
    border: 1px solid #7892ab35;
    border-radius: 18px;
}
.nm-canvas svg {
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
    display: block;
    user-select: none;
}
.nm-canvas svg:active {
    cursor: grabbing;
}
.nm-node {
    cursor: pointer;
}
.nm-node text {
    pointer-events: none;
    paint-order: stroke;
    stroke: var(--bg, #0c151f);
    stroke-width: 3px;
    stroke-linejoin: round;
}
.nm-node:focus {
    outline: none;
}
.nm-node:focus > circle:first-child {
    stroke-width: 4;
}
.nm-link {
    cursor: pointer;
    pointer-events: stroke;
}
.nm-link:hover,
.nm-link:focus {
    stroke-width: 5;
    outline: none;
    opacity: 1;
}
.nm-details {
    padding: 16px;
    background: var(--surface, #132130);
    border: 1px solid #7892ab35;
    border-radius: 18px;
    max-height: min(68vh, 800px);
    overflow: auto;
    box-sizing: border-box;
    position: relative;
    overflow-wrap: anywhere;
}
.nm-details > button {
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: 20px;
    background: none;
    border: 0;
    padding: 4px 8px;
}
.nm-details h3 {
    margin: 2px 25px 18px 0;
    line-height: 1.4;
    font-size: 18px;
}
.nm-details p {
    font-size: 13px;
    color: var(--muted, #9cb0c4);
    line-height: 1.7;
}
.nm-detail-row {
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.55;
}
.nm-detail-row small {
    display: block;
    color: var(--muted, #9cb0c4);
    margin-bottom: 3px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}
.nm-related {
    display: block;
    width: 100%;
    margin: 7px 0;
    text-align: left;
    font-size: 12px;
    white-space: normal;
}
.nm-legend {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, #0c151fe8);
    pointer-events: none;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 10px;
    color: #9cb0c4;
}
.nm-phone {
    color: #62dbc5;
}
.nm-desktop {
    color: #e9a470;
}
.nm-server {
    color: #7caeff;
}
.nm-connection {
    color: #c2a4ff;
}
.nm-down {
    color: #dc8894;
}
.nm-notices {
    white-space: pre-line;
    border-top: 1px solid #7892ab35;
    padding-top: 14px;
}
.nm-empty {
    position: absolute;
    top: 45%;
    left: 20%;
    color: #9cb0c4;
    pointer-events: none;
}
[hidden] {
    display: none !important;
}
@media (max-width: 850px) {
    .nm-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .nm-canvas {
        height: 64vh;
        min-height: 380px;
    }
    .nm-details {
        display: none;
        position: absolute;
        right: 8px;
        top: 8px;
        width: min(310px, calc(100% - 16px));
        max-height: calc(64vh - 16px);
        box-shadow: 0 12px 50px #0008;
        z-index: 2;
    }
    .nm-inspecting .nm-details {
        display: block;
    }
    .nm-tools {
        gap: 6px;
    }
    .nm-tools button {
        font-size: 12px;
        padding: 8px 10px;
    }
    .nm-legend {
        font-size: 9px;
        gap: 8px;
    }
}

.nm-tools [aria-pressed='true'] {
    background: #695024;
    border-color: #ffd071;
    color: #fff2cf;
}
.nm-path-status {
    padding: 10px 14px;
    margin-bottom: 12px;
    border: 1px solid #ffd07166;
    background: #ffd07112;
    border-radius: 12px;
    color: var(--ink, #fff2cf);
    line-height: 1.5;
}
.nm-path-chain {
    color: #ffd071 !important;
    font-weight: 600;
}
.nm-path-step {
    border-top: 1px solid #7892ab35;
    padding-top: 12px;
    margin-top: 12px;
    font-size: 12px;
}
.nm-path-step p {
    margin: 6px 0;
}
.nm-path-permission {
    font-size: 12px;
    line-height: 1.8;
}

.nm-detail-row > div {
    white-space: pre-line;
}

@media (max-width: 850px) {
    .nm-inspecting .nm-details {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        max-height: 38vh;
        grid-row: 2;
        box-shadow: none;
    }
    .nm-inspecting .nm-canvas {
        height: 48vh;
        min-height: 300px;
    }
}

.nm-tools {
    position: relative;
}
.nm-options summary {
    list-style: none;
    background: var(--raised, #203447);
    border: 1px solid #7892ab35;
    border-radius: 10px;
    padding: 7px 10px;
    cursor: pointer;
}
.nm-options summary::-webkit-details-marker {
    display: none;
}
.nm-options summary::after {
    content: ' ▾';
    color: var(--muted, #9cb0c4);
}
.nm-options[open] summary::after {
    content: ' ▴';
}
.nm-options-panel {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 4;
    width: min(340px, 100%);
    max-height: min(60vh, 390px);
    overflow: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    padding: 12px;
    background: var(--surface, #132130);
    border: 1px solid var(--line, #7892ab35);
    border-radius: 12px;
    box-shadow: 0 10px 30px #0006;
}
.nm-options-panel label:has(select) {
    width: 100%;
    justify-content: space-between;
}
.nm-options-panel select {
    max-width: 64%;
}
.nm-options-panel p {
    margin: 2px 0;
    color: var(--muted, #9cb0c4);
    font-size: 12px;
    line-height: 1.5;
}
:is(.page, .window-body)[data-view='network'] {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px clamp(12px, 2vw, 26px);
}
[data-view='network'] > .page-heading {
    margin: 0 0 6px;
    flex: none;
}
[data-view='network'] > .page-heading h1 {
    font-size: 23px;
    margin: 0;
}
.network-map-content,
.network-map-content > .bb-network-map {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}
.network-map-content .nm-tools {
    position: relative;
    padding: 4px 0;
    gap: 6px;
}
.network-map-content .nm-tools button,
.network-map-content .nm-tools select,
.network-map-content .nm-search input {
    padding: 7px 9px;
    font-size: 13px;
}
.network-map-content .nm-status {
    padding: 3px 0 7px;
}
.network-map-content .nm-path-status {
    padding: 4px 9px;
    margin-bottom: 6px;
    font-size: 13px;
}
.network-map-content .nm-layout {
    flex: 1;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
}
.network-map-content .nm-canvas,
.network-map-content .nm-details {
    min-height: 0;
    height: auto;
    max-height: none;
}
@media (max-width: 850px) {
    .network-map-content .nm-inspecting .nm-details {
        position: absolute;
        top: 8px;
        right: 8px;
        bottom: auto;
        width: min(310px, calc(100% - 16px));
        max-height: calc(100% - 16px);
        grid-row: auto;
        box-shadow: 0 12px 36px #0008;
    }
}

.workspace-panel-body .network-map-content {
    --workspace-map-height: clamp(290px, 45vh, 420px);
}
.workspace-panel-body .network-map-content .nm-layout {
    grid-template-rows: auto;
}
.workspace-panel-body .network-map-content .nm-canvas {
    display: flex;
    flex-direction: column;
    height: var(--workspace-map-height);
}
.workspace-panel-body .nm-canvas svg {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
}
.workspace-panel-body .nm-legend {
    position: static;
    flex: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 4px 8px;
    padding: 7px 10px;
    border-top: 1px solid #7892ab35;
    background: var(--surface, #132130);
}
.workspace-panel-body .network-map-content .nm-details {
    max-height: var(--workspace-map-height);
}
@container (max-width: 700px) {
    .workspace-panel-body .network-map-content .nm-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .workspace-panel-body .network-map-content .nm-details {
        display: none;
    }
    .workspace-panel-body .network-map-content .nm-inspecting .nm-details {
        display: block;
        position: static;
        grid-row: 2;
        width: auto;
        box-shadow: none;
    }
}

/* Actual operation overlays remain separate from path planning and selection. */
.nm-traffic-flow {
    stroke: #20dcca;
    stroke-width: 4;
    stroke-dasharray: 9 9;
    stroke-linecap: round;
    filter: drop-shadow(0 0 3px #10b8a5);
    animation: nm-traffic-flow 0.8s linear infinite;
    pointer-events: none;
}
.nm-traffic-reverse {
    stroke: #ffcc70;
    stroke-dasharray: 5 13;
    animation-direction: reverse;
}
.nm-traffic-node > rect,
.nm-traffic-node > circle {
    stroke: #20dcca;
    stroke-width: 3;
}
.nm-flow-key {
    color: #20dcca;
}
.nm-health-key {
    color: #d39aff;
}
.nm-health-node > rect,
.nm-health-node > circle {
    stroke: #d39aff;
    stroke-width: 3;
}
.nm-traffic-health {
    stroke: #d39aff;
    stroke-width: 7;
    stroke-dasharray: 1 17;
    filter: none;
}
.nm-traffic-recent {
    opacity: 0.45;
    animation: none;
    filter: none;
}
.nm-activity-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin: 6px 0;
}
.nm-activity-range {
    grid-column: 1 / -1;
    flex-basis: 100%;
}
.nm-activity-filters label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    cursor: pointer;
}
.nm-activity-status summary {
    cursor: pointer;
}
.nm-activity-status ul {
    max-height: 10rem;
    overflow: auto;
    padding-inline-start: 1.5rem;
}
.nm-activity-status {
    font-size: 12px;
    color: var(--muted, #9cb0c4);
    padding: 0 0 8px;
}
@keyframes nm-traffic-flow {
    from {
        stroke-dashoffset: 0;
    }
    to {
        stroke-dashoffset: -18;
    }
}
@media (prefers-reduced-motion: reduce) {
    .nm-traffic-flow {
        animation: none;
    }
}
