.zone-topology {
    --zone-shared: #e0202f;
    --zone-service: #0078d4;
    --zone-line: #9aa2ad;
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 430px;
    padding: 20px 56px;
    color: var(--text-primary);
}

.zone-topology__header,
.zone-topology__legend,
.zone-topology__columns {
    position: relative;
    z-index: 2;
}

.zone-topology__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 10px;
}

.zone-topology__eyebrow {
    margin: 0 0 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.zone-topology__title {
    margin: 0;
    font-size: 16px;
    line-height: 1.45;
}

.zone-topology__legend {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.zone-topology__legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.zone-topology__legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--zone-shared);
}

.zone-topology__legend span:last-child i {
    background: var(--zone-service);
}

.zone-topology__relation-legend {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-bottom: 18px;
    color: var(--text-muted);
    font-size: 10px;
}

.zone-topology__relation-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.zone-topology__relation-legend i {
    width: 18px;
    border-top: 2px solid #64748b;
}

.zone-topology__relation-legend .is-shared {
    border-color: var(--zone-shared);
}

.zone-topology__relation-legend .is-service {
    border-color: var(--zone-service);
}

.zone-topology__relation-legend .is-peering {
    border-color: #64748b;
}

.zone-topology__relation-legend .is-vpn {
    border-top-style: dashed;
}

.zone-topology__columns {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
    gap: 240px;
    align-items: stretch;
}

.zone-topology__group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zone-topology__group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.zone-topology__count {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
}

.zone-topology__node {
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    min-height: 84px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.zone-topology__node:hover,
.zone-topology__node:focus-visible,
.zone-topology__node.is-active {
    border-color: var(--node-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--node-color) 15%, transparent);
    outline: none;
}

.zone-topology.has-selection .zone-topology__node:not(.is-active):not(.is-related) {
    opacity: 0.38;
}

.zone-topology__icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 6px;
    background: color-mix(in srgb, var(--node-color) 10%, var(--bg-secondary));
    color: var(--node-color);
}

.zone-topology__icon svg {
    width: 18px;
    height: 18px;
}

.zone-topology__name {
    display: block;
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zone-topology__meta {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
}

.zone-topology__status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 13%, transparent);
}

.zone-topology__csp {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 1px 5px;
    border: 1px solid color-mix(in srgb, var(--csp-color) 35%, transparent);
    border-radius: 4px;
    background: color-mix(in srgb, var(--csp-color) 8%, var(--bg-card));
    color: var(--csp-color);
    font-size: 10px;
    font-weight: 700;
    vertical-align: 1px;
}

.zone-topology__network {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 10px;
}

.zone-topology__network b,
.zone-topology__network span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zone-topology__network b {
    max-width: 54%;
    color: var(--text-secondary);
}

.zone-topology__network span {
    max-width: 46%;
}

.zone-topology__resource-count {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    min-width: 42px;
    padding-left: 10px;
    border-left: 1px solid var(--border-color);
    color: var(--text-primary);
}

.zone-topology__resource-count b {
    font-size: 14px;
    line-height: 1;
}

.zone-topology__resource-count small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 9px;
}

.zone-topology__resource-count.is-empty {
    min-width: 48px;
}

.zone-topology__summary {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
}

.zone-topology__summary-total {
    display: flex;
    align-items: baseline;
    flex: 0 0 auto;
    gap: 5px;
    padding-right: 16px;
    border-right: 1px solid var(--border-color);
}

.zone-topology__summary-total strong {
    color: var(--text-primary);
    font-size: 18px;
}

.zone-topology__summary-total span {
    color: var(--text-muted);
    font-size: 10px;
}

.zone-topology__summary-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.zone-topology__filters {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
}

.zone-topology__filter {
    min-height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.zone-topology__filter:hover,
.zone-topology__filter:focus-visible {
    color: var(--text-primary);
    outline: 2px solid color-mix(in srgb, var(--zone-service) 30%, transparent);
    outline-offset: -2px;
}

.zone-topology__filter.is-active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(25, 26, 27, 0.12);
}

.zone-topology__summary-chip {
    padding: 3px 6px;
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 10px;
}

.zone-topology__summary-chip b {
    margin-left: 2px;
    color: var(--text-secondary);
}

.zone-topology__summary-chip.is-source {
    border: 1px solid color-mix(in srgb, var(--zone-service) 28%, var(--border-color));
    background: color-mix(in srgb, var(--zone-service) 7%, var(--bg-card));
    color: var(--text-secondary);
    font-weight: 700;
}

.zone-topology__inspector {
    position: relative;
    z-index: 2;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.zone-topology__inspector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.zone-topology__inspector-header > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.zone-topology__inspector-header strong {
    color: var(--text-primary);
    font-size: 12px;
}

.zone-topology__inspector-header span {
    color: var(--text-muted);
    font-size: 10px;
}

.zone-topology__inspector-context {
    flex: 0 0 auto;
    font-weight: 700;
}

.zone-topology__tech-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    max-height: 244px;
    overflow-y: auto;
}

.zone-topology__connection-empty {
    display: grid;
    min-height: 72px;
    place-items: center;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 11px;
}

.zone-topology__tech {
    display: grid;
    grid-template-columns: 44px minmax(130px, 0.55fr) minmax(190px, 0.9fr) minmax(300px, 1.5fr) 92px;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    height: auto;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
}

.zone-topology__tech:hover,
.zone-topology__tech:focus-visible,
.zone-topology__tech.is-selected {
    border-color: var(--zone-service);
    background: color-mix(in srgb, var(--zone-service) 6%, var(--bg-card));
    outline: none;
}

.zone-topology__tech-code {
    width: fit-content;
    padding: 2px 5px;
    border-radius: 3px;
    background: var(--text-secondary);
    color: var(--bg-card);
    font-size: 10px;
}

.zone-topology__tech-method,
.zone-topology__tech-route,
.zone-topology__tech-network {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zone-topology__tech-method {
    color: var(--text-secondary);
    font-size: 11px;
}

.zone-topology__tech-route {
    color: var(--text-muted);
}

.zone-topology__tech-network {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr);
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
}

.zone-topology__tech-network > span {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.zone-topology__tech-network b,
.zone-topology__tech-network small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zone-topology__tech-network b {
    color: var(--text-secondary);
    font-size: 10px;
}

.zone-topology__tech-network small {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 9px;
}

.zone-topology__tech-network i {
    font-style: normal;
    text-align: center;
}

.zone-topology__tech-state {
    text-align: right;
    color: var(--text-muted);
    font-size: 10px;
}

.zone-topology__tech.is-active {
    border-color: var(--zone-service);
    background: color-mix(in srgb, var(--zone-service) 7%, var(--bg-card));
}

.zone-topology__edges {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.zone-topology__edge {
    fill: none;
    stroke: var(--zone-line);
    stroke-width: 1.25;
    stroke-opacity: 0.42;
    transition: stroke 160ms ease, stroke-opacity 160ms ease, stroke-width 160ms ease;
}

.zone-topology__edge-badge {
    transition: opacity 160ms ease;
}

.zone-topology__edge-badge circle {
    fill: var(--bg-card);
    stroke: #64748b;
    stroke-width: 1.5;
}

.zone-topology__edge-badge text {
    fill: var(--text-secondary);
    font-size: 8px;
    font-weight: 800;
}

.zone-topology__connection[data-relation="shared-shared"] .zone-topology__edge-badge circle {
    stroke: var(--zone-shared);
}

.zone-topology__connection[data-relation="service-service"] .zone-topology__edge-badge circle {
    stroke: var(--zone-service);
}

.zone-topology.has-selection .zone-topology__connection:not(.is-active) .zone-topology__edge-badge {
    opacity: 0.12;
}

.zone-topology__connection.is-active .zone-topology__edge-badge circle {
    fill: var(--text-primary);
    stroke-width: 2;
}

.zone-topology__connection.is-active .zone-topology__edge-badge text {
    fill: var(--bg-card);
}

.zone-topology__connection.is-filtered-out {
    display: none;
}

.zone-topology.is-dense .zone-topology__edge-badge {
    opacity: 0;
}

.zone-topology.is-dense.has-connection-focus .zone-topology__connection.is-active .zone-topology__edge-badge {
    opacity: 1;
}

.zone-topology.has-selection .zone-topology__edge:not(.is-active) {
    stroke-opacity: 0.06;
}

.zone-topology__edge.is-active {
    stroke-width: 2;
    stroke-opacity: 0.9;
}

.zone-topology__edge[data-relation="shared-shared"] {
    stroke: var(--zone-shared);
}

.zone-topology__edge[data-relation="service-service"] {
    stroke: var(--zone-service);
}

.zone-topology__edge[data-relation="shared-service"] {
    stroke: #64748b;
}

.zone-topology__edge[data-relation="shared-shared"].is-active,
.zone-topology__edge[data-relation="service-service"].is-active,
.zone-topology__edge[data-relation="shared-service"].is-active {
    stroke-opacity: 0.95;
}

.zone-topology__edge[data-kind="vpn"] {
    stroke-dasharray: 6 5;
}

.zone-topology__edge[data-state="recommended"] {
    stroke-opacity: 0.24;
}

.zone-topology__connection.is-preview .zone-topology__edge {
    stroke-width: 2.25;
    stroke-opacity: 0.95;
}

.zone-topology__connection.is-preview .zone-topology__edge-badge {
    opacity: 1;
}

.zone-topology.is-dense .zone-topology__edge {
    stroke-opacity: 0.08;
}

.zone-topology.is-dense .zone-topology__connection.is-preview .zone-topology__edge,
.zone-topology.is-dense.has-connection-focus .zone-topology__connection.is-active .zone-topology__edge {
    stroke-opacity: 0.95;
}

.zone-topology__empty {
    display: grid;
    min-height: 260px;
    place-items: center;
    color: var(--text-muted);
    font-size: 12px;
}

@media (max-width: 1000px) {
    .zone-topology {
        min-width: 0;
        padding: 20px;
    }

    .zone-topology__header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .zone-topology__relation-legend {
        align-items: flex-start;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .zone-topology__columns {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .zone-topology__summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .zone-topology__filters {
        order: 2;
    }

    .zone-topology__summary-total {
        padding-right: 0;
        border-right: 0;
    }

    .zone-topology__tech {
        grid-template-columns: 42px minmax(0, 1fr) auto;
        min-height: 72px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .zone-topology__tech-route,
    .zone-topology__tech-network {
        grid-column: 1 / -1;
    }

    .zone-topology__tech-network b,
    .zone-topology__tech-network small {
        overflow-wrap: anywhere;
        white-space: normal;
    }

    .zone-topology__inspector-header,
    .zone-topology__inspector-header > div {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .zone-topology__edges {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zone-topology__node,
    .zone-topology__edge {
        transition: none;
    }
}