/* NetPulse — Network Cartography Theme */

:root {
    --bg-primary:    #080d16;
    --bg-secondary:  #0e1622;
    --bg-card:       #111d2e;
    --bg-node:       #0d1825;
    --border:        #1e2e44;
    --border-bright: #2a3f5a;
    --text-primary:  #dde8f5;
    --text-secondary:#8aa4c0;
    --text-dim:      #4a6280;
    --accent-green:  #10b981;
    --accent-red:    #ef4444;
    --accent-blue:   #3b82f6;
    --accent-orange: #f59e0b;
    --accent-cyan:   #06b6d4;
    --rx-color:      #10b981;
    --tx-color:      #3b82f6;
    --node-online:   #10b981;
    --node-offline:  #3a4e65;
    --pulse:         #10b981;
    --rack-bg:       #060b12;
    --rack-rail:     #0e1926;
    --rack-border:   #1e3050;
    /* Icon theme system */
    --icon-body:         #050d18;
    --icon-body-stroke:  #1a3050;
    --icon-detail:       #06b6d4;
    --icon-glow:         rgba(6, 182, 212, 0.18);
    --topo-dot:          #1a2a3e;
    --cluster-idle:      rgba(139, 92, 246, 0.15);
}

/* ─── Light theme ─────────────────────────────────────────── */
[data-theme="light"] {
    --bg-primary:    #f0f5fb;
    --bg-secondary:  #e4eaf4;
    --bg-card:       #ffffff;
    --bg-node:       #edf2fa;
    --border:        #c8d5e8;
    --border-bright: #a8bcd8;
    --text-primary:  #1a2540;
    --text-secondary:#3d526e;
    --text-dim:      #7890b0;
    --accent-green:  #059669;
    --accent-cyan:   #0891b2;
    --rx-color:      #059669;
    --tx-color:      #2563eb;
    --node-online:   #059669;
    --node-offline:  #94afc8;
    --pulse:         #059669;
    --rack-bg:       #e2eaf8;
    --rack-rail:     #ccd8ee;
    --rack-border:   #a8c0dc;
    --icon-body:         #dce8f8;
    --icon-body-stroke:  #a8c0dc;
    --icon-detail:       #0891b2;
    --icon-glow:         rgba(8, 145, 178, 0.18);
    --topo-dot:          #b8cce0;
    --cluster-idle:      rgba(124, 58, 237, 0.18);
}

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

body {
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* ─── Header ─────────────────────────────────────────────── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    height: 52px;
    position: relative;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.subtitle {
    color: var(--text-dim);
    font-size: 12px;
    letter-spacing: 0.3px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
}

/* Pulse dot */
.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pulse);
    display: inline-block;
    animation: pulse-ring 2.4s ease-in-out infinite;
}

@keyframes pulse-ring {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    60%       { opacity: 0.8; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* WebSocket status */
.ws-connected::before    { content: "●"; margin-right: 5px; color: var(--accent-green); }
.ws-disconnected::before { content: "●"; margin-right: 5px; color: var(--accent-red); }
.ws-connected            { color: var(--accent-green); }
.ws-disconnected         { color: var(--accent-red); }

/* ─── Layout ──────────────────────────────────────────────── */
main {
    display: grid;
    grid-template-columns: 1fr;
    height: calc(100vh - 52px);
    overflow: hidden;
    position: relative;
}

main.panel-open {
    grid-template-columns: 1fr 320px;
}

/* ─── Topology panel ──────────────────────────────────────── */
#topology-panel {
    overflow: hidden;
    position: relative;
    background: var(--bg-primary);
    /* Subtle dot-grid background */
    background-image: radial-gradient(circle, var(--topo-dot) 1px, transparent 1px);
    background-size: 28px 28px;
    background-position: 14px 14px;
}

#topology-svg {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#topology-svg:active { cursor: grabbing; }

/* ─── SVG node styles ─────────────────────────────────────── */
.node-group { cursor: pointer; }

.node-rect {
    transition: filter 0.2s, stroke 0.4s;
}
.node-group:hover .node-rect { filter: brightness(1.4); }
.node-group:hover .ap-arc    { filter: drop-shadow(0 0 4px currentColor); }
.node-group:hover .cloud-path { filter: brightness(1.3); }

.node-label {
    fill: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
    font-family: ui-sans-serif, -apple-system, sans-serif;
}

.node-ip {
    fill: var(--text-dim);
    font-size: 9px;
    text-anchor: middle;
    pointer-events: none;
    font-family: ui-monospace, 'SF Mono', monospace;
}

.node-icon {
    font-size: 13px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* ─── Service cluster ─────────────────────────────────────── */
.cluster-frame {
    fill: var(--bg-secondary);
    stroke: var(--border-bright);
    stroke-width: 1.5;
    stroke-dasharray: 6 3;
}

.cluster-label-text {
    fill: var(--text-dim);
    font-size: 8px;
    font-family: ui-monospace, 'SF Mono', monospace;
    text-anchor: middle;
    letter-spacing: 2px;
    text-transform: uppercase;
    pointer-events: none;
}

/* ─── Rack frame ──────────────────────────────────────────── */
.rack-frame {
    fill: var(--rack-bg);
    stroke: var(--rack-border);
    stroke-width: 1.5;
}

.rack-rail {
    fill: var(--rack-rail);
}

.rack-hole {
    fill: var(--bg-primary);
}

.rack-label-text {
    fill: var(--text-dim);
    font-size: 8px;
    font-family: ui-monospace, 'SF Mono', monospace;
    text-anchor: middle;
    letter-spacing: 2px;
    text-transform: uppercase;
    pointer-events: none;
}

/* ─── Link paths ──────────────────────────────────────────── */
.link-path {
    fill: none;
    transition: stroke 0.4s;
}

/* Speed-proportional widths handled in JS */

@keyframes flow {
    to { stroke-dashoffset: -20; }
}

.link-path.animated {
    animation: flow 1.2s linear infinite;
}

.link-label {
    fill: var(--text-dim);
    font-size: 7.5px;
    font-family: ui-monospace, 'SF Mono', monospace;
    text-anchor: middle;
    pointer-events: none;
}

/* ─── AP WiFi icon ────────────────────────────────────────── */
.ap-arc {
    fill: none;
    stroke-linecap: round;
    transition: stroke 0.4s, opacity 0.4s;
}

.ap-dot {
    transition: fill 0.4s;
}

.ap-label {
    fill: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    text-anchor: middle;
    pointer-events: none;
}

/* ─── Cloud node ──────────────────────────────────────────── */
.cloud-path {
    transition: stroke 0.4s;
}

/* ─── Router hexagon ──────────────────────────────────────── */
.router-hex {
    transition: stroke 0.4s, filter 0.2s;
}
/* router-hex hover handled below */

/* ─── Service badge ───────────────────────────────────────── */
.service-rect {
    transition: stroke 0.4s;
}
.node-group:hover .service-rect { filter: brightness(1.5); }

/* ─── Zoom controls ───────────────────────────────────────── */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    z-index: 20;
}

.zoom-btn {
    width: 30px;
    height: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    user-select: none;
    line-height: 1;
}

.zoom-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

.zoom-btn.reset { font-size: 11px; }

/* ─── Detail panel (slide-in) ─────────────────────────────── */
.detail-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Default: off-screen to the right */
    transform: translateX(100%);
    transition: transform 0.28s ease;
    width: 320px;
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    z-index: 50;
}

.detail-panel.open {
    transform: translateX(0);
    position: relative;
    width: auto;
}

.detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#detail-panel-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

#detail-panel-node-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.type-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    flex-shrink: 0;
}

#detail-panel-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
    flex-shrink: 0;
}
#detail-panel-close:hover { color: var(--text-primary); }

#detail-panel-back {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s;
    flex-shrink: 0;
    margin-right: auto;
}
#detail-panel-back:hover { color: var(--accent-cyan); }

#detail-panel-content {
    padding: 12px 14px;
    overflow-y: auto;
    flex: 1;
    font-size: 12px;
}

.panel-section-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    margin: 10px 0 5px;
}

.panel-section-title:first-child { margin-top: 0; }

.chart-section {
    padding: 10px 14px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chart-section.hidden { display: none; }

/* Stat rows inside the panel (reuse existing .detail-row etc.) */
.stat {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.stat-label {
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
}

.stat-value.rx { color: var(--rx-color); }
.stat-value.tx { color: var(--tx-color); }
.stat-value.small { font-size: 13px; font-weight: 500; }

.stat-unit {
    font-size: 9px;
    color: var(--text-dim);
    margin-top: 1px;
}

.wan-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

canvas {
    width: 100% !important;
    border-radius: 4px;
    display: block;
}

#wan-chart    { height: 60px !important; max-height: 60px; }
#latency-chart { height: 50px !important; max-height: 50px; }

/* ─── Device popup ────────────────────────────────────────── */
.popup {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 10px;
    min-width: 240px;
    max-width: 310px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.03);
    z-index: 200;
    overflow: hidden;
    animation: popup-in 0.15s ease-out;
}

@keyframes popup-in {
    from { opacity: 0; transform: translateY(4px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.popup.hidden { display: none; }

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.popup-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-type-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
}

#popup-title {
    font-weight: 700;
    font-size: 13px;
}

.popup-header button {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.popup-header button:hover { color: var(--text-primary); }

#popup-body {
    padding: 10px 14px;
    font-size: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    color: var(--text-dim);
    font-size: 11px;
}

.detail-value {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, 'SF Mono', monospace;
    font-size: 11px;
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge::before { content: "●"; font-size: 7px; }
.status-badge.online  { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); border: 1px solid rgba(16,185,129,0.2); }
.status-badge.offline { background: rgba(58, 78, 101, 0.2); color: var(--node-offline); border: 1px solid rgba(58,78,101,0.3); }
.status-badge.unknown { background: rgba(245, 158, 11, 0.1); color: var(--accent-orange); border: 1px solid rgba(245,158,11,0.2); }

/* Port list in popup (for switches) */
.detail-section {
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.detail-section-title {
    display: block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.port-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 0;
}

.port-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.port-peer {
    flex: 1;
    font-size: 11px;
    color: var(--text-secondary);
}

.port-speed {
    font-size: 10px;
    font-family: ui-monospace, 'SF Mono', monospace;
    color: var(--text-dim);
}

/* ─── Clickable service cards in detail panel ────────────── */
.panel-service-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 4px;
}

.panel-service-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}

.panel-service-card:hover {
    border-color: var(--accent-cyan);
    background: var(--bg-secondary);
}

.panel-service-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.panel-service-initial {
    width: 28px;
    height: 28px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.panel-service-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
}

.panel-service-ip {
    font-size: 9px;
    color: var(--text-dim);
    text-align: center;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.panel-service-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    position: absolute;
    top: 7px;
    right: 7px;
}

/* ─── LXC / VM rows inside server panel ──────────────────── */
.lxc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}
.lxc-row:last-child { border-bottom: none; }
.lxc-row-nav { cursor: pointer; }
.lxc-row-nav:hover .lxc-name { color: var(--accent-cyan); }

.lxc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.lxc-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}

.lxc-nav {
    color: var(--accent-cyan);
    font-size: 12px;
    font-weight: 700;
    margin-left: 2px;
}

.lxc-sub {
    font-size: 10px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.lxc-actions { flex-shrink: 0; }

.lxc-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 12px;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.22);
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.15s;
}
.lxc-link-btn:hover { background: rgba(6, 182, 212, 0.2); }

/* ─── Quick-link buttons inside panel ────────────────────── */
.panel-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0 2px;
}

.panel-link-btn {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.22);
    border-radius: 5px;
    padding: 5px 10px;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
}

.panel-link-btn:hover {
    background: rgba(6, 182, 212, 0.18);
    border-color: var(--accent-cyan);
}

/* ─── Router stats rows inside panel ─────────────────────── */
.router-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.router-stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}

.router-stat-val {
    display: block;
    font-size: 18px;
    font-weight: 700;
    font-family: ui-monospace, 'SF Mono', monospace;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.router-stat-val.rx { color: var(--rx-color); }
.router-stat-val.tx { color: var(--tx-color); }

.router-stat-lbl {
    display: block;
    font-size: 8px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ─── Time-range toggle ───────────────────────────────────── */
.range-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.range-btn {
    flex: 1;
    padding: 3px 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 600;
    font-family: ui-monospace, 'SF Mono', monospace;
    cursor: pointer;
    transition: all 0.15s;
}

.range-btn:hover {
    border-color: var(--border-bright);
    color: var(--text-secondary);
}

.range-btn.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #000;
}


/* Port strip (switches) */
.port-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.port-block {
    width: 16px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 2px;
    position: relative;
    cursor: default;
}

.port-block-num {
    font-size: 7px;
    font-family: ui-monospace, 'SF Mono', monospace;
    color: rgba(255,255,255,0.4);
    line-height: 1;
}

.port-block-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    margin-bottom: 2px;
}

/* SSID table (APs) */
.ssid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 2px;
}

.ssid-table th {
    text-align: left;
    color: var(--text-dim);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 4px 5px 0;
    border-bottom: 1px solid var(--border);
}

.ssid-table td {
    padding: 4px 4px 4px 0;
    border-bottom: 1px solid rgba(30,46,68,0.6);
    color: var(--text-secondary);
    font-family: ui-monospace, 'SF Mono', monospace;
}

.ssid-table tr:last-child td { border-bottom: none; }

.ssid-name {
    color: var(--text-primary) !important;
    font-family: ui-sans-serif, -apple-system, sans-serif !important;
    font-weight: 500;
}

.channel-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.channel-pill {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 5px 8px;
    text-align: center;
}

.channel-pill-band {
    display: block;
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.channel-pill-val {
    display: block;
    font-size: 16px;
    font-weight: 700;
    font-family: ui-monospace, 'SF Mono', monospace;
    color: var(--accent-cyan);
    line-height: 1.3;
}

/* ─── Link legend overlay ─────────────────────────────────── */
.link-legend-overlay {
    position: absolute;
    bottom: 14px;
    left: 14px;
    display: flex;
    gap: 16px;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    z-index: 20;
    pointer-events: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-label {
    font-size: 9px;
    font-family: ui-monospace, 'SF Mono', monospace;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ─── SNMP switch panel ────────────────────────────────────── */
.snmp-switch-block {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.snmp-switch-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.snmp-switch-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.snmp-ports-bar {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.snmp-port-pip {
    width: 10px;
    height: 12px;
    border-radius: 2px;
    transition: background 0.3s;
}

.snmp-stat-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.snmp-stat-item {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 6px;
    text-align: center;
}

.snmp-stat-val {
    display: block;
    font-size: 13px;
    font-weight: 700;
    font-family: ui-monospace, 'SF Mono', monospace;
    color: var(--accent-cyan);
    line-height: 1.2;
}

.snmp-stat-label {
    display: block;
    font-size: 8px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}

/* ─── Theme toggle button ─────────────────────────────────── */
.theme-toggle {
    width: 30px;
    height: 30px;
    background: none;
    border: 1px solid var(--border-bright);
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
    padding: 0;
    flex-shrink: 0;
}
.theme-toggle:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--icon-glow);
    background: var(--bg-card);
}
.theme-toggle svg { width: 15px; height: 15px; pointer-events: none; }

/* ─── SVG node fills — CSS-driven for theme switching ────── */
/* CSS fill > SVG presentation attribute, so these override D3's .attr("fill") */
.cloud-path   { fill: var(--icon-body); }
.router-hex   { fill: var(--icon-body); }
.service-rect { fill: var(--icon-body); }
.node-rect    { fill: var(--icon-body); }

/* Hover glow adapts to theme */
.node-group:hover .router-hex  { filter: drop-shadow(0 0 6px var(--accent-cyan)); }
.node-group:hover .node-rect   { filter: brightness(1.25) drop-shadow(0 0 4px var(--icon-glow)); }
.node-group:hover .service-rect { filter: brightness(1.3)  drop-shadow(0 0 4px var(--icon-glow)); }
.node-group:hover .cloud-path  { filter: brightness(1.15); }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
    main.panel-open {
        grid-template-columns: 1fr;
    }
    .detail-panel.open {
        position: fixed;
        right: 0;
        top: 52px;
        height: calc(100vh - 52px);
        width: min(320px, 100vw);
        z-index: 100;
        box-shadow: -4px 0 20px rgba(0,0,0,0.5);
    }
}
