/* ============================================
   ServiceNow Topology Viewer - Control Room UI
   Dark, cinematic NOC/broadcast operations style
   ============================================ */

/* ── Kiosk Mode — hide all navigation chrome ─────────────────── */
body.kiosk-mode .app-header,
body.kiosk-mode .secondary-nav,
body.kiosk-mode .ai-toggle-btn,
body.kiosk-mode .ai-panel {
    display: none !important;
}

body.kiosk-mode .content {
    padding-top: 0 !important;
}

/* Topo kiosk: dedicated touch panel layout */
body.kiosk-topo {
    background: #08081a;
}

body.kiosk-topo .container {
    max-width: none;
    padding: 0;
    margin: 0;
}

/* ── Touch Panel Layout ──────────────────────────────────────── */
.touch-panel {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #08081a;
}

/* Fullscreen entry overlay */
.tp-fs-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
    background: #08081a;
    user-select: none;
    -webkit-user-select: none;
}

.tp-fs-prompt {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    animation: tp-fs-pulse 2s ease-in-out infinite;
}

.tp-fs-icon {
    font-size: 3rem;
    opacity: 0.7;
}

.tp-fs-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #e0e0f0;
    letter-spacing: 0.04em;
}

.tp-fs-sub {
    font-size: 0.85rem;
    color: #5a5a8a;
}

@keyframes tp-fs-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Left sidebar */
.tp-sidebar {
    width: 72px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #0e0e24;
    border-right: 1px solid #1a1a3a;
}

.tp-sidebar-logo {
    padding: 16px 0;
    text-align: center;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: #3b82f6;
    border-bottom: 1px solid #1a1a3a;
}

.tp-mode-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 6px;
    flex: 1;
}

.tp-sidebar-bottom {
    padding: 8px 6px 12px;
    border-top: 1px solid #1a1a3a;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tp-sidebar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(52, 199, 89, 0.08);
    border: 1px solid rgba(52, 199, 89, 0.15);
    width: 100%;
    box-sizing: border-box;
}

.tp-user-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34c759;
    box-shadow: 0 0 4px rgba(52, 199, 89, 0.5);
    flex-shrink: 0;
}

.tp-user-name {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-theme-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #1a1a3a;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 1rem;
    padding: 0;
}

.tp-theme-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

html[data-theme="light"] .tp-sidebar-bottom {
    border-top-color: #ccc;
}

html[data-theme="light"] .tp-sidebar-user {
    background: rgba(52, 199, 89, 0.06);
    border-color: rgba(52, 199, 89, 0.12);
}

html[data-theme="light"] .tp-user-name {
    color: #1f2328;
}

html[data-theme="light"] .tp-theme-toggle {
    border-color: #ccc;
}

html[data-theme="light"] .tp-theme-toggle:hover {
    background: rgba(59, 130, 246, 0.08);
}

.tp-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 4px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #5a5a8a;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-main);
}

.tp-mode-btn:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #8a8ac0;
}

.tp-mode-btn.tp-active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.tp-mode-icon {
    font-size: 1.3rem;
}

.tp-mode-label {
    font-size: 0.52rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Main content area */
.tp-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

/* Home mode */
.tp-home {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tp-home-globe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.18;
    filter: brightness(0.6) contrast(1.3);
    pointer-events: none;
    user-select: none;
}

.tp-home-content {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.tp-home-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #e0e0f0;
    letter-spacing: 0.04em;
}

.tp-home-sub {
    font-size: 0.8rem;
    color: #5a5a8a;
}

.tp-home-time {
    font-size: 3.5rem;
    font-weight: 200;
    color: #60a5fa;
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    margin-top: 1rem;
}

.tp-home-date {
    font-size: 0.85rem;
    color: #5a5a8a;
    font-weight: 400;
}

/* Placeholder for unbuilt modes */
.tp-placeholder {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #3a3a6a;
}

.tp-placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.4;
}

.tp-placeholder-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #5a5a8a;
}

.tp-placeholder-sub {
    font-size: 0.75rem;
    color: #3a3a6a;
}

/* Light theme overrides for touch panel */
html[data-theme="light"] .touch-panel {
    background: #f0f2f5;
}

html[data-theme="light"] .tp-sidebar {
    background: #e4e6ec;
    border-right-color: #ccc;
}

html[data-theme="light"] .tp-sidebar-logo {
    border-bottom-color: #ccc;
}

html[data-theme="light"] .tp-mode-btn {
    color: #8895a7;
}

html[data-theme="light"] .tp-mode-btn:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #4a5568;
}

html[data-theme="light"] .tp-mode-btn.tp-active {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

html[data-theme="light"] .tp-home-title {
    color: #1a1a2e;
}

html[data-theme="light"] .tp-home-time {
    color: #2563eb;
}

html[data-theme="light"] .tp-home-sub,
html[data-theme="light"] .tp-home-date {
    color: #64748b;
}

/* ── Touch Panel: Service Mode ──────────────────────────────── */
.tp-service-layout {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.tp-service-viewer {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 12px 16px;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tp-service-viewer::-webkit-scrollbar {
    display: none;
}

.tp-service-viewer .chain-header {
    padding: 0 0 8px 0;
}

.tp-service-viewer .chain-header h2 {
    font-size: 0.9rem !important;
}

.tp-service-viewer .chain-viz {
    font-size: 0.78rem;
}

.tp-service-viewer .spinner {
    width: 24px;
    height: 24px;
}

/* ── Right toolbar (icon strip) ──────────────────────────────── */
.tp-toolbar {
    width: 48px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 0;
    background: #0a0a1e;
    border-left: 1px solid #1a1a3a;
}

.tp-tb-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #4a4a7a;
    cursor: pointer;
    transition: all 0.12s;
    padding: 0;
}

.tp-tb-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #8a8ac0;
}

.tp-tb-btn.tp-tb-active {
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
}

.tp-tb-btn.tp-tb-pulse {
    background: rgba(52, 199, 89, 0.25);
    color: #34c759;
    animation: tp-tb-sent 1.2s ease-out;
}

@keyframes tp-tb-sent {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(52, 199, 89, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0);
    }
}

.tp-tb-btn svg {
    width: 20px;
    height: 20px;
}

/* ── Service Strip Carousel ──────────────────────────────────── */
.tp-service-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tp-svc-strip {
    flex-shrink: 0;
    height: 44px;
    border-bottom: 1px solid #1a1a3a;
    background: #0a0a1e;
    overflow: hidden;
}

/* ── Penalty Box Dual-Ticker ─────────────────────────────────── */
.tp-penalty-strip {
    display: flex;
    height: 46px;
    background: linear-gradient(90deg, rgba(255, 59, 48, 0.06) 0%, #0a0a1e 45%, #0a0a1e 55%, rgba(255, 149, 0, 0.06) 100%);
    border-bottom: 1px solid #1a1a3a;
    overflow: hidden;
}

.tp-penalty-lane {
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
    min-width: 0;
    flex: 1;
    position: relative;
}

.tp-penalty-red {
    flex: 1;
}

.tp-penalty-orange {
    flex: 1;
}

.tp-penalty-label {
    font-size: 0.56rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0 0.6rem;
    z-index: 2;
    position: relative;
}

.tp-penalty-red .tp-penalty-label {
    color: #ff6961;
    background: rgba(255, 59, 48, 0.12);
    border-right: 1px solid rgba(255, 59, 48, 0.2);
    height: 100%;
    display: flex;
    align-items: center;
}

.tp-penalty-orange .tp-penalty-label {
    color: #ffb347;
    background: rgba(255, 149, 0, 0.12);
    border-right: 1px solid rgba(255, 149, 0, 0.2);
    height: 100%;
    display: flex;
    align-items: center;
}

.tp-penalty-divider {
    width: 2px;
    flex-shrink: 0;
    background: linear-gradient(180deg, transparent 10%, rgba(255, 255, 255, 0.12) 50%, transparent 90%);
}

.tp-penalty-scroll {
    flex: 1;
    overflow: hidden;
    min-width: 0;
    position: relative;
    mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 90%, transparent 100%);
}

.tp-penalty-scroll-inner {
    display: flex;
    gap: 6px;
    width: max-content;
    padding: 0 8px;
    align-items: center;
    height: 46px;
}

.tp-penalty-scroll-red {
    animation: tp-penalty-marquee-red 30s linear infinite;
}

.tp-penalty-scroll-orange {
    animation: tp-penalty-marquee-orange 35s linear infinite;
}

.tp-penalty-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 12px;
    border-radius: 14px;
    font-size: 0.6rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    background: transparent;
}

.tp-penalty-chip-red {
    color: #ff6961;
    border-color: rgba(255, 59, 48, 0.25);
    background: rgba(255, 59, 48, 0.1);
    animation: tp-penalty-pulse-red 2s ease-in-out infinite;
}

.tp-penalty-chip-red:hover {
    background: rgba(255, 59, 48, 0.22);
    border-color: #ff3b30;
    box-shadow: 0 0 8px rgba(255, 59, 48, 0.3);
}

.tp-penalty-chip-red.tp-penalty-chip-active {
    background: rgba(255, 59, 48, 0.28);
    border-color: #ff3b30;
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.4);
    animation: none;
}

.tp-penalty-chip-orange {
    color: #ffb347;
    border-color: rgba(255, 149, 0, 0.25);
    background: rgba(255, 149, 0, 0.08);
}

.tp-penalty-chip-orange:hover {
    background: rgba(255, 149, 0, 0.2);
    border-color: #ff9500;
    box-shadow: 0 0 8px rgba(255, 149, 0, 0.3);
}

.tp-penalty-chip-orange.tp-penalty-chip-active {
    background: rgba(255, 149, 0, 0.25);
    border-color: #ff9500;
    box-shadow: 0 0 10px rgba(255, 149, 0, 0.4);
}

.tp-penalty-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tp-penalty-dot-red {
    background: #ff3b30;
    box-shadow: 0 0 6px rgba(255, 59, 48, 0.7);
}

.tp-penalty-dot-orange {
    background: #ff9500;
    box-shadow: 0 0 6px rgba(255, 149, 0, 0.6);
}

.tp-penalty-sev {
    font-size: 0.5rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    opacity: 0.7;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.tp-penalty-assignee {
    font-size: 0.5rem;
    font-weight: 600;
    color: rgba(255, 179, 71, 0.6);
    margin-left: 2px;
    font-style: italic;
}

@keyframes tp-penalty-marquee-red {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

@keyframes tp-penalty-marquee-orange {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

@keyframes tp-penalty-pulse-red {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.65;
    }
}

.tp-svc-strip-inner {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    height: 100%;
    align-items: center;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.tp-svc-strip-inner::-webkit-scrollbar {
    display: none;
}

.tp-svc-pill {
    flex-shrink: 0;
    padding: 4px 14px;
    border: 1px solid #1a1a3a;
    border-radius: 16px;
    background: transparent;
    color: #5a5a8a;
    font-size: 0.62rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.tp-svc-pill:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #8a8ac0;
    border-color: rgba(59, 130, 246, 0.25);
}

.tp-svc-pill.tp-svc-pill-active {
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
    border-color: #3b82f6;
}

/* ── Node Action Bar (tap = action) ──────────────────────────── */
.tp-action-bar {
    position: absolute;
    z-index: 30;
    background: #12122e;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    padding: 8px 10px;
    min-width: 200px;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: tp-ab-in 0.15s ease-out;
}

@keyframes tp-ab-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tp-ab-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: #60a5fa;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 6px;
    padding: 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-ab-actions {
    display: flex;
    gap: 4px;
}

.tp-ab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid #1a1a3a;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: #b0b0d0;
    cursor: pointer;
    transition: all 0.12s;
    min-width: 48px;
    font-family: var(--font-main);
}

.tp-ab-btn:active {
    transform: scale(0.95);
}

.tp-ab-icon {
    font-size: 1.1rem;
}

.tp-ab-text {
    font-size: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tp-ab-inspect:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #60a5fa;
}

.tp-ab-alarms:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #f87171;
}

.tp-ab-change:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
    color: #fbbf24;
}

.tp-ab-push:hover {
    background: rgba(52, 199, 89, 0.15);
    border-color: #34c759;
    color: #34c759;
}

.tp-ab-close {
    min-width: 32px;
    padding: 8px 6px;
    color: #5a5a8a;
}

.tp-ab-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e0e0f0;
}

/* Impact / blast radius badge */
.tp-ab-impact {
    margin-top: 6px;
    min-height: 16px;
}

.tp-ab-blast {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.tp-ab-ok {
    color: #34c759;
    font-size: 0.55rem;
    font-weight: 600;
}

.tp-ab-alarm-count {
    display: block;
    color: #ef4444;
    font-size: 0.55rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.tp-ab-alarm-item {
    display: block;
    color: #8a8ac0;
    font-size: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-ab-loading {
    font-size: 0.5rem;
    color: #5a5a8a;
}

/* Node states for action bar selection */
.graph-node.tp-node-selected {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
}

/* ── Chain Overlays (incident / change on topology) ──────────── */
.tp-chain-overlay {
    position: absolute;
    top: 8px;
    left: 12px;
    right: 12px;
    z-index: 20;
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.tp-overlay-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    pointer-events: auto;
    white-space: nowrap;
}

.tp-overlay-incident-badge {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.tp-overlay-change-badge {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.tp-overlay-ok-badge {
    background: rgba(52, 199, 89, 0.15);
    color: #34c759;
    border: 1px solid rgba(52, 199, 89, 0.25);
}

.tp-overlay-draft-count {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.18);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
    font-size: 0.55rem;
    font-weight: 700;
    pointer-events: auto;
    margin-top: 4px;
}

/* Node markers (incident / change dots on nodes) */
.tp-node-marker {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 800;
    line-height: 1;
    z-index: 5;
    animation: tp-marker-pulse 2s ease-in-out infinite;
}

.tp-node-marker-incident {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.tp-node-marker-change {
    background: #f59e0b;
    color: #1a1a2e;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

@keyframes tp-marker-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* Node incident highlight (glow red) */
.graph-node.tp-node-incident {
    border-color: rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25), inset 0 0 8px rgba(239, 68, 68, 0.08);
    position: relative;
}

/* Node change highlight (glow amber) */
.graph-node.tp-node-change {
    border-color: rgba(245, 158, 11, 0.6) !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.25), inset 0 0 8px rgba(245, 158, 11, 0.08);
    position: relative;
}

/* Downstream dim effect */
.graph-node.tp-node-downstream {
    opacity: 0.35;
    filter: saturate(0.4);
    transition: opacity 0.4s, filter 0.4s;
}

/* Impact highlight (blast radius) */
.graph-node.tp-node-impacted {
    border-color: rgba(245, 158, 11, 0.4) !important;
    background: rgba(245, 158, 11, 0.06) !important;
}

/* ── Live State Transitions ──────────────────────────────────── */
.graph-node {
    transition: border-color 0.6s ease, box-shadow 0.6s ease, background 0.6s ease, opacity 0.4s ease;
}

.graph-node.alarmed {
    animation: tp-state-alarm 1.5s ease-in-out infinite;
}

@keyframes tp-state-alarm {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
    }

    50% {
        box-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
    }
}

/* Light theme overrides for new components */
html[data-theme="light"] .tp-svc-strip {
    background: #e8eaef;
    border-bottom-color: #ccc;
}

html[data-theme="light"] .tp-penalty-strip {
    background: linear-gradient(90deg, rgba(255, 59, 48, 0.04) 0%, #e8eaef 45%, #e8eaef 55%, rgba(255, 149, 0, 0.04) 100%);
    border-bottom-color: #ccc;
}

html[data-theme="light"] .tp-penalty-red .tp-penalty-label {
    background: rgba(255, 59, 48, 0.08);
    border-color: rgba(255, 59, 48, 0.15);
}

html[data-theme="light"] .tp-penalty-orange .tp-penalty-label {
    background: rgba(255, 149, 0, 0.08);
    border-color: rgba(255, 149, 0, 0.15);
}

html[data-theme="light"] .tp-penalty-chip-red {
    color: #d32f2f;
    background: rgba(255, 59, 48, 0.08);
    border-color: rgba(255, 59, 48, 0.2);
}

html[data-theme="light"] .tp-penalty-chip-orange {
    color: #e65100;
    background: rgba(255, 149, 0, 0.06);
    border-color: rgba(255, 149, 0, 0.18);
}

html[data-theme="light"] .tp-penalty-assignee {
    color: rgba(230, 81, 0, 0.5);
}

html[data-theme="light"] .tp-penalty-divider {
    background: linear-gradient(180deg, transparent 10%, rgba(0, 0, 0, 0.1) 50%, transparent 90%);
}

html[data-theme="light"] .tp-svc-pill {
    border-color: #ccc;
    color: #64748b;
}

html[data-theme="light"] .tp-svc-pill:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #334155;
}

html[data-theme="light"] .tp-svc-pill.tp-svc-pill-active {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border-color: #2563eb;
}

html[data-theme="light"] .tp-action-bar {
    background: #fff;
    border-color: rgba(59, 130, 246, 0.25);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .tp-ab-label {
    color: #2563eb;
}

html[data-theme="light"] .tp-ab-btn {
    border-color: #e0e0e0;
    color: #475569;
    background: #fafafa;
}

html[data-theme="light"] .tp-ab-close {
    color: #94a3b8;
}

html[data-theme="light"] .tp-overlay-incident-badge {
    background: rgba(239, 68, 68, 0.1);
}

html[data-theme="light"] .tp-overlay-change-badge {
    background: rgba(245, 158, 11, 0.1);
}

/* ── Slide-out drawer ────────────────────────────────────────── */
.tp-drawer {
    width: 0;
    flex-shrink: 0;
    overflow: hidden;
    background: #0c0c22;
    border-left: 1px solid transparent;
    transition: width 0.18s ease;
    display: flex;
    flex-direction: column;
}

.tp-drawer.tp-drawer-open {
    width: 240px;
    border-left-color: #1a1a3a;
}

.tp-drawer-head {
    padding: 10px 12px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #60a5fa;
    border-bottom: 1px solid #1a1a3a;
    flex-shrink: 0;
}

.tp-drawer-search {
    padding: 8px;
    border-bottom: 1px solid #1a1a3a;
    flex-shrink: 0;
}

.tp-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.tp-drawer-section {
    padding: 10px 12px;
}

.tp-drawer-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: #b0b0d0;
    margin-bottom: 8px;
}

.tp-drawer-hint {
    font-size: 0.62rem;
    color: #5a5a8a;
    line-height: 1.5;
}

/* Service items inside drawer */
.tp-svc-item {
    padding: 7px 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.12s;
    margin-bottom: 1px;
}

.tp-svc-item:hover {
    background: rgba(59, 130, 246, 0.08);
}

.tp-svc-item.tp-svc-active {
    background: rgba(59, 130, 246, 0.15);
}

.tp-svc-item.tp-svc-active .tp-svc-name {
    color: #60a5fa;
}

.tp-svc-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: #b0b0d0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-svc-cms {
    font-size: 0.5rem;
    color: #4a4a6a;
    margin-top: 1px;
    font-family: var(--font-mono);
}

.tp-svc-search-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #1a1a3a;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    color: #c0c0d8;
    font-size: 0.65rem;
    font-family: var(--font-main);
    outline: none;
    box-sizing: border-box;
}

.tp-svc-search-input:focus {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.06);
}

.tp-svc-search-input::placeholder {
    color: #4a4a6a;
}

/* ── Action buttons in drawers ───────────────────────────────── */
.tp-action-btn {
    display: block;
    width: 100%;
    padding: 8px 0;
    margin-top: 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.15s;
}

.tp-action-change {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.tp-action-change:hover {
    background: rgba(59, 130, 246, 0.25);
}

.tp-action-incident {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.tp-action-incident:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* ── Incident form fields ────────────────────────────────────── */
.tp-field-label {
    display: block;
    font-size: 0.58rem;
    font-weight: 600;
    color: #8a8aaa;
    margin: 8px 0 3px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tp-field-input,
.tp-field-select,
.tp-field-textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #1a1a3a;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    color: #c0c0d8;
    font-size: 0.65rem;
    font-family: var(--font-main);
    outline: none;
    box-sizing: border-box;
}

.tp-field-input:focus,
.tp-field-select:focus,
.tp-field-textarea:focus {
    border-color: #3b82f6;
}

.tp-field-select {
    appearance: auto;
}

.tp-field-textarea {
    resize: vertical;
    min-height: 60px;
}

/* ── Light theme overrides ───────────────────────────────────── */
html[data-theme="light"] .tp-toolbar {
    background: #e4e6ec;
    border-left-color: #ccc;
}

html[data-theme="light"] .tp-tb-btn {
    color: #8895a7;
}

html[data-theme="light"] .tp-tb-btn:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #4a5568;
}

html[data-theme="light"] .tp-tb-btn.tp-tb-active {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

html[data-theme="light"] .tp-drawer {
    background: #e8e8f0;
}

html[data-theme="light"] .tp-drawer.tp-drawer-open {
    border-left-color: #ccc;
}

html[data-theme="light"] .tp-drawer-head {
    border-bottom-color: #ccc;
    color: #2563eb;
}

html[data-theme="light"] .tp-drawer-search {
    border-bottom-color: #ccc;
}

html[data-theme="light"] .tp-svc-name {
    color: #334155;
}

html[data-theme="light"] .tp-svc-item.tp-svc-active .tp-svc-name {
    color: #2563eb;
}

html[data-theme="light"] .tp-svc-search-input {
    background: #fff;
    border-color: #cbd5e1;
    color: #1a1a2e;
}

html[data-theme="light"] .tp-field-input,
html[data-theme="light"] .tp-field-select,
html[data-theme="light"] .tp-field-textarea {
    background: #fff;
    border-color: #cbd5e1;
    color: #1a1a2e;
}

html[data-theme="light"] .tp-drawer-section-title {
    color: #334155;
}

html[data-theme="light"] .tp-drawer-hint {
    color: #64748b;
}

/* ── Timeline (shared by incident + change) ──────────────────── */
.tp-tl-range {
    display: flex;
    gap: 3px;
    margin-bottom: 8px;
}

.tp-tl-range-btn {
    flex: 1;
    padding: 4px 0;
    border: 1px solid #1a1a3a;
    border-radius: 4px;
    background: transparent;
    color: #5a5a8a;
    font-size: 0.55rem;
    font-weight: 700;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.12s;
    text-align: center;
}

.tp-tl-range-btn:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #8a8ac0;
}

.tp-tl-range-btn.tp-tl-active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.tp-timeline {
    min-height: 40px;
}

.tp-tl-loading {
    font-size: 0.6rem;
    color: #5a5a8a;
    padding: 8px 0;
    text-align: center;
}

.tp-tl-empty {
    font-size: 0.6rem;
    color: #3a3a6a;
    padding: 12px 0;
    text-align: center;
}

/* Track (horizontal bar with markers + dots) */
.tp-tl-track {
    position: relative;
    margin-bottom: 10px;
    padding: 0 2px;
}

.tp-tl-markers {
    position: relative;
    height: 16px;
    border-bottom: 1px solid #1a1a3a;
    margin-bottom: 0;
}

.tp-tl-marker {
    position: absolute;
    bottom: 2px;
    transform: translateX(-50%);
    font-size: 0.42rem;
    color: #4a4a6a;
    white-space: nowrap;
    font-family: var(--font-mono);
}

.tp-tl-events {
    position: relative;
    height: 24px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 4px 4px;
}

.tp-tl-event {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 1;
    padding: 4px;
}

.tp-tl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: transform 0.12s;
}

.tp-tl-event:hover .tp-tl-dot {
    transform: scale(1.6);
    box-shadow: 0 0 6px currentColor;
}

/* List below timeline */
.tp-tl-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.tp-tl-list::-webkit-scrollbar {
    display: none;
}

.tp-tl-list-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 5px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: default;
}

.tp-tl-list-item:hover {
    background: rgba(59, 130, 246, 0.04);
}

.tp-tl-list-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 3px;
}

.tp-tl-list-info {
    min-width: 0;
    flex: 1;
}

.tp-tl-list-num {
    font-size: 0.55rem;
    font-weight: 700;
    color: #8a8ac0;
    font-family: var(--font-mono);
}

.tp-tl-list-desc {
    font-size: 0.55rem;
    color: #b0b0d0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-tl-list-meta {
    font-size: 0.45rem;
    color: #4a4a6a;
    margin-top: 1px;
}

/* Light theme timeline */
html[data-theme="light"] .tp-tl-range-btn {
    border-color: #cbd5e1;
    color: #64748b;
}

html[data-theme="light"] .tp-tl-range-btn:hover {
    background: rgba(59, 130, 246, 0.06);
    color: #334155;
}

html[data-theme="light"] .tp-tl-range-btn.tp-tl-active {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border-color: #93c5fd;
}

html[data-theme="light"] .tp-tl-markers {
    border-bottom-color: #d8dee4;
}

html[data-theme="light"] .tp-tl-marker {
    color: #94a3b8;
}

html[data-theme="light"] .tp-tl-events {
    background: rgba(0, 0, 0, 0.02);
}

html[data-theme="light"] .tp-tl-list-item {
    border-bottom-color: #e2e8f0;
}

html[data-theme="light"] .tp-tl-list-item:hover {
    background: rgba(59, 130, 246, 0.04);
}

html[data-theme="light"] .tp-tl-list-num {
    color: #2563eb;
}

html[data-theme="light"] .tp-tl-list-desc {
    color: #334155;
}

html[data-theme="light"] .tp-tl-list-meta {
    color: #94a3b8;
}

html[data-theme="light"] .tp-tl-empty {
    color: #94a3b8;
}

/* ── Full-width calendar incident lifecycle ──────────────────── */
/* Sidebar tool-active state */
.tp-mode-btn.tp-tool-active {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid #3b82f6;
    color: #60a5fa;
    box-shadow: inset 0 0 12px rgba(59, 130, 246, 0.1);
    animation: tp-tool-glow 2s ease-in-out infinite;
}

@keyframes tp-tool-glow {

    0%,
    100% {
        box-shadow: inset 0 0 12px rgba(59, 130, 246, 0.1);
    }

    50% {
        box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.2);
    }
}

.tp-mode-btn.tp-tool-active .tp-mode-label {
    color: #60a5fa;
    font-weight: 700;
}

html[data-theme="light"] .tp-mode-btn.tp-tool-active {
    background: rgba(37, 99, 235, 0.08);
    border-left-color: #2563eb;
    color: #2563eb;
}

/* Calendar top bar: title + range + pills */
.tp-cal {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.tp-cal-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #0c0c22;
    border-bottom: 1px solid #1a1a3a;
    flex-shrink: 0;
    overflow: hidden;
}

.tp-cal-top-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.tp-cal-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: #c0c0e0;
    white-space: nowrap;
}

.tp-cal-pills {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
    padding: 2px 0;
}

.tp-cal-pills::-webkit-scrollbar {
    display: none;
}

.tp-cal-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: #8a8ac0;
    font-size: 0.55rem;
    font-weight: 600;
    font-family: var(--font-mono);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.12s;
    flex-shrink: 0;
}

.tp-cal-pill:hover {
    background: rgba(255, 255, 255, 0.04);
}

.tp-cal-pill-active {
    color: #e0e0ff;
}

.tp-cal-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Body: scrollable lifecycle */
.tp-cal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 16px 24px 24px;
    position: relative;
}

.tp-cal-body::-webkit-scrollbar {
    display: none;
}

/* Lifecycle container */
.tp-cal-lc {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tp-cal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.tp-cal-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

/* Calendar ruler */
.tp-cal-ruler {
    position: relative;
    height: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tp-cal-tick {
    position: absolute;
    bottom: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tp-cal-tick-line {
    width: 1px;
    height: 8px;
    background: rgba(255, 255, 255, 0.12);
}

.tp-cal-tick-label {
    font-size: 0.42rem;
    color: #4a4a6a;
    white-space: nowrap;
    font-family: var(--font-mono);
    margin-bottom: 2px;
}

/* Stage swim lane */
.tp-cal-lane {
    position: relative;
    height: 140px;
    margin: 0;
}

/* Duration bars between stages */
.tp-cal-bar {
    position: absolute;
    top: 28px;
    height: 4px;
    border-radius: 2px;
    z-index: 1;
}

.tp-cal-bar-done {
    background: rgba(52, 199, 89, 0.35);
}

.tp-cal-bar-pending {
    background: rgba(255, 255, 255, 0.04);
}

.tp-cal-bar-dur {
    position: absolute;
    top: 12px;
    transform: translateX(-50%);
    font-size: 0.45rem;
    font-weight: 700;
    color: #60a5fa;
    font-family: var(--font-mono);
    white-space: nowrap;
    background: var(--bg-primary, #08081a);
    padding: 0 4px;
    z-index: 2;
}

/* Event cards on the lane */
.tp-cal-event {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 3;
    width: 90px;
}

.tp-cal-event-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid;
    margin-bottom: 4px;
    flex-shrink: 0;
    z-index: 4;
}

.tp-cal-event-done .tp-cal-event-dot {
    background: #34c759;
    border-color: #34c759;
    box-shadow: 0 0 8px rgba(52, 199, 89, 0.3);
}

.tp-cal-event-current .tp-cal-event-dot {
    background: #3b82f6;
    border-color: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
    animation: tp-cal-pulse 2s ease-in-out infinite;
}

.tp-cal-event-pending .tp-cal-event-dot {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.12);
}

@keyframes tp-cal-pulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    }
}

.tp-cal-event-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 4px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
    text-align: center;
}

.tp-cal-event-done .tp-cal-event-card {
    background: rgba(52, 199, 89, 0.06);
    border-color: rgba(52, 199, 89, 0.15);
}

.tp-cal-event-current .tp-cal-event-card {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

.tp-cal-event-pending .tp-cal-event-card {
    opacity: 0.4;
}

.tp-cal-event-icon {
    font-size: 1rem;
}

.tp-cal-event-label {
    font-size: 0.52rem;
    font-weight: 700;
    color: #c0c0e0;
}

.tp-cal-event-pending .tp-cal-event-label {
    color: #4a4a6a;
}

.tp-cal-event-time {
    font-size: 0.42rem;
    color: #5a5a8a;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.tp-cal-event-who {
    font-size: 0.44rem;
    color: #8a8ac0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 1px;
}

/* Assignment history track */
.tp-cal-assign-section {
    padding-top: 4px;
}

.tp-cal-assign-title {
    font-size: 0.55rem;
    font-weight: 700;
    color: #5a5a8a;
    margin-bottom: 6px;
}

.tp-cal-assign-track {
    position: relative;
    height: 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.tp-cal-assign-marker {
    position: absolute;
    top: 4px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.tp-cal-assign-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8b5cf6;
    border: 1px solid #a78bfa;
}

.tp-cal-assign-label {
    font-size: 0.4rem;
    color: #a78bfa;
    white-space: nowrap;
    font-family: var(--font-mono);
}

/* Tool overlay panel (slide-in from right) */
.tp-tool-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    z-index: 20;
    background: rgba(8, 8, 26, 0.95);
    border-left: 1px solid #1a1a3a;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    animation: tp-tool-slide 0.2s ease-out;
}

@keyframes tp-tool-slide {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.tp-tool-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tp-tool-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #1a1a3a;
    font-size: 0.65rem;
    font-weight: 700;
    color: #c0c0e0;
}

.tp-tool-close {
    background: none;
    border: none;
    color: #5a5a8a;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.tp-tool-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #c0c0e0;
}

.tp-tool-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tp-tool-hint {
    font-size: 0.58rem;
    color: #5a5a8a;
    line-height: 1.5;
    padding: 8px 0;
}

/* CI Inspector panel */
.tp-ci-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tp-ci-class {
    font-size: 0.5rem;
    font-weight: 600;
    color: #5a5a8a;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tp-ci-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.tp-ci-props {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tp-ci-prop {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.tp-ci-prop-lbl {
    font-size: 0.48rem;
    font-weight: 600;
    color: #5a5a8a;
    flex-shrink: 0;
}

.tp-ci-prop-val {
    font-size: 0.52rem;
    color: #b0b0d0;
    text-align: right;
    word-break: break-word;
}

.tp-ci-children-head {
    font-size: 0.55rem;
    font-weight: 700;
    color: #8a8ac0;
    margin-top: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tp-ci-children {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tp-ci-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}

.tp-ci-child:hover {
    background: rgba(59, 130, 246, 0.06);
}

.tp-ci-child-name {
    font-size: 0.52rem;
    font-weight: 600;
    color: #b0b0d0;
}

.tp-ci-child-rel {
    font-size: 0.42rem;
    color: #4a4a6a;
    font-family: var(--font-mono);
}

.tp-ci-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Light theme overrides */
html[data-theme="light"] .tp-cal-top {
    background: #e8e8f0;
    border-bottom-color: #ccc;
}

html[data-theme="light"] .tp-cal-title {
    color: #1e293b;
}

html[data-theme="light"] .tp-cal-pill {
    color: #475569;
    border-color: #d1d5db;
}

html[data-theme="light"] .tp-cal-pill-active {
    color: #1e293b;
}

html[data-theme="light"] .tp-cal-tick-label {
    color: #94a3b8;
}

html[data-theme="light"] .tp-cal-ruler {
    border-bottom-color: #e2e8f0;
}

html[data-theme="light"] .tp-cal-bar-done {
    background: rgba(52, 199, 89, 0.25);
}

html[data-theme="light"] .tp-cal-event-card {
    background: #f8f9fa;
    border-color: #e2e8f0;
}

html[data-theme="light"] .tp-cal-event-done .tp-cal-event-card {
    background: rgba(52, 199, 89, 0.05);
    border-color: rgba(52, 199, 89, 0.15);
}

html[data-theme="light"] .tp-cal-event-current .tp-cal-event-card {
    background: rgba(59, 130, 246, 0.05);
    border-color: rgba(59, 130, 246, 0.15);
}

html[data-theme="light"] .tp-cal-event-label {
    color: #1e293b;
}

html[data-theme="light"] .tp-cal-event-who {
    color: #475569;
}

html[data-theme="light"] .tp-cal-bar-dur {
    color: #2563eb;
    background: #f0f2f5;
}

html[data-theme="light"] .tp-cal-assign-label {
    color: #7c3aed;
}

html[data-theme="light"] .tp-tool-overlay {
    background: rgba(240, 242, 245, 0.95);
    border-left-color: #d1d5db;
}

html[data-theme="light"] .tp-tool-panel-head {
    border-bottom-color: #e2e8f0;
    color: #1e293b;
}

html[data-theme="light"] .tp-ci-prop-val {
    color: #334155;
}

html[data-theme="light"] .tp-ci-child-name {
    color: #334155;
}

/* Lifecycle shared styles */
.tp-lc-number {
    font-size: 1.1rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.tp-lc-desc {
    font-size: 0.8rem;
    color: #b0b0d0;
    line-height: 1.5;
}

.tp-lc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.tp-lc-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.58rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    color: #8a8ac0;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.tp-lc-total {
    font-size: 0.7rem;
    color: #5a5a8a;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.tp-lc-total strong {
    color: #60a5fa;
}

.tp-lc-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tp-lc-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    min-width: 120px;
}

.tp-lc-detail-lbl {
    font-size: 0.5rem;
    font-weight: 700;
    color: #5a5a8a;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tp-lc-detail-val {
    font-size: 0.65rem;
    color: #b0b0d0;
}

.tp-lc-activity {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 12px;
}

.tp-lc-activity-head {
    font-size: 0.65rem;
    font-weight: 700;
    color: #8a8ac0;
    margin-bottom: 8px;
}

.tp-lc-act-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.6rem;
}

.tp-lc-act-time {
    width: 90px;
    flex-shrink: 0;
    color: #4a4a6a;
    font-family: var(--font-mono);
    font-size: 0.5rem;
}

.tp-lc-act-type {
    width: 70px;
    flex-shrink: 0;
    color: #5a5a8a;
    font-weight: 600;
    font-size: 0.5rem;
}

.tp-lc-act-val {
    flex: 1;
    min-width: 0;
    color: #8a8aaa;
    line-height: 1.4;
}

html[data-theme="light"] .tp-lc-desc {
    color: #334155;
}

html[data-theme="light"] .tp-lc-badge {
    background: rgba(0, 0, 0, 0.04);
    color: #475569;
    border-color: #e2e8f0;
}

html[data-theme="light"] .tp-lc-total {
    color: #64748b;
    border-top-color: #e2e8f0;
}

html[data-theme="light"] .tp-lc-detail {
    background: #f8f9fa;
    border-color: #e2e8f0;
}

html[data-theme="light"] .tp-lc-detail-val {
    color: #334155;
}

html[data-theme="light"] .tp-lc-activity {
    border-top-color: #e2e8f0;
}

html[data-theme="light"] .tp-lc-act-val {
    color: #475569;
}

.tp-page {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 20px 28px;
    box-sizing: border-box;
    overflow: hidden;
}

.tp-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.tp-page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e0e0f0;
}

.tp-tl-range-wide {
    gap: 6px;
}

.tp-tl-range-wide .tp-tl-range-btn {
    padding: 6px 16px;
    font-size: 0.65rem;
    border-radius: 6px;
    flex: none;
}

.tp-page-timeline {
    flex-shrink: 0;
    margin-bottom: 16px;
}

.tp-tl-track-wide {
    margin-bottom: 0;
}

.tp-tl-track-wide .tp-tl-markers {
    height: 20px;
}

.tp-tl-events-wide {
    height: 36px;
}

.tp-tl-events-wide .tp-tl-dot {
    width: 10px;
    height: 10px;
}

.tp-page-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tp-page-list::-webkit-scrollbar {
    display: none;
}

.tp-page-list-inner {
    display: flex;
    flex-direction: column;
}

.tp-page-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.72rem;
}

.tp-page-row:hover {
    background: rgba(59, 130, 246, 0.04);
}

.tp-page-row-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tp-page-row-num {
    width: 100px;
    font-weight: 700;
    color: #8a8ac0;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    flex-shrink: 0;
}

.tp-page-row-desc {
    flex: 1;
    min-width: 0;
    color: #b0b0d0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-page-row-state {
    width: 80px;
    font-size: 0.6rem;
    color: #5a5a8a;
    text-align: center;
    flex-shrink: 0;
}

.tp-page-row-time {
    width: 110px;
    font-size: 0.6rem;
    color: #4a4a6a;
    font-family: var(--font-mono);
    text-align: right;
    flex-shrink: 0;
}

/* Light theme full-page timeline */
html[data-theme="light"] .tp-page-title {
    color: #1a1a2e;
}

html[data-theme="light"] .tp-page-row {
    border-bottom-color: #e2e8f0;
}

html[data-theme="light"] .tp-page-row:hover {
    background: rgba(59, 130, 246, 0.04);
}

html[data-theme="light"] .tp-page-row-num {
    color: #2563eb;
}

html[data-theme="light"] .tp-page-row-desc {
    color: #334155;
}

html[data-theme="light"] .tp-page-row-state {
    color: #64748b;
}

html[data-theme="light"] .tp-page-row-time {
    color: #94a3b8;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================
   CSS Variables - Control Room Palette
   ============================================ */
:root {
    /* Background layers */
    --bg-black: #0a0e14;
    --bg-charcoal: #151921;
    --bg-panel: #1a1f2e;
    --bg-surface: #212838;
    --bg-elevated: #2a3142;

    /* Neon accent colors - STATUS ONLY */
    --status-critical: #ff3366;
    --status-high: #ff9500;
    --status-medium: #ffd60a;
    --status-low: #0a84ff;
    --status-operational: #30d158;

    /* Functional colors */
    --neon-cyan: #00d9ff;
    --neon-blue: #0a84ff;
    --neon-green: #30d158;
    --neon-amber: #ff9500;
    --neon-red: #ff3366;
    --neon-purple: #bf5af2;

    /* Text */
    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-dim: #4b5563;

    /* Borders & dividers */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-normal: rgba(255, 255, 255, 0.12);
    --border-bright: rgba(255, 255, 255, 0.2);

    /* Glows */
    --glow-cyan: 0 0 20px rgba(0, 217, 255, 0.3);
    --glow-blue: 0 0 20px rgba(10, 132, 255, 0.3);
    --glow-green: 0 0 20px rgba(48, 209, 88, 0.3);
    --glow-amber: 0 0 20px rgba(255, 149, 0, 0.3);
    --glow-red: 0 0 20px rgba(255, 51, 102, 0.3);

    /* Domain colors for equipment */
    --domain-satellite: #bf5af2;
    --domain-ip: #0a84ff;
    --domain-cloud: #00d9ff;
    --domain-processing: #ff9500;
    --domain-routing: #30d158;

    /* Font */
    --font-main: 'Inter', 'Roboto', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Roboto Mono', 'Consolas', monospace;

    /* Aliases used by inline dialog styles */
    --card-bg: #1e2433;
    --border-color: rgba(255, 255, 255, 0.12);
    --text-color: #e8eaed;
}

/* ============================================
   LIGHT THEME — variable overrides
   Applied when <html data-theme="light">
   ============================================ */
html[data-theme="light"] {
    /* Background layers */
    --bg-black: #f0f2f7;
    --bg-charcoal: #e6e9f2;
    --bg-panel: #ffffff;
    --bg-surface: #f4f5fb;
    --bg-elevated: #eaecf5;

    /* Accent colours — darkened for legibility on white */
    --neon-cyan: #0284c7;
    --neon-blue: #1d4ed8;
    --neon-green: #16a34a;
    --neon-amber: #d97706;
    --neon-red: #dc2626;
    --neon-purple: #7c3aed;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-dim: #9ca3af;

    /* Borders */
    --border-subtle: rgba(0, 0, 0, 0.07);
    --border-normal: rgba(0, 0, 0, 0.12);
    --border-bright: rgba(0, 0, 0, 0.22);

    /* Glows — removed in light mode */
    --glow-cyan: none;
    --glow-blue: none;
    --glow-green: none;
    --glow-amber: none;
    --glow-red: none;

    /* Domain colours */
    --domain-satellite: #c026d3;
    --domain-ip: #2563eb;
    --domain-cloud: #0284c7;
    --domain-processing: #ea580c;
    --domain-routing: #16a34a;

    /* Aliases used by inline dialog styles */
    --card-bg: #ffffff;
    --border-color: rgba(0, 0, 0, 0.15);
    --text-color: #111827;
}

/* ── Light mode: surfaces that use hardcoded dark hex values ── */

html[data-theme="light"] body {
    background: linear-gradient(135deg, #e8eaf2 0%, #f0f2f7 100%);
    color: var(--text-primary);
}

html[data-theme="light"] .container {
    background: var(--bg-black);
}

html[data-theme="light"] .header {
    background: linear-gradient(180deg, #ffffff 0%, #f4f5fb 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .header::after {
    background: linear-gradient(90deg, transparent 0%, var(--neon-cyan) 50%, transparent 100%);
    opacity: 0.4;
}

html[data-theme="light"] .header h1 {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

html[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f4f5fb 100%);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .sidebar-header {
    background: var(--bg-surface);
}

html[data-theme="light"] .topology-list {
    background: var(--bg-charcoal);
}

html[data-theme="light"] .topology-item {
    background: #ffffff;
    border-color: var(--border-subtle);
}

html[data-theme="light"] .topology-item:hover {
    background: #f0f8ff;
    border-color: var(--neon-cyan);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .topology-item.active {
    background: #e8f4fd;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

html[data-theme="light"] .topology-item.alarmed {
    background: #fff0f3;
    border-color: rgba(220, 38, 38, 0.5);
    border-left-color: #dc2626;
    box-shadow: inset 3px 0 0 #dc2626, 0 0 0 1px rgba(220, 38, 38, 0.15);
}

html[data-theme="light"] .topology-item.alarmed .topology-item-name {
    color: #dc2626;
}

html[data-theme="light"] .cms-id {
    color: var(--neon-cyan);
    background: rgba(2, 132, 199, 0.1);
    border-color: rgba(2, 132, 199, 0.25);
}

html[data-theme="light"] .search-box {
    background: #ffffff;
    color: var(--text-primary);
    border-color: var(--border-normal);
}

html[data-theme="light"] .search-box:focus {
    background: #ffffff;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

html[data-theme="light"] .visualization {
    background: var(--bg-black);
}

html[data-theme="light"] .password-overlay,
html[data-theme="light"] .app-loading-overlay {
    background: linear-gradient(135deg, #e8eaf2 0%, #f0f2f7 100%);
}

/* Graph canvas */
html[data-theme="light"] .graph-container {
    background: linear-gradient(180deg, #eef0f8 0%, #f4f5fb 100%);
}

/* Graph node base */
html[data-theme="light"] .graph-node {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.14);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

html[data-theme="light"] .graph-node[data-node-type="function"] {
    background: #f0f4ff;
    border-color: rgba(29, 78, 216, 0.3);
}

html[data-theme="light"] .graph-node[data-node-type="resource"] {
    background: #f0fdf4;
    border-color: rgba(22, 163, 74, 0.3);
}

/* Domain node backgrounds — light tints */
html[data-theme="light"] .graph-node[data-node-kind="codec"],
html[data-theme="light"] .graph-node[data-node-name*="SAT"],
html[data-theme="light"] .graph-node[data-node-name*="ACQ"],
html[data-theme="light"] .graph-node[data-node-name*="IRD"] {
    background: #fdf4ff;
    border-color: rgba(192, 38, 211, 0.45);
    box-shadow: 0 0 12px rgba(192, 38, 211, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .graph-node[data-node-kind="switch"],
html[data-theme="light"] .graph-node[data-node-kind="gateway"],
html[data-theme="light"] .graph-node[data-node-name*="SWITCH"],
html[data-theme="light"] .graph-node[data-node-name*="GATEWAY"],
html[data-theme="light"] .graph-node[data-node-name*="IP"],
html[data-theme="light"] .graph-node[data-node-name*="ROUTER"] {
    background: #f0fdf4;
    border-color: rgba(22, 163, 74, 0.45);
    box-shadow: 0 0 12px rgba(22, 163, 74, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .graph-node[data-node-name*="ENCODE"],
html[data-theme="light"] .graph-node[data-node-name*="DECODE"],
html[data-theme="light"] .graph-node[data-node-name*="MUX"],
html[data-theme="light"] .graph-node[data-node-name*="PROC"],
html[data-theme="light"] .graph-node[data-node-name*="TRANSCODE"] {
    background: #eff6ff;
    border-color: rgba(29, 78, 216, 0.45);
    box-shadow: 0 0 12px rgba(29, 78, 216, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .graph-node[data-node-kind="link"],
html[data-theme="light"] .graph-node[data-node-name*="AWS"],
html[data-theme="light"] .graph-node[data-node-name*="Cloud"],
html[data-theme="light"] .graph-node[data-node-name*="DIST"],
html[data-theme="light"] .graph-node[data-node-name*="MediaLive"],
html[data-theme="light"] .graph-node[data-node-name*="vDCM"],
html[data-theme="light"] .graph-node[data-node-name*="CDN"] {
    background: #fffbeb;
    border-color: rgba(217, 119, 6, 0.45);
    box-shadow: 0 0 12px rgba(217, 119, 6, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .graph-node[data-node-kind="selection"],
html[data-theme="light"] .graph-node[data-node-name*="SELECT"],
html[data-theme="light"] .graph-node[data-node-name*="CONTROL"],
html[data-theme="light"] .graph-node[data-node-name*="AUTO"] {
    background: #ecfeff;
    border-color: rgba(2, 132, 199, 0.45);
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .graph-node.faulted {
    background: #fff1f2 !important;
}

/* Node text — override hardcoded colours */
html[data-theme="light"] .graph-node .node-name {
    color: var(--text-primary);
}

html[data-theme="light"] .graph-node .node-class {
    color: var(--text-muted);
}

/* Signal flow lines — darker stroke for light bg */
html[data-theme="light"] .graph-line {
    stroke: rgba(2, 132, 199, 0.5);
    filter: none;
}

html[data-theme="light"] .depth-connector {
    color: rgba(2, 132, 199, 0.5);
}

/* Chain header */
html[data-theme="light"] .chain-header {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Topology node card */
html[data-theme="light"] .topology-node {
    background: #ffffff;
    border-color: var(--border-normal);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Node detail panel */
html[data-theme="light"] .node-detail-panel {
    background: #ffffff;
    border-color: var(--border-normal);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .ndp-header {
    background: var(--bg-surface);
}

html[data-theme="light"] .ndp-section {
    background: var(--bg-surface);
}

html[data-theme="light"] .ndp-highlight-card {
    background: rgba(2, 132, 199, 0.06);
    border-color: rgba(2, 132, 199, 0.25);
}

html[data-theme="light"] .ndp-highlight-value {
    color: var(--neon-cyan);
    text-shadow: none;
}

html[data-theme="light"] .ndp-highlight-card--out {
    background: rgba(22, 163, 74, 0.06);
    border-color: rgba(22, 163, 74, 0.22);
}

html[data-theme="light"] .ndp-highlight-card--out .ndp-highlight-value {
    color: var(--neon-green);
    text-shadow: none;
}

html[data-theme="light"] .ndp-badge {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--border-normal);
}

html[data-theme="light"] .ndp-badge-on {
    background: rgba(22, 163, 74, 0.1);
    color: #166534;
    border-color: rgba(22, 163, 74, 0.3);
}

html[data-theme="light"] .ndp-badge-off {
    background: rgba(220, 38, 38, 0.07);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.2);
}

html[data-theme="light"] .ndp-badge-run {
    background: rgba(2, 132, 199, 0.1);
    color: #075985;
    border-color: rgba(2, 132, 199, 0.3);
    box-shadow: none;
}

html[data-theme="light"] .ndp-backdrop {
    background: rgba(0, 0, 0, 0.3);
}

/* Doc content */
html[data-theme="light"] .doc-content h1 {
    color: var(--neon-cyan);
}

html[data-theme="light"] .doc-content code {
    background: var(--bg-elevated);
    color: var(--neon-blue);
    border-color: var(--border-normal);
}

html[data-theme="light"] .doc-content pre {
    background: var(--bg-elevated);
    border-color: var(--border-normal);
}

html[data-theme="light"] .doc-content th {
    background: var(--bg-elevated);
}

html[data-theme="light"] .doc-content blockquote {
    border-left-color: var(--neon-cyan);
}

/* Scrollbars */
html[data-theme="light"] ::-webkit-scrollbar-track {
    background: var(--bg-charcoal);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #c7cad8;
    border-color: var(--bg-charcoal);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #a0a5bc;
    box-shadow: none;
}

/* ── Theme toggle button ── */
.theme-toggle-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background: var(--bg-elevated);
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
    transform: translateY(-1px);
}

html[data-theme="light"] .theme-toggle-btn:hover {
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.2);
}

/* ============================================
   PASSWORD SCREEN
   ============================================ */
.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-black) 0%, var(--bg-charcoal) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease-out;
}

/* Modal overlay — semi-transparent backdrop for dialogs */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-overlay>div {
    color: var(--text-color);
}

.password-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.password-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.password-logo {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse-glow 2s ease-in-out infinite;
}

.password-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: -1.5rem;
}

.password-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 320px;
}

.password-field-wrapper {
    display: flex;
    width: 100%;
    border: 1px solid var(--border-normal);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.password-field-wrapper:focus-within {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1), var(--glow-cyan);
}

.password-input {
    flex: 1;
    padding: 0.8rem 1rem;
    background: var(--bg-charcoal);
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-mono);
    letter-spacing: 0.1em;
    outline: none;
}

.password-input::placeholder {
    color: var(--text-dim);
    letter-spacing: 0.05em;
    font-family: var(--font-main);
}

.password-submit {
    background: var(--bg-surface);
    border: none;
    border-left: 1px solid var(--border-subtle);
    padding: 0 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.password-submit:hover {
    background: var(--neon-cyan);
    color: var(--bg-black);
}

.password-error {
    font-size: 0.75rem;
    color: var(--status-critical);
    font-family: var(--font-mono);
    min-height: 1rem;
    text-align: center;
}

/* Stage-specific visual accents for Processing flow */
.dm-flow-stage-uplink .dm-flow-stage-head {
    background: rgba(59, 130, 246, 0.10);
    border-bottom-color: rgba(59, 130, 246, 0.35);
}

.dm-flow-stage-cloudin .dm-flow-stage-head {
    background: rgba(16, 185, 129, 0.10);
    border-bottom-color: rgba(16, 185, 129, 0.35);
}

.dm-flow-stage-aws .dm-flow-stage-head {
    background: rgba(245, 158, 11, 0.12);
    border-bottom-color: rgba(245, 158, 11, 0.40);
}

.dm-flow-stage-cloudout .dm-flow-stage-head {
    background: rgba(168, 85, 247, 0.12);
    border-bottom-color: rgba(168, 85, 247, 0.40);
}

.dm-flow-stage-downlink .dm-flow-stage-head {
    background: rgba(244, 63, 94, 0.10);
    border-bottom-color: rgba(244, 63, 94, 0.35);
}

/* DROM distribution stage accents */
.dm-flow-stage-premux .dm-flow-stage-head {
    background: rgba(167, 139, 250, 0.12);
    border-bottom-color: rgba(167, 139, 250, 0.40);
}

.dm-flow-stage-spectrum .dm-flow-stage-head {
    background: rgba(45, 212, 191, 0.12);
    border-bottom-color: rgba(45, 212, 191, 0.40);
}

.dm-flow-stage-retard .dm-flow-stage-head {
    background: rgba(251, 146, 60, 0.12);
    border-bottom-color: rgba(251, 146, 60, 0.40);
}

/* DROM separator in signal flow */
.dm-flow-drom-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    min-width: 24px;
}

.dm-flow-drom-sep span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #a78bfa;
    white-space: nowrap;
    border-left: 2px solid rgba(167, 139, 250, 0.35);
    padding-left: 6px;
}

.dm-stage-sheet-chip.dm-stage-sheet-uplink {
    background: rgba(59, 130, 246, 0.16);
}

.dm-stage-sheet-chip.dm-stage-sheet-cloudin {
    background: rgba(16, 185, 129, 0.16);
}

.dm-stage-sheet-chip.dm-stage-sheet-aws {
    background: rgba(245, 158, 11, 0.18);
}

.dm-stage-sheet-chip.dm-stage-sheet-cloudout {
    background: rgba(168, 85, 247, 0.18);
}

.dm-stage-sheet-chip.dm-stage-sheet-downlink {
    background: rgba(244, 63, 94, 0.16);
}

.password-error.shake {
    animation: password-shake 0.4s ease;
}

@keyframes password-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

/* ============================================
   Base Styles
   ============================================ */
body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--bg-black) 0%, var(--bg-charcoal) 100%);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-black);
}

/* ============================================
   TOP NAVIGATION BAR - Control Room Header
   ============================================ */
.header {
    background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-charcoal) 100%);
    border-bottom: 1px solid var(--border-normal);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 100;
    position: relative;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--neon-cyan) 50%,
            transparent 100%);
    opacity: 0.3;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header h1 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

/* Primary tab buttons in header */
.header .tab-nav {
    display: flex;
    gap: 0.25rem;
    padding: 0;
    background: transparent;
    border-bottom: none;
}

.primary-tab {
    padding: 0.45rem 1.1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.primary-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-subtle);
}

.primary-tab.active {
    color: var(--neon-cyan);
    background: rgba(0, 217, 255, 0.07);
    border-color: rgba(0, 217, 255, 0.25);
}

/* Secondary sub-nav strip */
.secondary-nav {
    background: var(--bg-charcoal);
    border-bottom: 1px solid var(--border-normal);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 34px;
    position: relative;
    z-index: 99;
}

.snav-group {
    display: flex;
    gap: 0;
    align-items: center;
}

.snav-tab {
    padding: 0.4rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.snav-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.snav-tab.active {
    color: var(--neon-cyan);
    border-bottom-color: var(--neon-cyan);
}

.snav-tab-add {
    padding: 0.25rem 0.6rem;
    background: transparent;
    border: 1px dashed var(--neon-cyan);
    border-radius: 4px;
    color: var(--neon-cyan);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
}

.snav-tab-add:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

.snav-import-btn {
    padding: 0.4rem 1rem;
    background: rgba(0, 217, 255, 0.08);
    border: 1px solid var(--neon-cyan);
    border-radius: 4px;
    color: var(--neon-cyan);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 1rem;
}

.snav-import-btn:hover {
    background: rgba(0, 217, 255, 0.15);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.2);
}

.snav-import-btn:active {
    transform: translateY(0);
}

html[data-theme="light"] .secondary-nav {
    background: #e8eaf2;
    border-bottom-color: var(--border-normal);
}

html[data-theme="light"] .snav-tab.active {
    color: var(--neon-cyan);
    border-bottom-color: var(--neon-cyan);
}

/* ============================================
   Tertiary Navigation (under CPF401)
   ============================================ */
.tertiary-nav {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 32px;
    position: relative;
    z-index: 98;
}

.tnav-group {
    display: flex;
    gap: 0;
    align-items: center;
}

.tnav-tab {
    padding: 0.35rem 0.9rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tnav-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
}

.tnav-tab.active {
    color: var(--neon-blue);
    border-bottom-color: var(--neon-blue);
}

html[data-theme="light"] .tertiary-nav {
    background: #f4f5fb;
    border-bottom-color: var(--border-subtle);
}

html[data-theme="light"] .tnav-tab.active {
    color: var(--neon-blue);
    border-bottom-color: var(--neon-blue);
}


.header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.btn-icon {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-elevated);
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
    transform: translateY(-1px);
}

/* ============================================
   MAIN CONTENT LAYOUT
   ============================================ */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--bg-black);
}

/* ── Right Role Sidebar (icon toolbar) ─────────────────────── */
.role-sidebar {
    width: 42px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
}

.viewer-role-context {
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

html[data-theme="light"] .role-sidebar {
    background: #fff;
    border-left-color: rgba(0, 0, 0, 0.08);
}

/* ============================================
   SIDEBAR - Service List Panel
   ============================================ */
.sidebar {
    width: 340px;
    background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-charcoal) 100%);
    border-right: 1px solid var(--border-normal);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.sidebar-header h2 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.sidebar-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}

.search-box {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--bg-charcoal);
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: var(--font-main);
}

.search-box::placeholder {
    color: var(--text-dim);
}

.search-box:focus {
    outline: none;
    border-color: var(--neon-cyan);
    background: var(--bg-panel);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1), var(--glow-cyan);
}

.sidebar-controls {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-charcoal);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.checkbox-label:hover {
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--neon-cyan);
}

.topology-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    background: var(--bg-charcoal);
}

/* ============================================
   SERVICE CARDS - Incident/Service Items
   ============================================ */
.topology-item {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--border-subtle);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.topology-item:hover {
    background: var(--bg-surface);
    border-color: var(--neon-cyan);
    border-left-color: var(--neon-cyan);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), var(--glow-cyan);
    transform: translateX(4px);
}

.topology-item.active {
    background: var(--bg-elevated);
    border-color: var(--neon-cyan);
    border-left-color: var(--neon-cyan);
    box-shadow: 0 0 0 2px rgba(0, 217, 255, 0.2), var(--glow-cyan);
}

.topology-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--neon-cyan), var(--neon-blue));
    box-shadow: 0 0 10px var(--neon-cyan);
}

.topology-item-name {
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.topology-item-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.cms-id {
    font-size: 0.7rem;
    color: var(--neon-cyan);
    background: rgba(0, 217, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    border: 1px solid rgba(0, 217, 255, 0.2);
}

.topology-item.active .cms-id {
    background: rgba(0, 217, 255, 0.2);
    color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 217, 255, 0.3);
}

.topology-item-id {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.topology-item.active .topology-item-id {
    color: var(--text-secondary);
}

/* Alarmed service group tile */
.topology-item.alarmed {
    border-color: rgba(255, 51, 102, 0.6);
    border-left-color: #ff3366;
    background: rgba(255, 51, 102, 0.06);
    box-shadow: inset 3px 0 0 #ff3366, 0 0 0 1px rgba(255, 51, 102, 0.2);
}

.topology-item.alarmed .topology-item-name {
    color: #ff6688;
}

.topology-item.alarmed .cms-id {
    background: rgba(255, 51, 102, 0.12);
    color: #ff6688;
    border-color: rgba(255, 51, 102, 0.3);
}

/* Highlight animation when scrolled to from alarm tab */
@keyframes alarm-path-flash {
    0% {
        box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.8), 0 0 20px rgba(255, 153, 0, 0.4);
        background: rgba(255, 153, 0, 0.08);
    }

    50% {
        box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.5), 0 0 30px rgba(255, 153, 0, 0.2);
        background: rgba(255, 153, 0, 0.04);
    }

    100% {
        box-shadow: none;
        background: transparent;
    }
}

.chain-path-block.alarm-highlight-path {
    animation: alarm-path-flash 2.5s ease-out forwards;
    border-radius: 4px;
}

/* Status badge for items with functions */
.topology-item.has-functions {
    border-left-color: var(--status-operational);
}

.topology-item.has-functions::after {
    content: '●';
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--status-operational);
    font-size: 0.6rem;
    animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ============================================
   VISUALIZATION AREA - Main Canvas
   ============================================ */
.visualization {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-black);
}

/* Tab content panels */
.tab-content {
    flex: 1;
    overflow: auto;
    padding: 1rem 1.25rem;
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Documentation styles */
.doc-content {
    max-width: 900px;
    margin: 0 auto;
    color: var(--text-primary);
    line-height: 1.7;
}

.doc-content h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--neon-cyan);
    border-bottom: 2px solid var(--border-subtle);
    padding-bottom: 0.5rem;
}

.doc-content h2 {
    font-size: 1.5rem;
    margin: 1rem 0 0.4rem 0;
    color: var(--text-primary);
}

.doc-content h3 {
    font-size: 1.2rem;
    margin: 0.75rem 0 0.3rem 0;
    color: var(--text-secondary);
}

.doc-content p {
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.doc-content ul,
.doc-content ol {
    margin-bottom: 0.5rem;
    padding-left: 2rem;
    color: var(--text-secondary);
}

.doc-content li {
    margin-bottom: 0.15rem;
}

.doc-content code {
    background: var(--bg-surface);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--neon-cyan);
    border: 1px solid var(--border-subtle);
}

.doc-content pre {
    background: var(--bg-surface);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--border-normal);
}

.doc-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--text-primary);
}

.doc-content a {
    color: var(--neon-cyan);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.doc-content a:hover {
    border-bottom-color: var(--neon-cyan);
}

.doc-content blockquote {
    border-left: 3px solid var(--neon-cyan);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-muted);
    font-style: italic;
}

.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.doc-content th,
.doc-content td {
    padding: 0.75rem;
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.doc-content th {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 600;
}

.doc-content td {
    color: var(--text-secondary);
}

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.welcome svg {
    margin-bottom: 1.5rem;
    opacity: 0.3;
    filter: drop-shadow(0 0 20px rgba(0, 217, 255, 0.2));
}

.welcome h2 {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 1.1rem;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */
.loading-container,
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
}

/* Full-screen initial loading overlay */
.app-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-black) 0%, var(--bg-charcoal) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.app-loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.app-loading-overlay .loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.app-loading-overlay .loading-logo {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        opacity: 1;
        filter: drop-shadow(0 0 20px rgba(0, 217, 255, 0.5));
    }

    50% {
        opacity: 0.8;
        filter: drop-shadow(0 0 30px rgba(0, 217, 255, 0.8));
    }
}

.app-loading-overlay .spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
}

.app-loading-overlay .spinner {
    width: 80px;
    height: 80px;
    border: 4px solid var(--bg-surface);
    border-top-color: var(--neon-cyan);
    border-right-color: var(--neon-blue);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
    box-shadow: var(--glow-cyan);
}

.app-loading-overlay .loading-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.app-loading-overlay .loading-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--bg-surface);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
    box-shadow: var(--glow-cyan);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--status-critical);
    filter: drop-shadow(var(--glow-red));
}

.error-container h3 {
    color: var(--status-critical);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* ============================================
   CHAIN CONTAINER - Topology Visualization
   ============================================ */
.chain-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

.chain-header {
    display: none;
}

.chain-header h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chain-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.stat strong {
    font-size: 1.4rem;
    color: var(--neon-cyan);
    margin-right: 0.3rem;
    font-weight: 600;
}

/* ============================================
   TOPOLOGY VISUALIZATION - Card Grid Style
   ============================================ */
.chain-viz {
    background: transparent;
    border-radius: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    overflow-x: visible;
}

/* ── Multi-path stacked layout ─────────────────────────────────────────────── */
.chain-paths-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.chain-path-block {
    position: relative;
}

/* Thin separator line between paths — no bounding box */
.chain-path-block+.chain-path-block {
    border-top: none;
    margin-top: 0.25rem;
}

.chain-path-label {
    align-items: center;
    background: transparent;
    border: none;
    display: flex;
    gap: 0.75rem;
    padding: 0.3rem 1.5rem 0.15rem 1.5rem;
}

.chain-path-label-text {
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.7;
}

.chain-path-label-role {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.55;
}

.chain-path-block[data-role="Backup"] .chain-path-label-text,
.chain-path-block[data-role*="ackup"] .chain-path-label-text {
    color: var(--neon-amber);
}

.chain-path-body {
    border: none;
    overflow: hidden;
    margin-bottom: 0;
}

/* When tabs wrap the topology-node, remove its outer border/radius */
.chain-role-panel .topology-node {
    margin-bottom: 0;
    border: none;
    border-radius: 0;
}

/* ── Shared-node highlighting ─────────────────────────────────────────────── */
/* Nodes that appear in more than one path get a purple outline */
.graph-node--shared {
    outline: 2px solid #a78bfa;
    outline-offset: 2px;
}

.node-shared-badge {
    margin-top: 0.35rem;
    padding: 0.1rem 0.45rem;
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid #a78bfa;
    border-radius: 4px;
    color: #a78bfa;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: inline-block;
}

/* "N shared" counter in the path label bar */
.chain-path-shared-count {
    padding: 0.15rem 0.55rem;
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.5);
    border-radius: 20px;
    color: #a78bfa;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: default;
}

html[data-theme="light"] .chain-role-tab {
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--text-secondary);
}

html[data-theme="light"] .chain-role-tab.active {
    background: #fff;
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

/* When topology-node is inside a multi-path block, strip its own border/padding */
.chain-path-body .topology-node {
    margin-bottom: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.chain-path-body .topology-header {
    display: none;
    /* header info already shown at chain level */
}

.topology-node {
    margin-bottom: 1.5rem;
    background: var(--bg-panel);
    border: 2px solid var(--border-normal);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    transition: all 0.3s ease;
}

/* Severity-based border glow */
.topology-node[data-severity="critical"] {
    border-color: var(--status-critical);
    box-shadow: 0 0 30px rgba(255, 51, 102, 0.4), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.topology-node[data-severity="high"] {
    border-color: var(--status-high);
    box-shadow: 0 0 30px rgba(255, 149, 0, 0.4), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.topology-node[data-severity="medium"] {
    border-color: var(--status-medium);
    box-shadow: 0 0 30px rgba(255, 214, 10, 0.4), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.topology-node[data-severity="low"] {
    border-color: var(--status-low);
    box-shadow: 0 0 30px rgba(10, 132, 255, 0.4), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.topology-header {
    background: transparent;
    color: var(--text-primary);
    padding: 0 0 1rem 0;
    border-radius: 0;
    margin-bottom: 1.5rem;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: none;
    position: relative;
    overflow: visible;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.topology-header::before {
    display: none;
}

.topology-header h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topology-header .topology-id {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    opacity: 0.7;
    color: var(--text-muted);
}

/* Status counters in top-right */
.topology-header::after {
    content: attr(data-status-counters);
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

/* ============================================
   GRAPH CONTAINER - Broadcast Signal Chain
   ============================================ */
.graph-container {
    position: relative;
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(180deg, #080c12 0%, #111620 100%);
    border-radius: 0;
    margin: 0;
    border: none;
    align-items: center;
    flex-wrap: nowrap;
    min-height: 90px;
}

/* Signal flow lines */
.graph-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.graph-line {
    stroke: rgba(0, 217, 255, 0.6);
    stroke-width: 2;
    fill: none;
    opacity: 0.8;
    filter: drop-shadow(0 0 3px rgba(0, 217, 255, 0.4));
    stroke-dasharray: 5, 5;
    animation: signal-flow 3s linear infinite;
}

@keyframes signal-flow {
    0% {
        stroke-dashoffset: 0;
    }

    100% {
        stroke-dashoffset: -20;
    }
}

/* Depth columns - vertical stacking */
.depth-column {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 148px;
    max-width: 190px;
    align-items: stretch;
    position: relative;
    flex-shrink: 0;
}

/* ─── Inline connector between depth columns ─── */
.depth-connector {
    flex-shrink: 0;
    align-self: center;
    color: rgba(0, 217, 255, 0.45);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    user-select: none;
    padding: 0 0.1rem;
    position: relative;
    z-index: 2;
    transition: color 0.3s;
}

.depth-connector.connector-alarmed {
    color: rgba(255, 51, 102, 0.75);
    text-shadow: 0 0 6px rgba(255, 51, 102, 0.5);
    animation: alarm-connector-pulse 1.2s ease-in-out infinite;
}

.depth-connector.connector-downstream {
    color: rgba(255, 149, 0, 0.65);
    text-shadow: 0 0 5px rgba(255, 149, 0, 0.35);
}

@keyframes alarm-connector-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ============================================
   GRAPH NODES - Broadcast Equipment Blocks
   ============================================ */
.graph-node {
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-left: 3px solid rgba(0, 217, 255, 0.5);
    border-radius: 4px;
    padding: 0.6rem 0.9rem 0.6rem 0.75rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    z-index: 2;
    width: 100%;
    text-align: left;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 62px;
}

/* Status indicator - top-right corner */
.graph-node::before {
    content: '';
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--status-operational);
    box-shadow: 0 0 5px var(--status-operational);
}

/* Signal connector - right side */
.graph-node::after {
    display: none;
    /* Removed - using column-level arrows instead */
}

.graph-node:last-child::after {
    display: none;
}

/* Function blocks - rectangular */
.graph-node[data-node-type="function"] {
    border-radius: 4px;
    background: #1e2438;
    border-color: rgba(10, 132, 255, 0.35);
    border-left-color: rgba(10, 132, 255, 0.7);
}

/* Resource blocks - slightly rounded */
.graph-node[data-node-type="resource"] {
    border-radius: 4px;
    background: #1a2520;
    border-color: rgba(48, 209, 88, 0.35);
    border-left-color: rgba(48, 209, 88, 0.7);
}

/* ============================================
   DOMAIN-SPECIFIC EQUIPMENT COLORS
   Satellite/RF → Magenta/Pink
   IP/Transport → Green
   Processing → Blue
   Cloud/Distribution → Amber
   Control/Selection → Cyan
   ============================================ */

/* SATELLITE / RF - Magenta */
.graph-node[data-node-kind="codec"],
.graph-node[data-node-name*="SAT"],
.graph-node[data-node-name*="ACQ"],
.graph-node[data-node-name*="IRD"] {
    background: #221530;
    border-color: rgba(236, 72, 153, 0.4);
    border-left: 3px solid #ec4899;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.15), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.graph-node[data-node-kind="codec"]::before,
.graph-node[data-node-name*="SAT"]::before,
.graph-node[data-node-name*="ACQ"]::before,
.graph-node[data-node-name*="IRD"]::before {
    background: #ec4899;
    box-shadow: 0 0 6px #ec4899;
}

/* IP / TRANSPORT - Teal */
.graph-node[data-node-kind="switch"],
.graph-node[data-node-kind="gateway"],
.graph-node[data-node-name*="SWITCH"],
.graph-node[data-node-name*="GATEWAY"],
.graph-node[data-node-name*="IP"],
.graph-node[data-node-name*="ROUTER"] {
    background: #0d2520;
    border-color: rgba(20, 184, 166, 0.4);
    border-left: 3px solid #14b8a6;
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.15), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.graph-node[data-node-kind="switch"]::before,
.graph-node[data-node-kind="gateway"]::before,
.graph-node[data-node-name*="SWITCH"]::before,
.graph-node[data-node-name*="GATEWAY"]::before,
.graph-node[data-node-name*="IP"]::before,
.graph-node[data-node-name*="ROUTER"]::before {
    background: #14b8a6;
    box-shadow: 0 0 6px #14b8a6;
}

/* PROCESSING - Blue */
.graph-node[data-node-name*="ENCODE"],
.graph-node[data-node-name*="DECODE"],
.graph-node[data-node-name*="MUX"],
.graph-node[data-node-name*="PROC"],
.graph-node[data-node-name*="TRANSCODE"] {
    background: #0d1b2e;
    border-color: rgba(59, 130, 246, 0.4);
    border-left: 3px solid #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.15), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.graph-node[data-node-name*="ENCODE"]::before,
.graph-node[data-node-name*="DECODE"]::before,
.graph-node[data-node-name*="MUX"]::before,
.graph-node[data-node-name*="PROC"]::before,
.graph-node[data-node-name*="TRANSCODE"]::before {
    background: #3b82f6;
    box-shadow: 0 0 6px #3b82f6;
}

/* CLOUD / DISTRIBUTION - Amber */
.graph-node[data-node-kind="link"],
.graph-node[data-node-name*="AWS"],
.graph-node[data-node-name*="Cloud"],
.graph-node[data-node-name*="DIST"],
.graph-node[data-node-name*="MediaLive"],
.graph-node[data-node-name*="vDCM"],
.graph-node[data-node-name*="CDN"] {
    background: #201a0d;
    border-color: rgba(245, 158, 11, 0.4);
    border-left: 3px solid #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.15), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.graph-node[data-node-kind="link"]::before,
.graph-node[data-node-name*="AWS"]::before,
.graph-node[data-node-name*="Cloud"]::before,
.graph-node[data-node-name*="DIST"]::before,
.graph-node[data-node-name*="MediaLive"]::before,
.graph-node[data-node-name*="vDCM"]::before,
.graph-node[data-node-name*="CDN"]::before {
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
}

/* CONTROL / SELECTION - Cyan */
.graph-node[data-node-kind="selection"],
.graph-node[data-node-name*="SELECT"],
.graph-node[data-node-name*="CONTROL"],
.graph-node[data-node-name*="AUTO"] {
    background: #0a1e28;
    border-color: rgba(0, 217, 255, 0.35);
    border-left: 3px solid #00d9ff;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.15), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.graph-node[data-node-kind="selection"]::before,
.graph-node[data-node-name*="SELECT"]::before,
.graph-node[data-node-name*="CONTROL"]::before,
.graph-node[data-node-name*="AUTO"]::before {
    background: #00d9ff;
    box-shadow: 0 0 6px #00d9ff;
}

/* ============================================
   NODE INTERACTIONS
   ============================================ */
.graph-node:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
    border-color: rgba(0, 217, 255, 0.7);
    z-index: 10;
}

.graph-node.selected {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 2px;
    z-index: 10;
}

/* ============================================
   FAULTED NODE - Critical Status
   ============================================ */
.graph-node.faulted {
    background: #331a1a !important;
    border-color: var(--status-critical) !important;
    border-left-color: var(--status-critical) !important;
    box-shadow: 0 0 30px rgba(255, 51, 102, 0.6), 0 2px 8px rgba(0, 0, 0, 0.5);
    animation: pulse-fault 2s ease-in-out infinite;
}

.graph-node.faulted::before {
    background: var(--status-critical);
    box-shadow: 0 0 12px var(--status-critical);
    animation: pulse-dot 1s ease-in-out infinite;
}

.graph-node.faulted::after {
    color: var(--status-critical);
}

@keyframes pulse-fault {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(255, 51, 102, 0.6), 0 2px 8px rgba(0, 0, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 45px rgba(255, 51, 102, 0.9), 0 2px 8px rgba(0, 0, 0, 0.5);
    }
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ============================================
   NODE TYPOGRAPHY - Technical Sans
   ============================================ */
.graph-node .node-name {
    font-weight: 700;
    font-size: 0.72rem;
    margin-bottom: 0;
    color: #dde1ea;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
    line-height: 1.3;
    padding-right: 14px;
    word-break: break-word;
}

.graph-node .node-class {
    font-size: 0.6rem;
    color: #5a6278;
    margin-top: 0.25rem;
    text-transform: uppercase;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.graph-node .node-stats {
    display: none;
}

.graph-node .node-type {
    display: none;
}

/* Hardware device chip — shown inside a function node when a device CI is
   folded into it rather than rendered as a separate chain node. */
.node-device-chip {
    margin-top: 0.55rem;
    padding: 0.2rem 0.55rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    font-size: 0.62rem;
    font-family: var(--font-mono);
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

html[data-theme="light"] .node-device-chip {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #9ca3af;
}

/* ============================================
   DOMAIN GROUPING SECTIONS
   ============================================ */
.domain-section {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.domain-section::before {
    content: attr(data-domain-label);
    position: absolute;
    top: -1.5rem;
    left: 0;
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-mono);
}

.domain-section[data-domain="acquisition"] {
    border-left-color: rgba(255, 20, 147, 0.3);
}

.domain-section[data-domain="transport"] {
    border-left-color: rgba(48, 209, 88, 0.3);
}

.domain-section[data-domain="processing"] {
    border-left-color: rgba(10, 132, 255, 0.3);
}

.domain-section[data-domain="distribution"] {
    border-left-color: rgba(255, 149, 0, 0.3);
}

/* ============================================
   NODE DETAIL PANEL - floating window modal
   Read-only: no action buttons
   ============================================ */

/* Dim backdrop — click to close */
.ndp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.ndp-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.node-detail-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -48%) scale(0.97);
    width: 380px;
    max-height: 78vh;
    z-index: 200;
    background: var(--bg-panel);
    border: 1px solid var(--border-normal);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.node-detail-panel.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Header */
.ndp-header {
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--bg-surface);
    flex-shrink: 0;
}

.ndp-header-info {
    flex: 1;
    min-width: 0;
}

.ndp-name {
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ndp-class {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 0.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ndp-close {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    flex-shrink: 0;
    line-height: 1;
    transition: all 0.2s ease;
}

.ndp-close:hover {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

/* Scrollable body */
.ndp-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Sections */
.ndp-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 0.75rem;
}

.ndp-section-sys {
    background: transparent;
}

.ndp-section-title {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ndp-section-ts {
    color: var(--neon-cyan);
    font-size: 0.62rem;
    font-family: var(--font-mono);
    opacity: 0.8;
}

/* Rows */
.ndp-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.28rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    min-height: 26px;
}

.ndp-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ndp-row.ndp-desc {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.ndp-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 72px;
}

.ndp-value {
    font-size: 0.78rem;
    color: var(--text-primary);
    word-break: break-all;
}

.ndp-mono {
    font-family: var(--font-mono);
}

.ndp-small {
    font-size: 0.62rem;
    color: var(--text-muted);
}

/* Status dot */
.ndp-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* State badges */
.ndp-badges {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.ndp-badge {
    font-size: 0.58rem;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0.05em;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}

.ndp-badge-on {
    background: rgba(48, 209, 88, 0.12);
    color: #30d158;
    border-color: rgba(48, 209, 88, 0.35);
}

.ndp-badge-off {
    background: rgba(255, 51, 102, 0.08);
    color: #ff6b88;
    border-color: rgba(255, 51, 102, 0.25);
}

.ndp-badge-run {
    background: rgba(0, 217, 255, 0.12);
    color: var(--neon-cyan);
    border-color: rgba(0, 217, 255, 0.35);
    box-shadow: 0 0 6px rgba(0, 217, 255, 0.15);
}

/* Highlighted signal config cards (port, multicast IP) */
.ndp-highlight-card {
    background: rgba(0, 217, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.22);
    border-radius: 5px;
    padding: 0.6rem 0.8rem;
    margin: 0.3rem 0;
    box-shadow: inset 0 0 20px rgba(0, 217, 255, 0.04);
}

.ndp-highlight-label {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(0, 217, 255, 0.7);
    font-family: var(--font-mono);
    margin-bottom: 0.25rem;
}

.ndp-highlight-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--neon-cyan);
    text-shadow: 0 0 18px rgba(0, 217, 255, 0.45);
    letter-spacing: 0.04em;
    line-height: 1.1;
}

/* Smaller variant for long IP:port strings */
.ndp-highlight-value--sm {
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.ndp-mc-sep {
    opacity: 0.4;
    margin: 0 0.1em;
}

/* Output multicast card — slightly different tint */
.ndp-highlight-card--out {
    background: rgba(48, 209, 88, 0.05);
    border-color: rgba(48, 209, 88, 0.2);
}

.ndp-highlight-card--out .ndp-highlight-label {
    color: rgba(48, 209, 88, 0.7);
}

.ndp-highlight-card--out .ndp-highlight-value {
    color: #30d158;
    text-shadow: 0 0 18px rgba(48, 209, 88, 0.4);
}

/* Hardware device name shown as subheader inside DEVICE section */
.ndp-hardware-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    letter-spacing: 0.02em;
}

/* Chain position breadcrumb */
.ndp-chain-pos {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    font-size: 0.72rem;
    line-height: 1.4;
}

.ndp-chain-hop {
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.ndp-chain-self {
    color: var(--accent);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Loading / error states in panel */
.ndp-loading {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.ndp-error {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--status-critical);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

/* Selected state on graph nodes when panel is open */
.graph-node.selected {
    border-color: var(--neon-cyan) !important;
    box-shadow: 0 0 0 2px rgba(0, 217, 255, 0.35),
        0 4px 16px rgba(0, 0, 0, 0.6) !important;
    z-index: 15;
}

/* ============================================
   FUNCTION & STEP BOXES
   ============================================ */
.step-box {
    background: var(--bg-surface);
    border: 1px solid rgba(10, 132, 255, 0.4);
    padding: 1rem;
    border-radius: 12px;
    min-width: 180px;
    text-align: center;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(10, 132, 255, 0.2);
}

.step-box .step-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.step-box .step-class {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.function-box {
    background: var(--bg-surface);
    border: 1px solid rgba(255, 149, 0, 0.4);
    padding: 0.75rem 1rem;
    border-radius: 20px;
    min-width: 150px;
    text-align: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(255, 149, 0, 0.2);
}

.function-box:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 149, 0, 0.4);
    border-color: var(--neon-amber);
}

.fn-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.fn-class {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ============================================
   CMS PROGRAM HEADER - Topology info bar
   ============================================ */
.cms-program-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.cms-program-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-charcoal);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 5px;
    border: 2px solid var(--bg-charcoal);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-elevated);
    box-shadow: 0 0 8px rgba(0, 217, 255, 0.3);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-normal);
    }

    .visualization {
        padding: 1rem;
    }
}

/* ============================================
   ADDITIONAL UTILITY STYLES
   ============================================ */
.loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.flow-arrow {
    font-size: 1.5rem;
    color: var(--neon-cyan);
    font-weight: normal;
    margin: 0 0.5rem;
    flex-shrink: 0;
    opacity: 0.6;
}

.chain-flow {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

/* Convergence point - critical path indicator */
.convergence-point {
    border: 2px solid var(--status-critical) !important;
    box-shadow: 0 0 25px rgba(255, 51, 102, 0.6);
    position: relative;
    animation: pulse-fault 2s ease-in-out infinite;
}

.convergence-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    background: var(--status-critical);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.6);
    font-family: var(--font-mono);
}

/* Severity level styles */
.function-box.level-1 {
    border-color: rgba(48, 209, 88, 0.5);
    box-shadow: 0 0 12px rgba(48, 209, 88, 0.2);
}

.function-box.level-2 {
    border-color: rgba(10, 132, 255, 0.5);
    box-shadow: 0 0 12px rgba(10, 132, 255, 0.2);
}

.function-box.level-3 {
    border-color: rgba(191, 90, 242, 0.5);
    box-shadow: 0 0 12px rgba(191, 90, 242, 0.2);
}

.function-box.level-4 {
    border-color: rgba(255, 214, 10, 0.5);
    box-shadow: 0 0 12px rgba(255, 214, 10, 0.2);
}

.function-box.level-5,
.function-box.level-6,
.function-box.level-7,
.function-box.level-8,
.function-box.level-9,
.function-box.level-10 {
    border-color: rgba(255, 149, 0, 0.5);
    box-shadow: 0 0 12px rgba(255, 149, 0, 0.2);
}

/* ============================================
   SYNC STATUS TAB
   ============================================ */
.sync-panel {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.sync-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.sync-panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.sync-panel-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.sync-now-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sync-now-btn:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

.sync-now-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sync-status-msg {
    margin-bottom: 1.25rem;
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

.sync-status-running {
    color: #ff9500;
}

.sync-status-ok {
    color: #30d158;
}

.sync-status-err {
    color: #ff3366;
}

.sync-log-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sync-log-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 1rem 0;
}

.sync-log-entry {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 0.9rem 1.1rem;
    border-left: 3px solid var(--border-subtle);
}

.sync-log-entry.sync-log-complete {
    border-left-color: #30d158;
}

.sync-log-entry.sync-log-running {
    border-left-color: #ff9500;
}

.sync-log-entry.sync-log-error {
    border-left-color: #ff3366;
}

.sync-log-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.sync-log-time {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    flex: 1;
    min-width: 0;
}

.sync-log-badge {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    border: 1px solid;
}

.sync-log-badge-complete {
    color: #30d158;
    border-color: rgba(48, 209, 88, 0.3);
    background: rgba(48, 209, 88, 0.08);
}

.sync-log-badge-running {
    color: #ff9500;
    border-color: rgba(255, 149, 0, 0.3);
    background: rgba(255, 149, 0, 0.08);
}

.sync-log-badge-error {
    color: #ff3366;
    border-color: rgba(255, 51, 102, 0.3);
    background: rgba(255, 51, 102, 0.08);
}

.sync-log-dur {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.sync-log-diff {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border-subtle);
}

.sync-diff-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.73rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.sync-diff-label {
    font-size: 0.62rem;
    color: var(--text-dim);
    letter-spacing: 0.06em;
}

.sync-diff-add {
    color: #30d158;
    font-weight: 600;
}

.sync-diff-rem {
    color: #ff3366;
    font-weight: 600;
}

.sync-log-error {
    margin-top: 0.5rem;
    font-size: 0.73rem;
    color: #ff3366;
    font-family: var(--font-mono);
    word-break: break-all;
}

/* ── Post-sync change detail ──────────────────────────────────────────────── */
.sync-diff-detail {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sync-diff-none {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 0.5rem 0;
}

.sync-diff-section {
    border-radius: 6px;
    padding: 0.6rem 0.875rem;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
}

.sync-diff-section-title {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.sync-diff-section.sync-diff-added {
    border-color: rgba(48, 209, 88, 0.25);
}

.sync-diff-section.sync-diff-removed {
    border-color: rgba(255, 51, 102, 0.25);
}

.sync-diff-section.sync-diff-changed {
    border-color: rgba(255, 214, 10, 0.25);
}

.sync-diff-item {
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 0.2rem 0;
    font-family: var(--font-mono);
}

.sync-diff-field {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding-left: 1rem;
    margin-top: 0.15rem;
}

.sync-diff-field-name {
    color: var(--text-secondary);
}

.sync-diff-old {
    color: #ff3366;
    text-decoration: line-through;
}

.sync-diff-new {
    color: #30d158;
}

/* ── BNCS Agentic Ops Panel ───────────────────────────────────────────────── */
.ai-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid rgba(0, 217, 255, 0.35);
    color: var(--neon-cyan);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px rgba(0, 217, 255, 0.15);
    transition: all 0.2s ease;
}

.ai-toggle-btn:hover {
    border-color: rgba(0, 217, 255, 0.7);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 18px rgba(0, 217, 255, 0.3);
    transform: translateY(-1px);
}

.ai-toggle-btn.active {
    border-color: rgba(255, 51, 102, 0.5);
    color: var(--neon-red);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 51, 102, 0.2);
}

.ai-panel {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 370px;
    height: 480px;
    background: var(--bg-panel);
    border: 1px solid var(--border-normal);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    z-index: 1001;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.92) translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.ai-panel-header {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.ai-panel-logo {
    height: 22px;
    width: auto;
    object-fit: contain;
}

.ai-panel-logo--light {
    display: none;
}

html[data-theme="light"] .ai-panel-logo--dark {
    display: none;
}

html[data-theme="light"] .ai-panel-logo--light {
    display: block;
}

.ai-panel-title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--neon-cyan);
    letter-spacing: 0.1em;
    font-weight: 600;
    white-space: nowrap;
}

.ai-panel-header .ai-panel-close {
    margin-left: auto;
}

.ai-panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    transition: color 0.15s;
}

.ai-panel-close:hover {
    color: var(--text-primary);
}

/* Tier selector — inline in header */
.ai-tier-bar {
    display: flex;
    gap: 3px;
}

.ai-tier-btn {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.03em;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: all 0.15s;
    white-space: nowrap;
}

.ai-tier-btn:hover {
    border-color: rgba(0, 217, 255, 0.3);
    color: var(--text-secondary);
}

.ai-tier-btn.active {
    border-color: rgba(0, 217, 255, 0.5);
    background: rgba(0, 217, 255, 0.08);
    color: var(--neon-cyan);
}

.ai-tier-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.15s;
}

.ai-tier-btn.active .ai-tier-dot {
    background: var(--neon-cyan);
    box-shadow: 0 0 6px rgba(0, 217, 255, 0.5);
}

.ai-tier-btn[data-tier="L1"].active .ai-tier-dot {
    background: #30d158;
    box-shadow: 0 0 6px rgba(48, 209, 88, 0.5);
}

.ai-tier-btn[data-tier="L2"].active .ai-tier-dot {
    background: #ff9f0a;
    box-shadow: 0 0 6px rgba(255, 159, 10, 0.5);
}

.ai-tier-btn[data-tier="L3"].active .ai-tier-dot {
    background: #ff375f;
    box-shadow: 0 0 6px rgba(255, 55, 95, 0.5);
}

.ai-tier-btn[data-tier="L1"].active {
    border-color: rgba(48, 209, 88, 0.4);
    background: rgba(48, 209, 88, 0.06);
    color: #30d158;
}

.ai-tier-btn[data-tier="L2"].active {
    border-color: rgba(255, 159, 10, 0.4);
    background: rgba(255, 159, 10, 0.06);
    color: #ff9f0a;
}

.ai-tier-btn[data-tier="L3"].active {
    border-color: rgba(255, 55, 95, 0.4);
    background: rgba(255, 55, 95, 0.06);
    color: #ff375f;
}

/* Chat messages */
.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.7rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-normal) transparent;
}

.ai-message {
    max-width: 90%;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-message-user {
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.18);
    align-self: flex-end;
    color: var(--text-primary);
    border-bottom-right-radius: 3px;
}

.ai-message-assistant {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    align-self: flex-start;
    color: var(--text-secondary);
    border-bottom-left-radius: 3px;
}

.ai-message-assistant strong {
    color: var(--neon-cyan);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.ai-typing {
    opacity: 0.5;
    font-style: italic;
}

.ai-input-row {
    padding: 0.5rem 0.65rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.ai-input {
    flex: 1;
    background: var(--bg-black);
    border: 1px solid var(--border-normal);
    border-radius: 6px;
    padding: 0.4rem 0.65rem;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-family: var(--font-main);
    outline: none;
    transition: border-color 0.15s;
}

.ai-input:focus {
    border-color: rgba(0, 217, 255, 0.5);
}

.ai-send-btn {
    background: rgba(0, 217, 255, 0.12);
    border: 1px solid rgba(0, 217, 255, 0.25);
    border-radius: 6px;
    color: var(--neon-cyan);
    padding: 0.4rem 0.65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.ai-send-btn:hover {
    background: rgba(0, 217, 255, 0.22);
}

/* Light theme overrides */
html[data-theme="light"] .ai-panel {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .ai-tier-btn {
    border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .ai-message-assistant {
    background: #f4f5fb;
    border-color: rgba(0, 0, 0, 0.07);
}

html[data-theme="light"] .ai-input {
    background: #f0f2f7;
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1f2e;
}

html[data-theme="light"] .sync-log-entry {
    background: #ffffff;
    border-color: var(--border-normal);
}

html[data-theme="light"] .sync-log-time {
    color: var(--text-secondary);
}

/* ============================================
   DATA MODELLING v2 — Service Mapping layout
   ============================================ */

#data-modelling-tab.tab-content {
    padding: 0;
    overflow: hidden;
}

.dm-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Top bar */
.dm-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 12px;
}

.dm-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.dm-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dm-cms-btn {
    background: #6366f1;
    padding: 7px 16px;
    font-size: 13px;
}

/* Platform tabs row */
.dm-platform-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.dm-platform-tabs-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.dm-tab-btn {
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dm-tab-btn:hover {
    border-color: rgba(99, 102, 241, 0.5);
}

.dm-tab-btn.active {
    background: rgba(99, 102, 241, 0.18);
    border-color: #6366f1;
    color: #818cf8;
}

.dm-tab-delete {
    opacity: 0;
    transition: opacity 0.15s;
    color: #f87171;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    margin-left: auto;
}

.dm-tab-btn:hover .dm-tab-delete {
    opacity: 0.6;
}

.dm-tab-delete:hover {
    opacity: 1 !important;
}

.dm-add-btn {
    padding: 6px 14px;
    background: transparent;
    border: 1px dashed #6366f1;
    border-radius: 6px;
    color: #818cf8;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.dm-add-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

.action-btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.action-btn-secondary {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-color);
}

.action-btn-secondary:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.08);
    border-color: #6366f1;
}

.action-btn-primary {
    background: rgba(99, 102, 241, 0.14);
    border-color: #6366f1;
    color: #818cf8;
}

.action-btn-primary:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.24);
}

.action-btn.is-loading {
    position: relative;
    color: transparent !important;
}

.action-btn.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(129, 140, 248, 0.35);
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.dm-metrics-row {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.dm-metric-card {
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 130px;
    text-align: center;
}

.dm-metric-label {
    font-size: 10px;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.dm-metric-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.dm-metric-sub {
    font-size: 10px;
    opacity: 0.5;
    margin-top: 2px;
}

/* Filter bar */
.dm-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 42px;
}

.dm-filter-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.6;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.dm-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 100px;
    font-size: 12px;
    color: #a5b4fc;
}

.dm-chip-remove {
    cursor: pointer;
    opacity: 0.55;
    font-size: 11px;
    line-height: 1;
    flex-shrink: 0;
}

.dm-chip-remove:hover {
    opacity: 1;
}

.dm-chip-exclude {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.dm-filter-input-wrap {
    position: relative;
    flex: 1;
    min-width: 150px;
    max-width: 280px;
}

.dm-filter-input {
    width: 100%;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 13px;
    box-sizing: border-box;
}

.dm-filter-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.5);
}

.dm-filter-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: 200;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.dm-filter-sug-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.1s;
}

.dm-filter-sug-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Three-column layout */
.dm-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.dm-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
}

.dm-col:last-child {
    border-right: none;
}

.dm-col-cms {
    width: 22%;
    min-width: 180px;
}

.dm-col-detail {
    width: 23%;
    min-width: 180px;
}

.dm-col-platform {
    flex: 1;
}

.dm-col-flow {
    flex: 1;
    min-width: 520px;
}

/* Visual order for DM columns: CMS (left), Details (center), Service Plan (right) */
.dm-col-cms {
    order: 1;
}

.dm-col-detail {
    order: 2;
}

.dm-col-platform {
    order: 3;
}

/* Keep separators aligned with visual order after reordering */
.dm-col:last-child {
    border-right: 1px solid var(--border-color);
}

.dm-col-platform {
    border-right: none;
}

.dm-layout-processing .dm-col-cms {
    order: 1;
    width: 22%;
}

.dm-layout-processing .dm-col-flow {
    order: 2;
}

.dm-layout-processing .dm-col-detail {
    order: 3;
    width: 20%;
    min-width: 220px;
}

.dm-layout-processing .dm-col:last-child {
    border-right: none;
}

.dm-processing-flow {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 8px;
    min-height: 220px;
    overflow-x: auto;
}

.dm-flow-stage {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    min-height: 180px;
    position: relative;
}

.dm-flow-stage:not(:last-child)::after {
    content: '➜';
    position: absolute;
    right: -13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: rgba(99, 102, 241, 0.65);
    z-index: 2;
}

.dm-flow-stage-head {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
}

.dm-flow-stage-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    max-height: 480px;
}

.dm-flow-row {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: rgba(99, 102, 241, 0.08);
    cursor: pointer;
}

.dm-flow-row--compact {
    padding: 3px 6px;
}

.dm-flow-row--compact .dm-flow-row-title {
    font-size: 10px;
}

.dm-flow-row-title {
    font-size: 11px;
    font-weight: 600;
}

.dm-flow-row-sub {
    font-size: 10px;
    opacity: .75;
    margin-top: 2px;
}

.dm-flow-missing {
    padding: 10px 8px;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.10);
    color: #fca5a5;
    font-size: 11px;
    text-align: center;
}

.dm-col-header {
    padding: 8px 14px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.6;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.dm-col-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.dm-empty {
    padding: 28px 16px;
    text-align: center;
    opacity: 0.45;
    font-size: 13px;
    line-height: 1.5;
}

/* Tab-level loading overlay for Acquisition / Processing / Distribution tabs */
.dm-tab-loading-overlay {
    position: absolute;
    inset: 0;
    /* Semi-transparent dark backdrop — visible in both light and dark mode */
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(1px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: none;
    color: #ffffff;
    font-size: 13px;
    border-radius: 4px;
}

/* CMS row items */
.dm-cms-item {
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.dm-cms-item:hover {
    background: rgba(99, 102, 241, 0.07);
    border-color: rgba(99, 102, 241, 0.25);
}

.dm-cms-item.active {
    background: rgba(99, 102, 241, 0.24);
    border-color: #6366f1;
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.35);
}

.dm-cms-sid {
    font-size: 10px;
    font-weight: 600;
    color: #818cf8;
    margin-bottom: 2px;
    font-family: var(--font-mono, monospace);
}

.dm-cms-programme {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

.dm-linked-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* CMS detail panel */
.dm-detail-field {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
}

.dm-detail-field:last-child {
    border-bottom: none;
}

.dm-detail-label {
    font-size: 9px;
    opacity: 0.55;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.dm-detail-value {
    word-break: break-word;
    line-height: 1.4;
}

/* Platform row cards */
.dm-platform-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    background: var(--card-bg);
}

.dm-platform-card.dm-processing-row-focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18), 0 10px 24px rgba(99, 102, 241, 0.18);
}

.dm-platform-card-head {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.025);
}

.dm-platform-card-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dm-platform-fields {
    padding: 10px 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
}

.dm-pfield-label {
    font-size: 9px;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 1px;
}

.dm-pfield-value {
    font-size: 12px;
    word-break: break-word;
    line-height: 1.3;
}

/* Linked SIDs */
.dm-linked-sids {
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.dm-linked-sid-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.11);
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: 100px;
    font-size: 11px;
    color: #34d399;
    max-width: 260px;
}

.dm-linked-sid-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dm-linked-sid-remove {
    cursor: pointer;
    opacity: 0.55;
    font-size: 10px;
    flex-shrink: 0;
}

.dm-linked-sid-remove:hover {
    opacity: 1;
}

/* Suggestions */
.dm-suggestions {
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
}

.dm-suggestions-head {
    font-size: 10px;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.dm-sug-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 12px;
}

.dm-sug-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dm-sug-sid {
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    opacity: 0.6;
    flex-shrink: 0;
}

.dm-sug-score {
    font-size: 10px;
    opacity: 0.45;
    flex-shrink: 0;
}

.dm-sug-accept {
    padding: 3px 9px;
    background: rgba(99, 102, 241, 0.13);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: #a5b4fc;
    white-space: nowrap;
    flex-shrink: 0;
}

.dm-sug-accept:hover {
    background: rgba(99, 102, 241, 0.25);
}

.dm-sug-loading {
    font-size: 11px;
    opacity: 0.5;
    padding: 4px 0;
}

/* Manual link row */
.dm-manual-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0 2px;
}

.dm-manual-link-input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 12px;
}

.dm-manual-link-btn {
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    color: #a5b4fc;
    white-space: nowrap;
}

.dm-manual-link-btn:hover {
    background: rgba(99, 102, 241, 0.25);
}

/* Light theme overrides */
html[data-theme="light"] .dm-cms-item {
    background: #fff;
}

html[data-theme="light"] .dm-cms-item.active {
    background: rgba(99, 102, 241, 0.14);
    border-color: #6366f1;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.28);
}

html[data-theme="light"] .dm-tab-btn {
    background: #f4f5fb;
}

html[data-theme="light"] .dm-platform-card {
    background: #fff;
}

/* ── Tab badges ─────────────────────────────────────────────────────────────── */

.dm-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 6px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    color: #818cf8;
    margin-left: 5px;
    vertical-align: middle;
}

.dm-tab-badge.dm-tab-badge-done {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* ── Confidence score colours ───────────────────────────────────────────────── */

.dm-sug-item.sug-high {
    border-color: rgba(16, 185, 129, 0.3);
}

.dm-sug-item.sug-mid {
    border-color: rgba(245, 158, 11, 0.25);
}

.dm-sug-item.sug-low {
    border-color: var(--border-color);
    opacity: 0.75;
}

.dm-sug-score.sug-high {
    color: #10b981;
    font-weight: 600;
}

.dm-sug-score.sug-mid {
    color: #f59e0b;
    font-weight: 600;
}

.dm-sug-score.sug-low {
    color: #94a3b8;
}

/* ── Accept Best button ─────────────────────────────────────────────────────── */

.dm-accept-best-btn {
    padding: 3px 9px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: #34d399;
    white-space: nowrap;
    flex-shrink: 0;
}

.dm-accept-best-btn:hover {
    background: rgba(16, 185, 129, 0.2);
}

/* ── Linked count badge on platform cards ───────────────────────────────────── */

.dm-linked-count-badge {
    padding: 2px 8px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 100px;
    font-size: 10px;
    color: #34d399;
    font-weight: 600;
    flex-shrink: 0;
}

/* ── Auto-suggest button ────────────────────────────────────────────────────── */

.dm-autosug-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1px dashed rgba(168, 85, 247, 0.45);
    border-radius: 6px;
    color: #c084fc;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.dm-autosug-btn:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.65);
}

.dm-autosug-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ── Platform column — animated color accent ────────────────────────────────── */

.dm-col-platform {
    transition: background 0.35s ease, border-left-color 0.35s ease;
    border-left: 3px solid transparent;
}

/* CPF Overview (metrics tab) */
.cpf-overview-layout {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px;
}

.cpf-overview-summary {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    background: var(--bg-panel);
}

.cpf-overview-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.cpf-progress-list {
    display: grid;
    gap: 8px;
}

.cpf-progress-row {
    display: grid;
    grid-template-columns: 180px 1fr 56px 210px;
    gap: 10px;
    align-items: center;
}

.cpf-progress-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.cpf-progress-bar {
    height: 10px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 999px;
    overflow: hidden;
}

.cpf-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #6366f1 0%, #22c55e 100%);
    transition: width 0.25s ease;
}

.cpf-progress-pct {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.cpf-progress-meta {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}

.cpf-assignment-chain {
    margin-top: 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-panel);
    overflow: hidden;
}

.cpf-assignment-chain h3 {
    margin: 0;
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.cpf-assignment-head,
.cpf-chain-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
    gap: 8px;
    padding: 8px 12px;
}

.cpf-assignment-head {
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.cpf-assignment-body {
    max-height: 520px;
    overflow-y: auto;
}

.cpf-chain-row {
    border-bottom: 1px solid var(--border-subtle);
    align-items: center;
}

.cpf-chain-sid {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #818cf8;
}

.cpf-chain-program {
    font-size: 12px;
    color: var(--text-primary);
}

.cpf-chain-phase {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.cpf-chain-chip {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(99, 102, 241, 0.12);
}

.cpf-chain-empty {
    opacity: 0.45;
}

/* ── Overview filter bar ─────────────────────────────────────────────────────── */
.ov-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.ov-filter-search {
    flex: 1 1 180px;
    min-width: 140px;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 12px;
}

.ov-filter-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.ov-filter-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
    opacity: .55;
    white-space: nowrap;
}

.ov-filter-btn {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}

.ov-filter-btn:hover {
    background: rgba(99, 102, 241, .12);
    border-color: #6366f1;
    color: var(--text-primary);
}

.ov-filter-btn--active {
    background: rgba(99, 102, 241, .18);
    border-color: #6366f1;
    color: #818cf8;
    font-weight: 600;
}

/* ── Multi-link badge ────────────────────────────────────────────────────────── */
.ov-multi-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(245, 158, 11, .15);
    border: 1px solid rgba(245, 158, 11, .5);
    color: #f59e0b;
    white-space: nowrap;
    letter-spacing: .02em;
}

/* ── Common Issues & Insights panel ─────────────────────────────────────────── */
.ov-issues-wrap {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-primary);
}

.ov-issues-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}

.ov-issues-wrap.ov-issues-open .ov-issues-header {
    border-bottom-color: var(--border-color);
}

.ov-issues-heading {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.ov-issues-meta {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: .75;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.ov-issues-toggle {
    font-size: 11px;
    opacity: .5;
    transition: transform .2s;
    margin-left: auto;
    flex-shrink: 0;
}

.ov-issues-wrap.ov-issues-open .ov-issues-toggle {
    transform: rotate(90deg);
}

.ov-issues-body {
    display: none;
    padding: 12px 14px;
}

.ov-issues-wrap.ov-issues-open .ov-issues-body {
    display: block;
}

.ov-issues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.ov-issues-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
}

.ov-issues-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    opacity: .8;
}

.ov-issues-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ov-issues-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 6px;
    cursor: default;
}

.ov-issues-label {
    font-size: 11px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ov-issues-note {
    white-space: normal;
    overflow: visible;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.ov-issues-count {
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    min-width: 24px;
    text-align: right;
}

.ov-issues-pct {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: .65;
    white-space: nowrap;
    min-width: 28px;
    text-align: right;
}

#dmPlatformColHeader {
    transition: color 0.35s ease, border-bottom-color 0.35s ease;
    border-bottom: 2px solid transparent;
    padding-bottom: 4px;
}

/* ── Expand arrow on platform cards ─────────────────────────────────────────── */

.dm-expand-arrow {
    font-size: 9px;
    opacity: 0.4;
    margin-right: auto;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

/* ── Card body (expanded area) ───────────────────────────────────────────────── */

.dm-card-body {
    animation: dmFadeIn 0.15s ease;
}

@keyframes dmFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   CPF401 Metrics Dashboard
   ============================================ */
.cpf-metrics-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.cpf-metrics-header {
    margin-bottom: 2rem;
}

.cpf-metrics-header h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.cpf-metrics-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.cpf-filter-summary {
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cpf-filter-title {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cpf-filter-chips-display {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.cpf-no-filters {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.cpf-phase-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.cpf-phase-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-normal);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.cpf-phase-card:hover {
    border-color: var(--border-bright);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cpf-phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.cpf-phase-header h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin: 0;
}

.cpf-phase-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.cpf-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cpf-metric-item {
    text-align: center;
}

.cpf-metric-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.cpf-metric-value {
    color: var(--neon-cyan);
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.cpf-platform-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cpf-platform-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.cpf-platform-name {
    color: var(--text-primary);
    font-weight: 500;
}

.cpf-platform-stats {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.cpf-cms-summary {
    background: var(--bg-panel);
    border: 1px solid var(--border-normal);
    border-radius: 12px;
    padding: 1.5rem;
}

.cpf-cms-summary h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

html[data-theme="light"] .cpf-phase-card,
html[data-theme="light"] .cpf-cms-summary {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .cpf-platform-item {
    background: var(--bg-surface);
}


/* ── Import CMS button — match site action button style ──────────────────────── */

.dm-cms-btn {
    padding: 0.45rem 1rem;
    background: transparent;
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 6px;
    color: var(--neon-cyan);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dm-cms-btn:hover {
    background: rgba(0, 217, 255, 0.08);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.2);
}

html[data-theme="light"] .dm-cms-btn {
    color: var(--neon-cyan);
    border-color: rgba(2, 132, 199, 0.3);
}

html[data-theme="light"] .dm-cms-btn:hover {
    background: rgba(2, 132, 199, 0.06);
    border-color: var(--neon-cyan);
}

/* ── Suggestion items — cursor pointer for click-to-preview ─────────────────── */

.dm-sug-item {
    cursor: pointer;
}

.dm-sug-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] .dm-sug-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* ============================================
   Data Loading Overlay (for sync operations)
   ============================================ */
.data-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 14, 20, 0.92);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.data-loading-overlay .loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.data-loading-overlay .loading-text {
    font-size: 1rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    text-align: center;
}

html[data-theme="light"] .data-loading-overlay {
    background: rgba(240, 242, 247, 0.92);
}

/* ── CMS Browser Tab ────────────────────────────────────────────────────────── */

.cms-browser-row {
    border-bottom: 1px solid var(--border-color);
}

.cms-browser-row:last-child {
    border-bottom: none;
}

.cms-browser-row-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
}

.cms-browser-row-header:hover {
    background: rgba(99, 102, 241, 0.06);
}

.cms-browser-row.expanded>.cms-browser-row-header {
    background: rgba(99, 102, 241, 0.1);
    border-bottom: 1px solid var(--border-color);
}

.cms-browser-chevron {
    width: 16px;
    font-size: 12px;
    opacity: 0.55;
    flex-shrink: 0;
}

.cms-browser-sid {
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    font-weight: 600;
    color: #818cf8;
    min-width: 90px;
    flex-shrink: 0;
}

.cms-browser-prog {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cms-browser-svc {
    font-size: 11px;
    opacity: 0.55;
    flex: 2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cms-browser-detail {
    padding: 8px 14px 12px 42px;
    background: var(--bg-surface);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0;
}

.cms-browser-detail .dm-detail-field {
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

html[data-theme="light"] .cms-browser-row-header:hover {
    background: rgba(99, 102, 241, 0.05);
}

html[data-theme="light"] .cms-browser-row.expanded>.cms-browser-row-header {
    background: rgba(99, 102, 241, 0.08);
}

html[data-theme="light"] .cms-browser-detail {
    background: rgba(0, 0, 0, 0.02);
}

/* ============================================
   Action Buttons (Import CMS, etc.)
   ============================================ */
.snav-action-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(0, 217, 255, 0.35);
    border-radius: 6px;
    color: var(--neon-cyan);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: none;
}

.snav-action-btn:hover {
    background: rgba(0, 217, 255, 0.12);
    border-color: var(--neon-cyan);
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.25);
    transform: translateY(-1px);
}

.snav-action-btn:active {
    transform: translateY(0);
}

html[data-theme="light"] .snav-action-btn {
    color: var(--neon-cyan);
    border-color: rgba(2, 132, 199, 0.4);
}

html[data-theme="light"] .snav-action-btn:hover {
    background: rgba(2, 132, 199, 0.08);
    border-color: var(--neon-cyan);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.2);
}

/* ============================================
   Filter Options Popup
   ============================================ */
.dm-filter-options-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}

.dm-filter-options-btn:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.06);
    color: var(--text-primary);
}

.dm-filter-options-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    z-index: 250;
    min-width: 320px;
    max-width: 420px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    padding: 16px;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dm-filter-popup-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dm-filter-popup-section {
    margin-bottom: 16px;
}

.dm-filter-popup-section:last-child {
    margin-bottom: 0;
}

.dm-filter-popup-section-title {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.dm-filter-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dm-filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    font-size: 12px;
}

.dm-filter-checkbox-item:hover {
    background: rgba(99, 102, 241, 0.08);
}

.dm-filter-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #6366f1;
}

.dm-filter-checkbox-label {
    flex: 1;
    cursor: pointer;
    user-select: none;
}

.dm-filter-checkbox-count {
    font-family: var(--font-mono);
    font-size: 10px;
    opacity: 0.5;
    margin-left: auto;
}

html[data-theme="light"] .dm-filter-options-popup {
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* ============================================
   Enhanced Metrics with Progress Bars
   ============================================ */
.dm-metric-card-enhanced {
    position: relative;
    overflow: hidden;
}

.dm-metric-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

html[data-theme="light"] .dm-metric-progress {
    background: rgba(0, 0, 0, 0.08);
}

.dm-metric-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-blue));
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(0, 217, 255, 0.4);
}

html[data-theme="light"] .dm-metric-progress-bar {
    box-shadow: 0 0 4px rgba(2, 132, 199, 0.3);
}

/* Animated gradient for progress bar */
@keyframes progressGlow {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

.dm-metric-progress-bar {
    animation: progressGlow 2s ease-in-out infinite;
}

/* ============================================
   Graphical CPF Metrics Cards
   ============================================ */
.cpf-metric-value {
    position: relative;
    display: inline-block;
}

.cpf-metric-value::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
    opacity: 0.5;
}

.cpf-phase-card[data-phase="acquisition"] .cpf-metric-value {
    color: #10b981;
}

.cpf-phase-card[data-phase="acquisition"] .cpf-metric-value::after {
    background: linear-gradient(90deg, transparent, #10b981, transparent);
}

.cpf-phase-card[data-phase="processing"] .cpf-metric-value {
    color: #f59e0b;
}

.cpf-phase-card[data-phase="processing"] .cpf-metric-value::after {
    background: linear-gradient(90deg, transparent, #f59e0b, transparent);
}

.cpf-phase-card[data-phase="distribution"] .cpf-metric-value {
    color: #6366f1;
}

.cpf-phase-card[data-phase="distribution"] .cpf-metric-value::after {
    background: linear-gradient(90deg, transparent, #6366f1, transparent);
}

/* Add subtle border glow on hover */
.cpf-phase-card[data-phase="acquisition"]:hover {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

.cpf-phase-card[data-phase="processing"]:hover {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
}

.cpf-phase-card[data-phase="distribution"]:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

/* ============================================
   Filters Tab Styling
   ============================================ */
.filters-container {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.filters-header {
    margin-bottom: 2rem;
}

.filters-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.filters-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.filters-active-section,
.filters-add-section,
.filters-quick-section,
.filters-stats-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-normal);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filters-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.filters-active-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.filters-clear-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid #f87171;
    border-radius: 6px;
    color: #f87171;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.filters-clear-btn:hover {
    background: rgba(248, 113, 113, 0.1);
}

.filters-add-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.quick-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.quick-filter-item {
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-filter-item:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.05);
}

.quick-filter-item.active {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.15);
}

.quick-filter-name {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.quick-filter-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.filters-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-stat-card {
    text-align: center;
    padding: 1rem;
    background: var(--bg-surface);
    border-radius: 8px;
}

.filter-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.filter-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--neon-cyan);
    font-family: var(--font-mono);
}

html[data-theme="light"] .filters-active-section,
html[data-theme="light"] .filters-add-section,
html[data-theme="light"] .filters-quick-section,
html[data-theme="light"] .filters-stats-section {
    background: white;
}

html[data-theme="light"] .quick-filter-item,
html[data-theme="light"] .filter-stat-card {
    background: var(--bg-surface);
}

/* ============================================
   Search Bar Styling
   ============================================ */
.dm-search-bar {
    flex: 1;
    max-width: 400px;
    margin-left: auto;
}

.dm-search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.dm-search-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.dm-search-input::placeholder {
    color: var(--text-muted);
}

html[data-theme="light"] .dm-search-input {
    background: #f4f5fb;
}

/* ============================================================
   ALARM SIMULATION - Node & Chain States
   ============================================================ */

/* Alarmed (origin) node — flashing bold red border, no background change (light + dark safe) */
.graph-node.alarmed {
    border: 2px solid #ff3366 !important;
    box-shadow: 0 0 0 1px rgba(255, 51, 102, 0.5) !important;
    animation: alarm-border-pulse 0.9s ease-in-out infinite;
}

.graph-node.alarmed::before {
    background: var(--status-critical) !important;
    box-shadow: 0 0 10px var(--status-critical) !important;
}

/* Downstream impacted nodes — amber border pulse */
.graph-node.alarmed-downstream {
    border: 2px solid rgba(255, 149, 0, 0.8) !important;
    box-shadow: 0 0 0 1px rgba(255, 149, 0, 0.3) !important;
    animation: alarm-downstream-border-pulse 1.5s ease-in-out infinite;
}

.graph-node.alarmed-downstream::before {
    background: var(--status-high) !important;
    box-shadow: 0 0 8px var(--status-high) !important;
}

/* SVG lines downstream of alarm */
.graph-line.alarmed-line {
    stroke: rgba(255, 51, 102, 0.7) !important;
    filter: drop-shadow(0 0 4px rgba(255, 51, 102, 0.5)) !important;
}

.graph-line.alarmed-downstream-line {
    stroke: rgba(255, 149, 0, 0.55) !important;
    filter: drop-shadow(0 0 3px rgba(255, 149, 0, 0.35)) !important;
}

@keyframes alarm-border-pulse {

    0%,
    100% {
        border-color: #ff3366 !important;
        box-shadow: 0 0 0 1px rgba(255, 51, 102, 0.4) !important;
    }

    50% {
        border-color: #ff6688 !important;
        box-shadow: 0 0 0 3px rgba(255, 51, 102, 0.85), 0 0 18px rgba(255, 51, 102, 0.4) !important;
    }
}

@keyframes alarm-downstream-border-pulse {

    0%,
    100% {
        border-color: rgba(255, 149, 0, 0.6) !important;
        box-shadow: 0 0 0 1px rgba(255, 149, 0, 0.2) !important;
    }

    50% {
        border-color: #ff9500 !important;
        box-shadow: 0 0 0 2px rgba(255, 149, 0, 0.7), 0 0 14px rgba(255, 149, 0, 0.3) !important;
    }
}

/* ============================================================
   ALARM SIMULATION TAB — Full Layout
   ============================================================ */
.alarm-sim-container {
    padding: 1.75rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.alarm-sim-header {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.alarm-sim-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alarm-sim-title-row h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.alarm-sim-badge {
    padding: 0.2rem 0.65rem;
    background: rgba(255, 51, 102, 0.12);
    border: 1px solid rgba(255, 51, 102, 0.4);
    border-radius: 20px;
    color: #ff3366;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.alarm-sim-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Config bar */
.alarm-sim-config {
    display: flex;
    align-items: flex-end;
    gap: 1.25rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-normal);
    border-radius: 10px;
    padding: 1.1rem 1.5rem;
    flex-wrap: wrap;
}

.alarm-config-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
    min-width: 180px;
}

.alarm-config-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.alarm-select {
    padding: 0.55rem 0.85rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-main);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.alarm-select:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 0 2px rgba(0, 217, 255, 0.1);
}

.alarm-config-actions {
    flex-direction: row;
    gap: 0.65rem;
    align-items: flex-end;
    flex: none;
}

.alarm-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.alarm-btn-trigger {
    background: rgba(255, 51, 102, 0.12);
    border-color: rgba(255, 51, 102, 0.5);
    color: #ff3366;
}

.alarm-btn-trigger:hover:not(:disabled) {
    background: rgba(255, 51, 102, 0.22);
    border-color: #ff3366;
    box-shadow: 0 0 12px rgba(255, 51, 102, 0.3);
}

.alarm-btn-trigger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.alarm-btn-clear {
    background: var(--bg-surface);
    border-color: var(--border-normal);
    color: var(--text-secondary);
}

.alarm-btn-clear:hover {
    background: var(--bg-elevated);
    border-color: var(--border-bright);
    color: var(--text-primary);
}

/* Impact header */
.alarm-impact-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 51, 102, 0.07);
    border: 1px solid rgba(255, 51, 102, 0.25);
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

.alarm-impact-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    color: #ff6688;
}

.alarm-impact-icon {
    font-size: 1.1rem;
}

.alarm-impact-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.alarm-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.alarm-stat-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.alarm-stat-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.alarm-stat-origin .alarm-stat-value {
    color: #ff3366;
}

.alarm-stat-affected .alarm-stat-value {
    color: #ff9500;
}

.alarm-stat-services .alarm-stat-value {
    color: #ffd60a;
}

/* Chain visualization card inside alarm result */
.alarm-chain-viz {
    background: var(--bg-panel);
    border: 1px solid rgba(255, 51, 102, 0.2);
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alarm-chain-path {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.alarm-chain-path-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.alarm-chain-path-role {
    color: var(--text-secondary);
    font-weight: 400;
}

.alarm-chain-path-impact {
    padding: 0.1rem 0.5rem;
    background: rgba(255, 51, 102, 0.12);
    border: 1px solid rgba(255, 51, 102, 0.35);
    border-radius: 12px;
    color: #ff3366;
    font-size: 0.6rem;
    font-weight: 700;
}

.alarm-chain-path-ok {
    padding: 0.1rem 0.5rem;
    background: rgba(48, 209, 88, 0.12);
    border: 1px solid rgba(48, 209, 88, 0.35);
    border-radius: 12px;
    color: #30d158;
    font-size: 0.6rem;
    font-weight: 700;
}

/* Horizontal node row inside alarm viz */
.alarm-chain-nodes {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.alarm-chain-node {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-left: 3px solid var(--border-normal);
    border-radius: 4px;
    min-width: 130px;
    max-width: 175px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.alarm-chain-node.alarmed {
    background: #2a0a10;
    border-color: var(--status-critical);
    border-left-color: var(--status-critical);
    box-shadow: 0 0 14px rgba(255, 51, 102, 0.4);
    animation: alarm-pulse-node 1.2s ease-in-out infinite;
}

.alarm-chain-node.alarmed-downstream {
    background: #201408;
    border-color: rgba(255, 149, 0, 0.55);
    border-left-color: var(--status-high);
    opacity: 0.9;
}

.alarm-node-status {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.65rem;
    line-height: 1;
}

.alarm-node-icon {
    color: var(--status-critical);
    filter: drop-shadow(0 0 4px rgba(255, 51, 102, 0.6));
    animation: alarm-pulse-icon 1s ease-in-out infinite;
}

.alarm-node-icon--down {
    color: var(--status-high);
    filter: drop-shadow(0 0 3px rgba(255, 149, 0, 0.5));
    animation: none;
}

@keyframes alarm-pulse-icon {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.alarm-node-name {
    font-family: var(--font-mono);
    font-size: 0.67rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.3;
    padding-right: 14px;
    word-break: break-word;
}

.alarm-node-class {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.2rem;
}

/* Connection dots between alarm chain nodes */
.alarm-chain-connector {
    flex-shrink: 0;
    padding: 0 0.3rem;
    color: var(--text-dim);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    align-self: center;
}

/* Affected CI table */
.alarm-impact-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alarm-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.alarm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.alarm-table th {
    padding: 0.55rem 0.85rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-normal);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
}

.alarm-table td {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

.alarm-row-origin td {
    background: rgba(255, 51, 102, 0.06);
}

.alarm-row-downstream td {
    background: rgba(255, 149, 0, 0.04);
}

.alarm-td-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-weight: 600;
}

.alarm-badge-origin {
    flex-shrink: 0;
    padding: 0.1rem 0.45rem;
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid rgba(255, 51, 102, 0.4);
    border-radius: 4px;
    color: #ff3366;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.alarm-impact-badge {
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.alarm-impact-badge--critical {
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid rgba(255, 51, 102, 0.4);
    color: #ff3366;
}

.alarm-impact-badge--downstream {
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.35);
    color: #ff9500;
}

.alarm-td-depth {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Empty state */
.alarm-sim-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.alarm-sim-empty-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.alarm-sim-empty h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}

.alarm-sim-empty p {
    font-size: 0.85rem;
    opacity: 0.7;
    max-width: 360px;
    line-height: 1.5;
    margin: 0;
}

.alarm-no-impact {
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* Light-mode overrides for alarm tab */
html[data-theme="light"] .alarm-sim-config {
    background: #ffffff;
    border-color: var(--border-normal);
}

html[data-theme="light"] .alarm-select {
    background: #f4f5fb;
    color: var(--text-primary);
    border-color: var(--border-normal);
}

html[data-theme="light"] .alarm-chain-viz {
    background: #f4f5fb;
}

html[data-theme="light"] .alarm-chain-node {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
    border-left-color: rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] .alarm-chain-node.alarmed {
    background: #fff1f3;
    border-color: #ef4444;
    border-left-color: #ef4444;
}

html[data-theme="light"] .alarm-chain-node.alarmed-downstream {
    background: #fffbeb;
    border-color: rgba(245, 158, 11, 0.5);
    border-left-color: #f59e0b;
}

/* ============================================
   ALARMS TAB — Panel header
   ============================================ */
.alarm-panel-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    overflow: hidden;
}

.alarm-panel-header {
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.alarm-panel-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.alarm-panel-title-row h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.alarm-panel-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

.alarm-panel-count--active {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.alarm-panel-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
    line-height: 1.55;
    max-width: 680px;
}

/* ============================================
   ALARM BUTTON (shared)
   ============================================ */
.alarm-btn {
    font-size: 0.78rem;
    font-family: var(--font-mono);
    padding: 0.35rem 0.85rem;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.03em;
}

.alarm-btn-clear {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.alarm-btn-clear:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

/* ============================================
   ALARM ACTIVE LIST
   ============================================ */
.alarm-active-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.alarm-loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ============================================
   ALARM ACTIVE CARD
   ============================================ */
.alarm-active-card {
    background: rgba(20, 24, 38, 0.8);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    overflow: hidden;
}

.alarm-active-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.07);
    gap: 1rem;
}

.alarm-active-card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.alarm-active-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.alarm-active-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alarm-active-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.alarm-active-age {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.alarm-clear-btn {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.03em;
}

.alarm-clear-btn:hover {
    background: rgba(239, 68, 68, 0.22);
}

.alarm-active-card-body {
    padding: 0.75rem 1rem;
}

.alarm-affected-header {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

.alarm-affected-header strong {
    color: var(--text-primary);
}

.alarm-no-topo {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
    margin: 0;
    font-style: italic;
}

/* ============================================
   ALARM AFFECTED TOPOLOGIES TABLE
   ============================================ */
.alarm-topo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.alarm-topo-table thead tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.alarm-topo-table th {
    text-align: left;
    padding: 0.35rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.alarm-topo-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.1s ease;
}

.alarm-topo-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.alarm-topo-row td {
    padding: 0.45rem 0.75rem;
    vertical-align: middle;
}

.alarm-topo-name {
    color: var(--text-primary);
    font-weight: 500;
}

.alarm-topo-via {
    display: block;
    font-size: 0.7rem;
    color: var(--neon-amber, #ff9500);
    font-family: var(--font-mono);
    opacity: 0.8;
    margin-top: 2px;
}

.alarm-topo-role {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.alarm-topo-sg {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.alarm-view-btn {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 217, 255, 0.25);
    background: rgba(0, 217, 255, 0.07);
    color: var(--neon-cyan);
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.alarm-view-btn:hover {
    background: rgba(0, 217, 255, 0.15);
    border-color: rgba(0, 217, 255, 0.4);
}

/* ============================================
   ALARM — CMS ID grouping blocks
   ============================================ */
.alarm-cms-block {
    margin-bottom: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    overflow: hidden;
}

.alarm-cms-block:last-child {
    margin-bottom: 0;
}

/* Topology list within a service group block */
.alarm-sg-topo-list {
    padding: 0.2rem 0;
}

.alarm-sg-topo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    gap: 0.5rem;
}

.alarm-sg-topo-row:last-child {
    border-bottom: none;
}

.alarm-sg-topo-name {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html[data-theme="light"] .alarm-sg-topo-row {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .alarm-sg-topo-name {
    color: #374151;
}

.alarm-cms-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.75rem;
    background: rgba(0, 217, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.alarm-cms-id {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--neon-cyan);
    letter-spacing: 0.04em;
}

.alarm-cms-program {
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alarm-cms-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
}

/* light-mode overrides */
html[data-theme="light"] .alarm-cms-header {
    background: rgba(0, 140, 180, 0.08);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .alarm-cms-id {
    color: #007aab;
}

/* ============================================
   NODE DETAIL PANEL — Alarm footer section
   ============================================ */
.ndp-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.ndp-alarm-section {
    padding: 0.85rem 1.1rem;
}

.ndp-alarm-title {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.55rem;
}

.ndp-alarm-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ndp-alarm-btns button {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.02em;
}

.ndp-alarm-btns button:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
}

.ndp-alarm-active {
    background: rgba(239, 68, 68, 0.06);
    border-top: 1px solid rgba(239, 68, 68, 0.2);
}

.ndp-alarm-active-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.ndp-alarm-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: alarm-pulse 1.2s ease-in-out infinite;
}

.ndp-alarm-active-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #f87171;
    flex: 1;
}

.ndp-alarm-clear-btn {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    padding: 0.22rem 0.55rem;
    border-radius: 4px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.ndp-alarm-clear-btn:hover {
    background: rgba(239, 68, 68, 0.22);
}

/* ============================================
   LIGHT MODE OVERRIDES — Alarms panel
   ============================================ */
html[data-theme="light"] .alarm-active-card {
    background: #ffffff;
    border-color: rgba(239, 68, 68, 0.2);
}

html[data-theme="light"] .alarm-active-card-header {
    background: rgba(239, 68, 68, 0.05);
}

html[data-theme="light"] .alarm-topo-table th {
    color: #888;
}

html[data-theme="light"] .alarm-topo-row:hover {
    background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .alarm-topo-name {
    color: var(--text-primary);
}

html[data-theme="light"] .ndp-alarm-section {
    background: transparent;
}

html[data-theme="light"] .ndp-alarm-active {
    background: rgba(239, 68, 68, 0.04);
}

html[data-theme="light"] .ndp-alarm-btns button {
    background: #f4f5fb;
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
}

/* ============================================
   SERVICE BUILDER
   Reuses topology viewer graph-node / depth-column / graph-lines styles.
   Only builder-specific chrome is defined here.
   ============================================ */

/* ── Service Creator Overlay (launched from Sales) ────────────── */
.sb-creator-overlay {
    position: absolute;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sbOverlayIn 0.2s ease;
}

@keyframes sbOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sb-creator-chrome {
    width: 96vw;
    height: 92vh;
    max-width: 1600px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sbChromeIn 0.25s ease;
}

@keyframes sbChromeIn {
    from {
        transform: scale(0.96) translateY(12px);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

.sb-creator-titlebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sb-creator-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.sb-creator-tabs {
    display: flex;
    gap: 2px;
    margin-left: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 2px;
}

.sb-creator-tab {
    padding: 4px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.sb-creator-tab:hover {
    color: var(--text-primary);
}

.sb-creator-tab.active {
    background: var(--neon-cyan);
    color: #000;
}

.sb-creator-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}

.sb-creator-close:hover {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
}

.sb-creator-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sb-creator-body>.tab-content {
    display: flex !important;
    flex-direction: column;
    height: 100%;
}

.sb-creator-body .sb-layout {
    flex: 1;
    min-height: 0;
}

.sb-creator-body .sb-auto-layout {
    flex: 1;
    min-height: 0;
}

.content {
    position: relative;
}

/* ── Three-column page layout ─────────────────────────────────── */
.sb-full-panel {
    padding: 0;
    overflow: hidden;
}

.sb-layout {
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Left sidebar — function library ─────────────────────────── */
.sb-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle);
    overflow: hidden;
}

.sb-sidebar-header {
    padding: 14px 12px 10px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sb-sidebar-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.sb-search {
    width: 100%;
    padding: 6px 10px;
    box-sizing: border-box;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
}

.sb-search:focus {
    outline: none;
    border-color: var(--neon-cyan);
}

.sb-function-groups {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.sb-function-group {
    margin-bottom: 4px;
}

.sb-group-header {
    padding: 5px 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.75;
}

.sb-cat-acquisition-header {
    color: #0a84ff;
}

.sb-cat-processing-header {
    color: #ff9500;
}

.sb-cat-distribution-header {
    color: #30d158;
}

.sb-cat-other-header {
    color: #9ca3af;
}

.sb-group-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 6px 4px;
}

.sb-function-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
}

.sb-function-item:hover {
    background: var(--bg-elevated);
}

.sb-cat-acquisition:hover {
    border-color: rgba(10, 132, 255, 0.35);
}

.sb-cat-processing:hover {
    border-color: rgba(255, 149, 0, 0.35);
}

.sb-cat-distribution:hover {
    border-color: rgba(48, 209, 88, 0.35);
}

.sb-cat-other:hover {
    border-color: rgba(156, 163, 175, 0.35);
}

.sb-fn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 7px;
    opacity: 0.55;
    flex-shrink: 0;
}

.sb-function-item:hover .sb-fn-icon {
    opacity: 0.85;
}

.sb-fn-name {
    flex: 1;
}

.sb-fn-count {
    font-size: 10px;
    opacity: 0.45;
    margin-left: 6px;
    font-family: var(--font-mono);
}

/* ── Center canvas topbar ─────────────────────────────────────── */
.sb-canvas-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-charcoal);
}

.sb-canvas-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.sb-design-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.sb-design-name-input {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
}

.sb-design-name-input:focus {
    outline: none;
    border-color: var(--neon-cyan);
}

.sb-design-status {
    padding: 6px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
}

.sb-topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sb-save-status {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 60px;
}

/* ── Shared button styles ─────────────────────────────────────── */
.sb-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-normal);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s, border-color 0.15s;
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.sb-btn-primary {
    background: var(--neon-cyan);
    border-color: var(--neon-cyan);
    color: #0a0e14;
}

.sb-btn-primary:hover {
    filter: brightness(1.1);
}

.sb-btn-secondary:hover {
    background: var(--bg-surface);
}

.sb-btn-danger {
    background: rgba(255, 51, 102, 0.1);
    border-color: rgba(255, 51, 102, 0.3);
    color: var(--neon-red);
}

.sb-btn-danger:hover {
    background: rgba(255, 51, 102, 0.2);
}

.sb-btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.sb-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
}

.sb-btn-assigned {
    background: rgba(48, 209, 88, 0.1);
    border-color: rgba(48, 209, 88, 0.3);
    color: var(--neon-green);
}

/* ── Canvas scroll area ───────────────────────────────────────── */
.sb-canvas {
    flex: 1;
    overflow: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* The graph container lives inside .sb-canvas and styles match
   the topology viewer's .graph-container (already defined in base CSS).
   We only override the border-radius & margin so it fills the canvas. */
.sb-graph-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    min-height: 200px;
    flex: 0 0 auto;
}

/* ── Depth column — mirrors topology viewer .depth-column ─────── */
/* Topology viewer's .depth-column is min-width:148px; keep compatible */
.sb-depth-column {
    /* Inherit layout from .depth-column */
    cursor: pointer;
    transition: outline-color 0.15s;
    outline: 2px solid transparent;
    outline-offset: 4px;
    border-radius: 6px;
}

.sb-column-selected {
    outline-color: rgba(0, 217, 255, 0.6);
    outline-offset: 4px;
}

/* Column label above the nodes */
.sb-column-label {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
    padding: 0 2px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Remove button at bottom of column */
.sb-col-remove-btn {
    margin-top: 4px;
    padding: 3px 8px;
    font-size: 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    align-self: center;
    transition: color 0.15s, border-color 0.15s;
}

.sb-col-remove-btn:hover {
    color: var(--neon-red);
    border-color: rgba(255, 51, 102, 0.4);
}

/* ── Category-tinted node borders (extend topology viewer colours) */
/* Uses same graph-node base from topology viewer CSS. */
.sb-cat-acquisition-node {
    border-color: rgba(10, 132, 255, 0.4);
    border-left: 3px solid #0a84ff;
}

.sb-cat-acquisition-node::before {
    background: #0a84ff;
    box-shadow: 0 0 6px #0a84ff;
}

.sb-cat-processing-node {
    border-color: rgba(255, 149, 0, 0.4);
    border-left: 3px solid #ff9500;
}

.sb-cat-processing-node::before {
    background: #ff9500;
    box-shadow: 0 0 6px #ff9500;
}

.sb-cat-distribution-node {
    border-color: rgba(48, 209, 88, 0.4);
    border-left: 3px solid #30d158;
}

.sb-cat-distribution-node::before {
    background: #30d158;
    box-shadow: 0 0 6px #30d158;
}

.sb-cat-other-node {
    border-color: rgba(156, 163, 175, 0.35);
    border-left: 3px solid #9ca3af;
}

/* Empty / unassigned node */
.sb-empty-node {
    border-style: dashed;
    opacity: 0.55;
    cursor: pointer;
}

.sb-empty-node:hover {
    opacity: 0.85;
}

.sb-slot-label {
    font-style: italic;
    opacity: 0.7;
}

/* Location label inside node */
.sb-node-loc {
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-top: 2px;
}

/* Remove-resource × button inside node */
.sb-node-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    padding: 0;
    line-height: 16px;
    text-align: center;
    font-size: 9px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 3px;
    display: none;
    /* shown on hover */
}

.graph-node:hover .sb-node-remove {
    display: block;
}

.sb-node-remove:hover {
    color: var(--neon-red);
    background: rgba(255, 51, 102, 0.1);
}

/* ── Canvas empty state ───────────────────────────────────────── */
.sb-canvas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
    padding: 60px 40px;
    flex: 1;
    user-select: none;
}

.sb-canvas-empty svg {
    opacity: 0.25;
}

.sb-canvas-empty p {
    font-size: 14px;
    margin: 0;
}

.sb-canvas-hint {
    font-size: 12px;
    opacity: 0.6;
}

/* ── Validation bar ───────────────────────────────────────────── */
.sb-validation-bar {
    padding: 8px 16px;
    font-size: 12px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.sb-validation-ok {
    background: rgba(48, 209, 88, 0.1);
    color: var(--neon-green);
    border-top: 1px solid rgba(48, 209, 88, 0.2);
}

.sb-validation-warn {
    background: rgba(255, 149, 0, 0.1);
    color: var(--neon-amber);
    border-top: 1px solid rgba(255, 149, 0, 0.2);
}

/* ── Right panel — resources ──────────────────────────────────── */
.sb-resources-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-subtle);
    overflow: hidden;
}

.sb-resources-header {
    padding: 14px 14px 8px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sb-resources-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.sb-resources-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-resources-filters {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.sb-filter-row {
    display: flex;
    gap: 6px;
}

.sb-filter-select {
    flex: 1;
    padding: 5px 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 11px;
    cursor: pointer;
}

.sb-resources-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sb-resources-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 24px 12px;
}

/* Resource card */
.sb-resource-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 11px;
    transition: border-color 0.15s;
}

.sb-resource-card:hover {
    border-color: var(--border-bright);
}

.sb-resource-card-assigned {
    border-color: var(--neon-green);
    background: rgba(48, 209, 88, 0.04);
}

.sb-resource-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.sb-resource-card-name {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-assigned-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(48, 209, 88, 0.15);
    color: var(--neon-green);
    flex-shrink: 0;
}

.sb-resource-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 5px;
}

.sb-meta-tag {
    font-size: 10px;
    font-family: var(--font-mono);
    padding: 2px 5px;
    background: var(--bg-elevated);
    border-radius: 4px;
    color: var(--text-secondary);
}

.sb-resource-card-class {
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 4px;
    font-family: var(--font-mono);
}

.sb-resource-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sb-resource-card-actions {
    display: flex;
    gap: 5px;
}

/* Status dot */
.sb-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-dim);
}

.sb-status-operational {
    background: var(--neon-green);
    box-shadow: 0 0 4px var(--neon-green);
}

.sb-status-warn {
    background: var(--neon-amber);
}

/* ── Utility ──────────────────────────────────────────────────── */
.sb-loading {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 16px;
}

.sb-error {
    color: var(--neon-red);
    font-size: 12px;
    padding: 12px;
}

.sb-empty-msg {
    color: var(--text-muted);
    font-size: 12px;
    padding: 12px;
    text-align: center;
}

/* ── Modal — saved designs list ──────────────────────────────── */
.sb-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sb-modal-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-normal);
    border-radius: 12px;
    width: 560px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.sb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sb-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.sb-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}

.sb-modal-close:hover {
    color: var(--text-primary);
}

.sb-modal-body {
    overflow-y: auto;
    padding: 12px;
    flex: 1;
}

.sb-design-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sb-design-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    gap: 10px;
}

.sb-design-list-item-active {
    border-color: var(--neon-cyan);
    background: rgba(0, 217, 255, 0.04);
}

.sb-design-list-info {
    flex: 1;
    min-width: 0;
}

.sb-design-list-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-design-list-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.sb-design-list-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* Secondary nav label */
.snav-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 10px;
    letter-spacing: 0.04em;
}

/* ── Light theme overrides ───────────────────────────────────── */
html[data-theme="light"] .sb-canvas {
    background: #eef0f8;
}

html[data-theme="light"] .sb-resource-card {
    background: #ffffff;
}

html[data-theme="light"] .sb-cat-acquisition-node {
    background: #eff6ff;
}

html[data-theme="light"] .sb-cat-processing-node {
    background: #fffbeb;
}

html[data-theme="light"] .sb-cat-distribution-node {
    background: #f0fdf4;
}

/* ── Paths wrapper and path blocks ───────────────────────────────── */
.sb-paths-wrapper {
    overflow: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sb-path-block {
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    transition: border-color 0.15s;
    margin-bottom: 8px;
}

.sb-path-block.sb-path-active {
    border-left-color: rgba(0, 217, 255, 0.5);
}

.sb-path-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 14px;
    cursor: pointer;
    user-select: none;
}

.sb-path-num {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--neon-cyan);
    opacity: 0.7;
    white-space: nowrap;
}

.sb-path-block.sb-path-active .sb-path-num {
    opacity: 1;
}

.sb-path-name-input {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    min-width: 80px;
    max-width: 160px;
    transition: border-color 0.15s, background 0.15s;
}

.sb-path-name-input:hover,
.sb-path-name-input:focus {
    border-color: var(--border-normal);
    background: var(--bg-surface);
    outline: none;
    color: var(--text-primary);
}

.sb-path-block.sb-path-active .sb-path-name-input {
    color: var(--text-primary);
}

.sb-path-del-btn {
    margin-left: auto;
    background: transparent !important;
    border-color: transparent !important;
    color: var(--text-dim);
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.sb-path-block:hover .sb-path-del-btn {
    opacity: 1;
}

.sb-path-del-btn:hover {
    color: var(--neon-red) !important;
    opacity: 1;
}

.sb-path-chain {
    padding: 12px 20px 16px;
    min-height: 110px;
    flex-wrap: nowrap;
    align-items: flex-start;
    /* Inherits display:flex; gap; from .graph-container */
}

/* ── Hardware sub-box (inside graph-node, mirrors topology viewer) ─── */
.sb-hw-box {
    margin-top: 7px;
    padding: 4px 7px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.sb-hw-box:hover {
    border-color: rgba(0, 217, 255, 0.35);
    background: rgba(0, 217, 255, 0.06);
}

.sb-hw-box.sb-hw-empty {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.08);
}

.sb-hw-box-label {
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.sb-hw-box-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-hw-empty .sb-hw-box-name {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

/* Panel back button */
.sb-panel-back {
    background: transparent;
    border: none;
    color: var(--neon-cyan);
    font-size: 12px;
    cursor: pointer;
    padding: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.8;
}

.sb-panel-back:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Light theme overrides */
html[data-theme="light"] .sb-hw-box {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .sb-hw-box:hover {
    border-color: rgba(0, 100, 200, 0.3);
    background: rgba(0, 100, 200, 0.04);
}

html[data-theme="light"] .sb-hw-box-label {
    color: #999;
}

html[data-theme="light"] .sb-hw-box-name {
    color: #222;
}

/* ── Reassign mode (change function type on a column) ──────── */
.sb-col-reassign-btn {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.35;
    font-size: 13px;
    cursor: pointer;
    padding: 0 0 0 5px;
    line-height: 1;
    flex-shrink: 0;
    transition: opacity 0.15s, color 0.15s;
}

.sb-col-reassign-btn:hover {
    opacity: 1;
}

.sb-col-reassign-btn.sb-col-reassign-active {
    color: var(--neon-cyan);
    opacity: 1;
}

/* column header — flex to align name + button */
.sb-column-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.sb-col-type-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Column glows when awaiting reassignment */
.sb-depth-column.sb-reassign-target {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Left panel highlight in reassign mode */
.sb-sidebar.sb-reassign-mode {
    outline: 2px solid var(--neon-cyan);
    outline-offset: -2px;
    border-radius: 6px;
}

.sb-sidebar.sb-reassign-mode #sbFunctionTypesTitle {
    color: var(--neon-cyan);
}

/* Hint beneath the title */
.sb-reassign-hint {
    margin: -4px 0 8px;
    font-size: 11px;
    color: var(--neon-cyan);
    opacity: 0.85;
}

/* Light theme overrides */
html[data-theme="light"] .sb-col-reassign-btn {
    color: #555;
}

html[data-theme="light"] .sb-col-reassign-btn.sb-col-reassign-active {
    color: #0057b8;
}

html[data-theme="light"] .sb-depth-column.sb-reassign-target {
    outline-color: #0057b8;
}

html[data-theme="light"] .sb-sidebar.sb-reassign-mode {
    outline-color: #0057b8;
}

html[data-theme="light"] .sb-sidebar.sb-reassign-mode #sbFunctionTypesTitle {
    color: #0057b8;
}

html[data-theme="light"] .sb-reassign-hint {
    color: #0057b8;
}

/* ── Parallel depth groups ─────────────────────────────────── */
/* Wraps all columns at the same depth index; sits as a flex item in .graph-container */
.sb-depth-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    flex-shrink: 0;
    position: relative;
}

/* Glow the whole group when parallel-add mode is active for it */
.sb-depth-group.sb-parallel-target-group {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 4px;
    border-radius: 6px;
}

/* + Add-parallel button — sits at the bottom of a depth group */
.sb-add-parallel-btn {
    align-self: center;
    background: transparent;
    border: 1px dashed rgba(0, 217, 255, 0.2);
    border-radius: 4px;
    color: rgba(0, 217, 255, 0.35);
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    width: 100%;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    padding: 0;
    margin-top: 2px;
}

.sb-add-parallel-btn:hover {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    background: rgba(0, 217, 255, 0.06);
}

.sb-add-parallel-btn.sb-add-parallel-active {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    border-style: solid;
    font-size: 13px;
}

/* Light theme */
html[data-theme="light"] .sb-add-parallel-btn {
    color: #aaa;
    border-color: #ccc;
}

html[data-theme="light"] .sb-add-parallel-btn:hover {
    color: #0057b8;
    border-color: #0057b8;
}

html[data-theme="light"] .sb-add-parallel-btn.sb-add-parallel-active {
    color: #0057b8;
    border-color: #0057b8;
}

html[data-theme="light"] .sb-depth-group.sb-parallel-target-group {
    outline-color: #0057b8;
}

/* ── Auto Mode ────────────────────────────────────────────────── */

.sb-mode-hidden {
    display: none !important;
}

.sb-auto-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sb-auto-step-panels {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sb-auto-select-panel,
.sb-auto-result-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border-subtle);
    background: var(--bg-panel);
}

.sb-auto-result-panel {
    border-right: none;
    background: var(--bg-charcoal);
}

.sb-auto-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sb-auto-panel-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.sb-auto-step-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--neon-cyan);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.sb-auto-select-panel .sb-search {
    margin: 10px 12px 6px;
    flex-shrink: 0;
}

.sb-auto-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 12px;
}

.sb-auto-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    font-size: 12px;
    color: var(--text-primary);
}

.sb-auto-item:hover {
    background: var(--bg-elevated);
    border-color: rgba(0, 217, 255, 0.2);
}

.sb-auto-item.selected {
    background: rgba(0, 217, 255, 0.08);
    border-color: var(--neon-cyan);
}

.sb-auto-item-name {
    flex: 1;
    font-weight: 500;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-auto-item-meta {
    font-size: 10px;
    opacity: 0.45;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.sb-auto-item-icon {
    opacity: 0.5;
    flex-shrink: 0;
}

.sb-auto-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.sb-auto-result {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

/* Auto mode chain result */
.sb-auto-chain {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px 0;
}

.sb-auto-chain-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    position: relative;
}

.sb-auto-chain-step+.sb-auto-chain-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    color: var(--text-muted);
    opacity: 0.4;
}

.sb-auto-chain-step-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sb-auto-chain-step-icon.acq {
    background: rgba(10, 132, 255, 0.12);
    color: #0a84ff;
}

.sb-auto-chain-step-icon.proc {
    background: rgba(255, 149, 0, 0.12);
    color: #ff9500;
}

.sb-auto-chain-step-icon.dist {
    background: rgba(48, 209, 88, 0.12);
    color: #30d158;
}

.sb-auto-chain-step-icon.other {
    background: rgba(156, 163, 175, 0.12);
    color: #9ca3af;
}

.sb-auto-chain-info {
    flex: 1;
    min-width: 0;
}

.sb-auto-chain-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-auto-chain-type {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sb-auto-chain-depth {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    opacity: 0.5;
}

.sb-auto-summary {
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(0, 217, 255, 0.06);
    border: 1px solid rgba(0, 217, 255, 0.15);
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.sb-auto-summary strong {
    color: var(--text-primary);
}

.sb-auto-no-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Light theme overrides */
html[data-theme="light"] .sb-auto-select-panel {
    background: #fff;
}

html[data-theme="light"] .sb-auto-result-panel {
    background: #f5f6fa;
}

html[data-theme="light"] .sb-auto-chain-step {
    background: #fff;
}

/* ============================================
   ROLE / LENS SYSTEM
   ============================================ */

/* ── Role Selector Bar (inside secondary nav) ── */
.snav-spacer {
    flex: 1;
}

.role-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
    padding: 0;
}

.role-dropdown-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.role-dd-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    text-transform: uppercase;
}

.role-dd-select {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 3px 24px 3px 8px;
    font-size: 0.7rem;
    font-family: var(--font-main);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color 0.2s, background 0.2s;
}

.role-dd-select:hover {
    border-color: var(--neon-cyan);
    background-color: rgba(255, 255, 255, 0.08);
}

.role-dd-select:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 0 1px var(--neon-cyan);
}

.role-dd-select option {
    background: var(--bg-charcoal);
    color: var(--text-secondary);
}

html[data-theme="light"] .role-dd-select {
    background: #fff;
    color: #333;
    border-color: #ccc;
}

html[data-theme="light"] .role-dd-select option {
    background: #fff;
    color: #333;
}

/* ── Global data-source toggle (secondary ribbon, inline) ── */
.global-source-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 12px;
    padding-right: 12px;
    border-right: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.gsrc-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.gsrc-buttons {
    display: flex;
    gap: 3px;
}

.gsrc-btn {
    font-size: 0.55rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: #8a94a6;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-main);
    line-height: 1.3;
}

.gsrc-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.gsrc-btn.gsrc-active {
    color: #fff;
    border-color: transparent;
    cursor: default;
}

.gsrc-btn.gsrc-active.gsrc-atos {
    background: #3b82f6;
}

.gsrc-btn.gsrc-active.gsrc-globecast {
    background: #8b5cf6;
}

html[data-theme="light"] .gsrc-label {
    color: #64748b;
}

html[data-theme="light"] .global-source-toggle {
    border-right-color: #cbd5e1;
}

html[data-theme="light"] .gsrc-btn {
    border-color: #cbd5e1;
    color: #334155;
    background: #fff;
}

html[data-theme="light"] .gsrc-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

html[data-theme="light"] .gsrc-btn.gsrc-active {
    color: #fff;
}

/* ── Viewer Role Context Panel ─────────────────────────────── */
/* ── Role toolbar icon buttons ─────────────────────────────── */
.rc-tool-sep {
    width: 24px;
    height: 1px;
    background: var(--border-subtle);
    margin: 3px 0;
}

.rc-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.rc-tool-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.rc-tool-btn:hover::after {
    content: attr(data-tip);
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-normal);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ── Platform Home ─────────────────────────────────────────── */
.platform-home {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Sidebar platform list */
.ph-sidebar-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

.ph-sidebar-header {
    padding: 0.75rem 1rem 0.5rem;
}

.ph-sidebar-header h2 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.ph-sidebar-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 0.7rem 1rem;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.ph-sidebar-item:hover {
    background: var(--bg-surface);
    border-left-color: var(--ph-color, var(--neon-cyan));
}

.ph-sidebar-item.active {
    background: var(--bg-surface);
    border-left-color: var(--ph-color, var(--neon-cyan));
}

.ph-sidebar-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.ph-sidebar-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ph-sidebar-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ph-sidebar-desc {
    font-size: 0.62rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Overview (no platform selected) */
.ph-overview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 3rem 2rem;
}

.ph-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.3rem;
}

.ph-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Platform page (selected) */
.ph-page {
    padding: 1.5rem 2rem;
}

.ph-page-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.ph-page-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.ph-page-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.ph-page-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0;
}

.ph-page-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ph-page-stat {
    flex: 1;
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.ph-page-stat-val {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ph-page-stat-label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ph-page-body {
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
}

.ph-page-placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0;
}

html[data-theme="light"] .ph-sidebar-item:hover,
html[data-theme="light"] .ph-sidebar-item.active {
    background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .ph-page-header,
html[data-theme="light"] .ph-page-stat,
html[data-theme="light"] .ph-page-body {
    background: #fff;
}

/* ── GCBN Dashboard ────────────────────────────────────────── */
.gcbn-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border-radius: 6px;
}

.gcbn-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

.gcbn-legend-line {
    width: 20px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
}

/* Chassis pairs */
.gcbn-diagram-wrap {
    margin-bottom: 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.5rem;
    overflow-x: auto;
}

.gcbn-diagram {
    width: 100%;
    max-width: 760px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.gcbn-pairs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.gcbn-pair {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.gcbn-pair-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 1rem;
    min-width: 80px;
    flex-shrink: 0;
}

.gcbn-pair-arrow {
    font-size: 1.2rem;
    color: var(--text-dim);
}

.gcbn-pair-label {
    font-size: 0.5rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.gcbn-chassis {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-top: 3px solid var(--gcbn-role-color, var(--border-normal));
    border-radius: 8px;
    padding: 0.75rem 1rem;
    min-width: 0;
}

.gcbn-chassis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.3rem;
}

.gcbn-chassis-role {
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1px 6px;
    border: 1px solid currentColor;
    border-radius: 3px;
    flex-shrink: 0;
}

.gcbn-chassis-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gcbn-chassis-model {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.gcbn-chassis-ports {
    display: flex;
    gap: 4px;
}

.gcbn-port {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--bg-charcoal);
    border: 1px solid var(--border-subtle);
}

.gcbn-port-active {
    background: #30d158;
    border-color: #30d158;
}

/* Cross-connects */
.gcbn-section {
    margin-bottom: 1rem;
}

.gcbn-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin: 0 0 0.6rem;
}

.gcbn-xc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.4rem;
}

.gcbn-xc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.4rem 0.6rem;
    background: var(--bg-surface);
    border-radius: 5px;
    font-size: 0.68rem;
}

.gcbn-xc-from,
.gcbn-xc-to {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.gcbn-xc-arrow {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.gcbn-xc-label {
    margin-left: auto;
    font-size: 0.58rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 1px 6px;
    border-radius: 3px;
}

html[data-theme="light"] .gcbn-chassis {
    background: #fff;
}

html[data-theme="light"] .gcbn-legend,
html[data-theme="light"] .gcbn-xc-row {
    background: #f5f6fa;
}

html[data-theme="light"] .gcbn-port {
    background: #e0e0e0;
}

/* ── GCBN Chassis Detail ───────────────────────────────────── */
.gcbn-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-family: inherit;
    padding: 5px 12px;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.15s;
}

.gcbn-back-btn:hover {
    border-color: var(--neon-cyan);
    color: var(--text-primary);
}

.gcbn-detail-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.gcbn-detail-side {
    border: 1px solid var(--border-subtle);
    border-top: 3px solid var(--gcbn-side-color, var(--border-normal));
    border-radius: 8px;
    padding: 1rem;
    background: var(--bg-surface);
    overflow: hidden;
}

.gcbn-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}

.gcbn-detail-name {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gcbn-detail-model {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Card slot rack */
.gcbn-slot-rack {
    display: flex;
    gap: 3px;
    margin-bottom: 0.75rem;
    padding: 6px 8px;
    background: var(--bg-charcoal);
    border-radius: 4px;
}

.gcbn-slot {
    width: 28px;
    height: 36px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
}

.gcbn-slot-populated {
    background: rgba(48, 209, 88, 0.15);
    border-color: rgba(48, 209, 88, 0.3);
}

/* Detail sections */
.gcbn-detail-section {
    margin-bottom: 0.75rem;
}

.gcbn-detail-section h4 {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin: 0 0 0.4rem;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--border-subtle);
}

/* Port rows */
.gcbn-port-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 6px;
    margin-bottom: 2px;
    border-radius: 3px;
    font-size: 0.65rem;
    border-left: 3px solid var(--border-subtle);
}

.gcbn-port-trunk {
    border-left-color: #0a84ff;
}

.gcbn-port-sdi {
    border-left-color: #ff3366;
}

.gcbn-port-asi {
    border-left-color: #30d158;
}

.gcbn-port-ip {
    border-left-color: #ffd60a;
}

.gcbn-port-id {
    font-family: var(--font-mono, monospace);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: 70px;
}

.gcbn-port-label {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* dSub I/O grid */
.gcbn-dsub-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gcbn-dsub-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    font-size: 0.62rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.gcbn-dsub-id {
    font-family: var(--font-mono, monospace);
    font-weight: 700;
    color: var(--text-primary);
    min-width: 44px;
}

.gcbn-dsub-slot {
    font-family: var(--font-mono, monospace);
    color: var(--text-secondary);
    min-width: 70px;
}

.gcbn-dsub-dest {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Cross-connect section in detail */
.gcbn-detail-xc {
    margin-top: 0.5rem;
}

.gcbn-chassis {
    cursor: pointer;
}

.gcbn-chassis:hover {
    border-color: var(--gcbn-role-color, var(--neon-cyan));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] .gcbn-detail-side {
    background: #fff;
}

html[data-theme="light"] .gcbn-slot-rack {
    background: #eee;
}

html[data-theme="light"] .gcbn-dsub-row {
    background: #f8f9fb;
}

/* ── vDCM Dashboard ────────────────────────────────────────── */
.vdcm-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Toast ─────────────────────────────────────────────────── */
.role-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-normal);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: var(--font-main);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.role-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Disabled tabs for restricted roles ────────────────────── */
.role-tab-disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* ============================================
   CHANGE CONTROL DASHBOARD
   ============================================ */
.cc-container {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.cc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.cc-dashboard {}

.cc-header {
    margin-bottom: 1.5rem;
}

.cc-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.cc-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* Kanban board */
.cc-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 16px;
    margin-bottom: 1.5rem;
}

.cc-column {
    background: var(--bg-panel);
    border-radius: 8px;
    overflow: hidden;
    min-height: 200px;
}

.cc-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-surface);
}

.cc-col-count {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.cc-empty {
    padding: 30px 14px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.75rem;
}

/* Change cards */
.cc-card {
    margin: 8px;
    padding: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    transition: border-color 0.15s;
}

.cc-card:hover {
    border-color: var(--border-normal);
}

.cc-card-ref {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--neon-cyan);
    margin-bottom: 4px;
}

.cc-card-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.cc-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--text-muted);
}

.cc-card-date {
    color: var(--text-dim);
}

/* Expandable diff */
.cc-card-details {
    margin-top: 8px;
}

.cc-card-details summary {
    font-size: 0.6rem;
    color: var(--neon-cyan);
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cc-node-name {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 6px 0 3px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--border-subtle);
}

.cc-diff-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 0.6rem;
    font-family: var(--font-mono);
}

.cc-diff-field {
    color: var(--text-muted);
    min-width: 100px;
}

.cc-diff-old {
    color: #ff3366;
    text-decoration: line-through;
}

.cc-diff-arrow {
    color: var(--text-dim);
}

.cc-diff-new {
    color: #30d158;
    font-weight: 600;
}

/* Governance bar */
.cc-gov {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
}

.cc-gov-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.cc-gov-stats {
    display: flex;
    gap: 24px;
}

.cc-gov-stat {
    text-align: center;
}

.cc-gov-val {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cc-gov-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cc-gov-amber {
    color: #ff9500 !important;
}

.cc-gov-blue {
    color: #0a84ff !important;
}

.cc-gov-green {
    color: #30d158 !important;
}

.cc-gov-red {
    color: #ff3366 !important;
}

/* Light theme */
html[data-theme="light"] .cc-column {
    background: #fff;
}

html[data-theme="light"] .cc-card {
    background: #f8f9fc;
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .cc-gov {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
}

/* ============================================
   CHANGE MODE — Topology Inline Editor
   ============================================ */

/* Amber overlay tint on the graph when Change Mode is active */
body.cm-active .graph-container {
    background: linear-gradient(180deg, #0d0b08 0%, #12100a 100%);
}

body.cm-active .graph-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(245, 158, 11, 0.04);
    pointer-events: none;
    z-index: 0;
}

body.cm-active #chain-visualization {
    outline: 2px solid rgba(245, 158, 11, 0.25);
    outline-offset: -2px;
    border-radius: 4px;
}

/* ── Change Mode Toolbar ───────────────────────────────────────────────────── */
.cm-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.cm-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
}

.cm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* "Change Mode Active" pill badge */
.cm-badge {
    align-items: center;
    gap: 0.4rem;
    padding: 0.22rem 0.7rem;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 20px;
    color: #f59e0b;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.cm-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #f59e0b;
    border-radius: 50%;
    margin-right: 4px;
    animation: cmPulse 1.6s ease-in-out infinite;
}

@keyframes cmPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.45;
        transform: scale(0.75);
    }
}

.cm-change-count {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ============================================
   Media Platforms Section
   ============================================ */
.mp-content {
    padding: 32px;
}

.mp-section-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.mp-placeholder-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 24px;
    text-align: center;
    border: 1px dashed var(--border-normal);
    border-radius: 8px;
    background: var(--bg-surface);
}

/* ── Shared button base ────────────────────────────────────────────────────── */
.cm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.85rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.cm-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cm-btn-enter {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.5);
    color: #f59e0b;
}

.cm-btn-enter:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.cm-btn-exit {
    background: transparent;
    border-color: var(--border-normal);
    color: var(--text-secondary);
}

.cm-btn-exit:hover:not(:disabled) {
    border-color: #f87171;
    color: #f87171;
}

.cm-btn-review {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.45);
    color: #818cf8;
}

.cm-btn-review:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.2);
}

.cm-btn-deploy {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.45);
    color: #10b981;
}

.cm-btn-deploy:hover:not(:disabled) {
    background: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

.cm-btn-ghost {
    background: transparent;
    border-color: var(--border-normal);
    color: var(--text-muted);
    font-size: 0.73rem;
}

.cm-btn-ghost:hover:not(:disabled) {
    border-color: #f87171;
    color: #f87171;
}

.cm-btn-primary {
    background: #10b981;
    border-color: #059669;
    color: #fff;
}

.cm-btn-primary:hover:not(:disabled) {
    background: #059669;
}

.cm-btn-secondary {
    background: transparent;
    border-color: var(--border-normal);
    color: var(--text-secondary);
}

.cm-btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
}

/* ── Edited / Invalid node visuals ─────────────────────────────────────────── */
.graph-node.cm-edited {
    border-color: rgba(245, 158, 11, 0.65) !important;
    border-left-color: #f59e0b !important;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.22), 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

.graph-node.cm-invalid {
    border-color: rgba(239, 68, 68, 0.65) !important;
    border-left-color: #ef4444 !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.25), 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

/* Small "Edited" badge in top-left corner of the node card */
.cm-edit-badge {
    position: absolute;
    top: 3px;
    left: 3px;
    padding: 0.05rem 0.38rem;
    background: rgba(245, 158, 11, 0.88);
    color: #000;
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border-radius: 3px;
    pointer-events: none;
    z-index: 5;
}

/* Hover hint in change mode */
body.cm-active .graph-node {
    cursor: pointer;
}

body.cm-active .graph-node:not(.cm-edited):hover {
    border-color: rgba(245, 158, 11, 0.45) !important;
    border-left-color: rgba(245, 158, 11, 0.7) !important;
}

/* ── Change Editor Panel (right slide-in) ──────────────────────────────────── */
.cm-editor-panel {
    position: fixed;
    top: 0;
    right: -440px;
    width: 420px;
    max-width: 96vw;
    height: 100dvh;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-normal);
    z-index: 300;
    display: flex;
    flex-direction: column;
    transition: right 0.27s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.cm-editor-panel.open {
    right: 0;
}

.cm-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.9rem 1.1rem 0.8rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-shrink: 0;
    gap: 0.75rem;
}

.cm-editor-header-info {
    flex: 1;
    min-width: 0;
}

.cm-editor-title-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.2rem;
}

.cm-editor-mode-tag {
    flex-shrink: 0;
    padding: 0.1rem 0.42rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.38);
    border-radius: 4px;
    color: #f59e0b;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cm-editor-name {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-editor-class {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.cm-editor-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.28rem;
    border-radius: 4px;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: color 0.15s;
    line-height: 1;
}

.cm-editor-close:hover {
    color: var(--text-primary);
}

.cm-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem 1rem;
}

.cm-editor-loading,
.cm-editor-error {
    padding: 2.5rem 1rem;
    text-align: center;
    opacity: 0.55;
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

.cm-editor-error {
    color: #f87171;
    opacity: 1;
}

/* Sections within the editor (Device / Service Config) */
.cm-editor-section {
    margin-bottom: 0.6rem;
    border: 1px solid var(--border-subtle);
    border-radius: 7px;
    overflow: hidden;
}

.cm-editor-section-title {
    padding: 0.35rem 0.7rem;
    background: var(--bg-surface);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

/* Individual field rows */
.cm-field-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.52rem 0.7rem;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
}

.cm-field-row:last-of-type {
    border-bottom: none;
}

.cm-field-row.cm-field-row-check {
    flex-direction: row;
    align-items: center;
    gap: 0;
}

.cm-field-row.cm-field-changed {
    background: rgba(245, 158, 11, 0.06);
    border-left: 2px solid rgba(245, 158, 11, 0.55);
    padding-left: calc(0.7rem - 2px);
}

.cm-field-label {
    font-size: 0.64rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cm-field-input {
    width: 100%;
    padding: 0.36rem 0.58rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.cm-field-input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

select.cm-field-input {
    cursor: pointer;
}

.cm-field-prefilled {
    color: var(--text-muted);
}

.cm-field-prefilled:focus {
    color: var(--text-primary);
}

.cm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
}

input[type="checkbox"].cm-field-input {
    width: auto;
    accent-color: #f59e0b;
    cursor: pointer;
}

/* Old → New diff display */
.cm-change-diff {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    flex-wrap: wrap;
    margin-top: 0.15rem;
}

.cm-diff-old {
    color: #f87171;
    text-decoration: line-through;
    opacity: 0.8;
}

.cm-diff-arrow {
    color: var(--text-muted);
    opacity: 0.55;
}

.cm-diff-new {
    color: #34d399;
    font-weight: 600;
}

/* Editor inner footer (reset + sys_id) */
.cm-editor-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.7rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-shrink: 0;
    margin-top: 0.6rem;
}

.cm-sys-id {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--text-muted);
    opacity: 0.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

/* ── Modal base (Review + Deploy) ─────────────────────────────────────────── */
.cm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.68);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.cm-modal-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.cm-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border-normal);
    border-radius: 12px;
    width: 660px;
    max-width: 94vw;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65);
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 0.2s ease;
}

.cm-modal-backdrop.open .cm-modal {
    transform: scale(1);
}

.cm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.cm-modal-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cm-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.28rem;
    border-radius: 4px;
    transition: color 0.15s;
    line-height: 1;
}

.cm-modal-close:hover {
    color: var(--text-primary);
}

.cm-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.2rem;
}

.cm-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 0.8rem 1.2rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-shrink: 0;
}

/* Review panel content */
.cm-review-node {
    margin-bottom: 1.1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
}

.cm-review-node-name {
    padding: 0.45rem 0.85rem;
    background: rgba(245, 158, 11, 0.07);
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: #f59e0b;
    border-bottom: 1px solid var(--border-subtle);
}

.cm-review-node-class {
    display: block;
    padding: 0.28rem 0.85rem;
    font-size: 0.63rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.cm-review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.cm-review-table th {
    padding: 0.38rem 0.75rem;
    text-align: left;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
}

.cm-review-table td {
    padding: 0.48rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

.cm-review-table tr:last-child td {
    border-bottom: none;
}

.cm-review-field {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.cm-review-old {
    color: #f87171;
    text-decoration: line-through;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    opacity: 0.8;
}

.cm-review-new {
    color: #34d399;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
}

.cm-review-empty {
    text-align: center;
    opacity: 0.45;
    padding: 2.5rem 1rem;
    font-size: 0.82rem;
}

/* Deploy modal specifics */
.cm-deploy-summary {
    margin-bottom: 1rem;
    padding: 0.65rem 0.9rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 7px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cm-deploy-summary strong {
    color: #f59e0b;
}

.cm-deploy-desc-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cm-deploy-desc-input {
    width: 100%;
    padding: 0.55rem 0.8rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-normal);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    resize: vertical;
    min-height: 72px;
    box-sizing: border-box;
}

.cm-deploy-desc-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.cm-deploy-progress {
    color: #60a5fa;
    font-size: 0.82rem;
}

.cm-deploy-success {
    color: #34d399;
    font-size: 0.82rem;
    line-height: 1.6;
}

.cm-deploy-error {
    color: #f87171;
    font-size: 0.82rem;
}

/* Light theme overrides */
html[data-theme="light"] .cm-toolbar {
    background: #fff;
}

html[data-theme="light"] .cm-editor-panel {
    background: #fff;
}

html[data-theme="light"] .cm-editor-header {
    background: #f8f9fa;
}

html[data-theme="light"] .cm-modal {
    background: #fff;
}

html[data-theme="light"] .cm-modal-header {
    background: #f8f9fa;
}

html[data-theme="light"] .cm-modal-footer {
    background: #f8f9fa;
}

html[data-theme="light"] .cm-editor-footer-inner {
    background: #f8f9fa;
}

html[data-theme="light"] .cm-editor-section-title {
    background: #f0f2f5;
}

html[data-theme="light"] .cm-field-input {
    background: #fff;
}

html[data-theme="light"] body.cm-active .graph-container {
    background: linear-gradient(180deg, #f5f0e8 0%, #f8f4ec 100%);
}

/* ── Per-field revert button (in diff row) ─────────────────────────────────── */
.cm-revert-field-btn {
    flex-shrink: 0;
    margin-left: auto;
    padding: 0.1rem 0.45rem;
    background: transparent;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 4px;
    color: #f87171;
    font-size: 0.62rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.cm-revert-field-btn:hover {
    background: rgba(248, 113, 113, 0.12);
    border-color: #f87171;
}

/* Update diff row to be flex so revert button aligns right */
.cm-change-diff {
    display: flex !important;
    align-items: center;
    gap: 0.38rem;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    flex-wrap: nowrap;
    margin-top: 0.15rem;
}

/* ── Per-node "Roll Back Node" in Review panel ────────────────────────────── */
.cm-review-node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.85rem;
    background: rgba(245, 158, 11, 0.07);
    border-bottom: 1px solid var(--border-subtle);
    gap: 0.6rem;
}

.cm-review-node-reset {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.65rem !important;
    flex-shrink: 0;
    border-color: rgba(248, 113, 113, 0.4) !important;
    color: #f87171 !important;
}

.cm-review-node-reset:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.1) !important;
    border-color: #f87171 !important;
}

/* Per-field revert in review table */
.cm-review-revert-btn {
    padding: 0.18rem 0.5rem;
    background: transparent;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 4px;
    color: #f87171;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.cm-review-revert-btn:hover {
    background: rgba(248, 113, 113, 0.12);
    border-color: #f87171;
}

/* ── Per-field revert button (in diff row) ─────────────────────────────────── */
.cm-revert-field-btn {
    flex-shrink: 0;
    margin-left: auto;
    padding: 0.1rem 0.45rem;
    background: transparent;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 4px;
    color: #f87171;
    font-size: 0.62rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.cm-revert-field-btn:hover {
    background: rgba(248, 113, 113, 0.12);
    border-color: #f87171;
}

/* Update diff row to be flex so revert button aligns right */
.cm-change-diff {
    display: flex !important;
    align-items: center;
    gap: 0.38rem;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    flex-wrap: nowrap;
    margin-top: 0.15rem;
}

/* ── Per-node "Roll Back Node" in Review panel ────────────────────────────── */
.cm-review-node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.85rem;
    background: rgba(245, 158, 11, 0.07);
    border-bottom: 1px solid var(--border-subtle);
    gap: 0.6rem;
}

.cm-review-node-reset {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.65rem !important;
    flex-shrink: 0;
    border-color: rgba(248, 113, 113, 0.4) !important;
    color: #f87171 !important;
}

.cm-review-node-reset:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.1) !important;
    border-color: #f87171 !important;
}

/* Per-field revert in review table */
.cm-review-revert-btn {
    padding: 0.18rem 0.5rem;
    background: transparent;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 4px;
    color: #f87171;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.cm-review-revert-btn:hover {
    background: rgba(248, 113, 113, 0.12);
    border-color: #f87171;
}

/* ── Change History Modal ─────────────────────────────────────────────────── */

/* Wider modal for the history view */
.cm-modal-lg {
    width: 820px;
    max-width: 96vw;
}

.cm-history-modal-body {
    padding: 0 !important;
    overflow-y: auto;
    max-height: 65vh;
}

.cm-history-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    opacity: 0.4;
    font-size: 0.84rem;
    line-height: 1.7;
}

/* History toolbar button (alongside Review/Deploy) */
.cm-btn-history {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

.cm-btn-history:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.2);
}

/* Individual history entry card */
.cm-history-entry {
    border-bottom: 1px solid var(--border-subtle);
}

.cm-history-entry:last-child {
    border-bottom: none;
}

.cm-history-entry-header {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.1rem;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.cm-history-entry-header:hover,
.cm-history-entry-header.expanded {
    background: rgba(139, 92, 246, 0.05);
}

.cm-history-entry-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cm-history-ref {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: #a78bfa;
}

.cm-history-date {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.cm-history-entry-summary {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.cm-history-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-history-count {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    opacity: 0.65;
}

.cm-history-entry-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.cm-history-undo-btn {
    font-size: 0.72rem !important;
    padding: 0.28rem 0.7rem !important;
    border-color: rgba(248, 113, 113, 0.4) !important;
    color: #f87171 !important;
    white-space: nowrap;
}

.cm-history-undo-btn:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.1) !important;
    border-color: #f87171 !important;
}

.cm-history-chevron {
    color: var(--text-muted);
    font-size: 1.1rem;
    opacity: 0.4;
    transition: transform 0.2s ease;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

/* Expanded node details inside a history entry */
.cm-history-entry-body {
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    padding: 0.75rem 1.1rem 1rem;
}

.cm-history-node {
    margin-bottom: 0.85rem;
}

.cm-history-node:last-child {
    margin-bottom: 0;
}

.cm-history-node-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.cm-history-node-class {
    font-weight: 400;
    font-size: 0.62rem;
    color: var(--text-muted);
    opacity: 0.65;
}

/* Footer note in history modal */
.cm-history-footer-note {
    flex: 1;
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.65;
    line-height: 1.5;
    margin: 0;
}

/* Light theme */
html[data-theme="light"] .cm-history-entry-header:hover,
html[data-theme="light"] .cm-history-entry-header.expanded {
    background: rgba(139, 92, 246, 0.06);
}

html[data-theme="light"] .cm-history-entry-body {
    background: #f8f9fa;
}

/* ── Change History Modal ─────────────────────────────────────────────────── */

/* Wider modal for the history view */
.cm-modal-lg {
    width: 820px;
    max-width: 96vw;
}

.cm-history-modal-body {
    padding: 0 !important;
    overflow-y: auto;
    max-height: 65vh;
}

.cm-history-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    opacity: 0.4;
    font-size: 0.84rem;
    line-height: 1.7;
}

/* History toolbar button (alongside Review/Deploy) */
.cm-btn-history {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

.cm-btn-history:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.2);
}

/* Individual history entry card */
.cm-history-entry {
    border-bottom: 1px solid var(--border-subtle);
}

.cm-history-entry:last-child {
    border-bottom: none;
}

.cm-history-entry-header {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.1rem;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.cm-history-entry-header:hover,
.cm-history-entry-header.expanded {
    background: rgba(139, 92, 246, 0.05);
}

.cm-history-entry-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cm-history-ref {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: #a78bfa;
}

.cm-history-date {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.cm-history-entry-summary {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.cm-history-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-history-count {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    opacity: 0.65;
}

.cm-history-entry-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.cm-history-undo-btn {
    font-size: 0.72rem !important;
    padding: 0.28rem 0.7rem !important;
    border-color: rgba(248, 113, 113, 0.4) !important;
    color: #f87171 !important;
    white-space: nowrap;
}

.cm-history-undo-btn:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.1) !important;
    border-color: #f87171 !important;
}

.cm-history-chevron {
    color: var(--text-muted);
    font-size: 1.1rem;
    opacity: 0.4;
    transition: transform 0.2s ease;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

/* Expanded node details inside a history entry */
.cm-history-entry-body {
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    padding: 0.75rem 1.1rem 1rem;
}

.cm-history-node {
    margin-bottom: 0.85rem;
}

.cm-history-node:last-child {
    margin-bottom: 0;
}

.cm-history-node-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.cm-history-node-class {
    font-weight: 400;
    font-size: 0.62rem;
    color: var(--text-muted);
    opacity: 0.65;
}

/* Footer note in history modal */
.cm-history-footer-note {
    flex: 1;
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.65;
    line-height: 1.5;
    margin: 0;
}

/* Light theme */
html[data-theme="light"] .cm-history-entry-header:hover,
html[data-theme="light"] .cm-history-entry-header.expanded {
    background: rgba(139, 92, 246, 0.06);
}

html[data-theme="light"] .cm-history-entry-body {
    background: #f8f9fa;
}

/* -- Coming Soon View -------------------------------------------------------- */
.coming-soon-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 400px;
    text-align: center;
    gap: 0.5rem;
    opacity: 0.85;
}

.coming-soon-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.coming-soon-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.coming-soon-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--neon-cyan, #00d9ff);
    margin: 0;
}

.coming-soon-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ── Sheet chip delete button ─────────────────────────────────────────────── */
.dm-stage-sheet-delete {
    margin-left: 4px;
    font-size: 12px;
    opacity: 0;
    color: #ef4444;
    cursor: pointer;
    transition: opacity 0.15s;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Uniform sheet chips in signal flow columns ──────────────────────────── */
.dm-flow-stage-body .dm-stage-sheet-chip {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    padding: 3px 6px;
    min-height: 22px;
}

.dm-stage-sheet-chip:hover .dm-stage-sheet-delete {
    opacity: 0.7;
}

.dm-stage-sheet-delete:hover {
    opacity: 1 !important;
}

/* ── Find Chain panel ──────────────────────────────────────────────────────── */
.dm-chain-panel {
    border: 1px solid var(--border-color, #2a2a3e);
    border-radius: 8px;
    background: var(--bg-surface, #1a1a2e);
    font-size: 11px;
    overflow: hidden;
}

.dm-chain-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.08);
    border-bottom: 1px solid var(--border-color, #2a2a3e);
    font-size: 11px;
    font-weight: 600;
}

.dm-chain-roots {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-color, #2a2a3e);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.dm-chain-slug {
    font-family: monospace;
    font-size: 10px;
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
    padding: 2px 6px;
    border-radius: 4px;
}

.dm-chain-stages {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.dm-chain-stage {
    flex: 1;
    min-width: 130px;
    padding: 8px 10px;
    border-right: 1px solid var(--border-color, #2a2a3e);
}

.dm-chain-stage:last-child {
    border-right: none;
}

.dm-chain-stage--anchor {
    background: rgba(99, 102, 241, 0.06);
}

.dm-chain-stage--missing {
    background: rgba(239, 68, 68, 0.05);
}

.dm-chain-stage--warn {
    background: rgba(245, 158, 11, 0.05);
}

.dm-chain-stage-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.55;
    margin-bottom: 6px;
}

.dm-chain-stage-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 0;
    font-size: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.dm-chain-stage-row:last-child {
    border-bottom: none;
}

.dm-chain-stage-row--best {
    font-weight: 600;
}

.dm-chain-conf-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dm-chain-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dm-chain-link-btn {
    padding: 2px 7px;
    font-size: 10px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #818cf8;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.dm-chain-link-btn:hover {
    background: rgba(99, 102, 241, 0.25);
}

/* ── DROM sub-chain ── */
.dm-chain-drom-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a78bfa;
    padding: 6px 12px 2px;
    border-top: 1px solid var(--border-color, #2a2a3e);
}

.dm-chain-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color, #2a2a3e);
    flex-wrap: wrap;
}

.dm-chain-link-all-btn {
    padding: 4px 12px;
    font-size: 11px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s;
}

.dm-chain-link-all-btn:hover {
    background: rgba(16, 185, 129, 0.25);
}

.dm-chain-auto-label {
    font-size: 10px;
    opacity: 0.65;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.dm-chain-info-msg {
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.5;
    opacity: 0.8;
}

.dm-find-chain-btn {
    padding: 3px 10px;
    font-size: 11px;
    background: rgba(99, 102, 241, 0.10);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #818cf8;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.dm-find-chain-btn:hover {
    background: rgba(99, 102, 241, 0.22);
}

/* ── End Find Chain panel ─────────────────────────────────────────────────── */