.diagram-engine-card {
    margin: 1.5rem 0;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.diagram-engine-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
}

.diagram-engine-header h2 {
    margin: 0.15rem 0;
}

.diagram-engine-header p {
    margin: 0.35rem 0 0;
    color: #475569;
}

.diagram-engine-actions a,
.epc-part-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 700;
}

.diagram-engine-actions a:hover,
.epc-part-link:hover {
    text-decoration: underline;
}

.diagram-engine-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    padding: 0.75rem 1.4rem;
    background: #f8fafc;
    color: #475569;
    font-size: 0.9rem;
}

.diagram-engine-viewer {
    width: 100%;
    min-height: 260px;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagram-engine-viewer img,
.diagram-engine-viewer iframe,
.diagram-engine-ruffle {
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: contain;
    background: #fff;
}

.diagram-engine-empty,
.diagram-engine-warning {
    margin: 1rem;
    padding: 1rem;
    border-radius: 14px;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.compact-detail-card {
    margin-top: 1rem;
}

.diagram-hotspot-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 0;
    align-items: stretch;
}

.diagram-hotspot-main {
    min-width: 0;
}

.diagram-engine-viewer {
    position: relative;
    overflow: hidden;
}

.diagram-hotspot-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.diagram-hotspot-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    background: rgba(37, 99, 235, 0.88);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.35);
    pointer-events: auto;
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.diagram-hotspot-marker:hover,
.diagram-hotspot-marker:focus,
.diagram-hotspot-marker.is-hovered {
    transform: translate(-50%, -50%) scale(1.18);
    background: rgba(234, 88, 12, 0.95);
    box-shadow: 0 14px 30px rgba(234, 88, 12, 0.4);
    z-index: 10;
    text-decoration: none;
}

.diagram-hotspot-marker.is-selected {
    background: rgba(15, 82, 186, 0.96);
    box-shadow: 0 0 0 5px rgba(15, 82, 186, 0.22), 0 14px 32px rgba(30, 58, 138, 0.38);
    z-index: 11;
}

.diagram-hotspot-marker.is-filtered-out {
    opacity: 0.18;
    pointer-events: none;
}

.diagram-selected-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    padding: 0.8rem 1rem;
    background: var(--parts-success-bg, #EBF8FF);
    border-top: 1px solid rgba(15, 82, 186, 0.18);
    color: #1e3a8a;
}

.diagram-selected-strip span:first-child {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    font-weight: 800;
}

.diagram-hotspot-panel {
    border-left: 1px solid rgba(15, 23, 42, 0.1);
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.diagram-hotspot-panel-head {
    padding: 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.diagram-hotspot-panel-head h3 {
    margin: 0.1rem 0 0.75rem;
}

.diagram-hotspot-search {
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 999px;
    padding: 0.55rem 0.85rem;
    background: #fff;
}

.diagram-hotspot-list {
    overflow: auto;
    max-height: 620px;
    padding: 0.65rem;
}

.diagram-hotspot-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
    padding: 0.45rem;
    border-radius: 14px;
    color: #0f172a;
    border: 1px solid transparent;
}

.diagram-hotspot-detail-link {
    display: grid;
    grid-template-columns: 2.4rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
    min-width: 0;
    padding: 0.25rem;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
}

.diagram-hotspot-row:hover,
.diagram-hotspot-row:focus-within,
.diagram-hotspot-row.is-hovered {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.diagram-hotspot-detail-link:hover,
.diagram-hotspot-detail-link:focus {
    text-decoration: none;
}

.diagram-hotspot-add {
    margin: 0;
    white-space: nowrap;
    align-self: center;
}

.diagram-hotspot-row.is-selected {
    background: #eff6ff;
    border-color: #60a5fa;
}

.diagram-hotspot-position {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    background: #e0e7ff;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.78rem;
}

.diagram-hotspot-row.is-selected .diagram-hotspot-position {
    background: #2563eb;
    color: #fff;
}

.diagram-hotspot-row-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.diagram-hotspot-row-body strong,
.diagram-hotspot-row-body small,
.diagram-hotspot-row-body em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.diagram-hotspot-row-body small {
    color: #475569;
}

.diagram-hotspot-row-body em {
    color: #64748b;
    font-size: 0.78rem;
    font-style: normal;
}

.diagram-hotspot-note {
    margin: 0;
    padding: 0.85rem 1rem 1rem;
    color: #64748b;
    font-size: 0.78rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

@media (max-width: 960px) {
    .diagram-hotspot-layout {
        grid-template-columns: 1fr;
    }

    .diagram-hotspot-panel {
        border-left: 0;
        border-top: 1px solid rgba(15, 23, 42, 0.1);
    }

    .diagram-hotspot-list {
        max-height: 360px;
    }
}
