/* ---- Attack Chain Topology (instructions8 + instructions10) ---------------- */
/* Fluent UI card wrapping the Graphviz SVG, shared by the HTML report and
   the dashboard "Selected job" panel. */

/* risk palette — single source of truth for chips, popover, matrix, topology */
:root {
  --pal-critical: #d13438;   /* red    */
  --pal-high:     #ff8c00;   /* orange */
  --pal-medium:   #ffb900;   /* yellow */
  --pal-low:      #0078d4;   /* blue   */
}

.spectra-graph {
  background: #ffffff;
  border: 1px solid #edebe9;
  border-radius: 2px;
  box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132),
    0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108);
  overflow: hidden;
  margin: 20px 0;
  max-width: 100%;
  box-sizing: border-box;
}

.graph-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #edebe9;
}
.graph-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #323130;
}

/* Container has fixed height & relative position for absolute zoom controls (instructions10) */
#spectra-graph-container {
  position: relative;
  display: flex;
  width: 100%;
  height: 600px;
  min-height: 600px;
  overflow: hidden;
  background: #ffffff;
  padding: 0;
  border: 1px solid #edebe9;
  border-radius: 4px;
}
#spectra-graph-container #cy-canvas {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: transparent;
}
#spectra-graph-container svg {
  display: block;
  width: 100%;
  height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
}
#spectra-graph-container svg .graph-node { cursor: pointer; }
#spectra-graph-container #cy-canvas,
#spectra-graph-container #cy-canvas canvas { cursor: grab; }
#spectra-graph-container #cy-canvas.cy-grabbing,
#spectra-graph-container #cy-canvas.cy-grabbing canvas { cursor: grabbing; }

/* Custom Fluent + / - / Reset controls cluster */
.graph-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  pointer-events: none;
}
.graph-controls > * {
  pointer-events: auto;
}
.gbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #edebe9;
  border-radius: 2px;
  background: #ffffff;
  color: #323130;
  cursor: pointer;
  box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132),
    0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108);
  transition: background 0.1s ease, border-color 0.1s ease;
}
.gbtn:hover {
  background: #f3f2f1;
  border-color: #0078d4;
}
.gbtn:active {
  background: #edebe9;
}
.gbtn svg {
  width: 16px;
  height: 16px;
  stroke: #323130;
}
.gbtn-sep {
  width: 32px;
  height: 1px;
  background: #edebe9;
  margin: 2px 0;
}
.gbtn-reset {
  width: auto;
  padding: 0 8px;
  height: 26px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #323130;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Risk legend — matches Findings by Profile / Exec Summary badges */
.graph-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #edebe9;
  border-radius: 2px;
  box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 10px;
  color: #605e5c;
  white-space: nowrap;
}
.graph-legend .gl-label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: #323130;
}
.graph-legend .gl-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.graph-legend .gl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.graph-legend .gl-critical { background: #d13438; }
.graph-legend .gl-high { background: #ff8c00; }
.graph-legend .gl-medium { background: #ffb900; }
.graph-legend .gl-low { background: #0078d4; }

@media (max-width: 640px) {
  #spectra-graph-container {
    height: 420px;
    min-height: 420px;
  }
}

/* hide native graphviz <title> tooltips (we render our own) */
#spectra-graph-container svg title { display: none; }

/* click-to-focus: everything dims except the clicked node + its edges */
#spectra-graph-container svg.dimmed .graph-node:not(.focused),
#spectra-graph-container svg.dimmed .graph-edge:not(.focused-edge) {
  opacity: 0.15;
  transition: opacity 0.3s ease;
}
#spectra-graph-container svg .graph-node.highlighted > polygon,
#spectra-graph-container svg .graph-node.highlighted > path,
#spectra-graph-container svg .graph-node.highlighted > rect {
  stroke: #0078d4 !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 6px rgba(0, 120, 212, 0.5));
}
#spectra-graph-container svg .graph-node text,
#spectra-graph-container svg .graph-node.highlighted text {
  stroke: none !important;
}

/* custom Fluent tooltip */
#fluent-tooltip {
  position: absolute;
  background: #323130;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 2px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 3.2px 7.2px rgba(0, 0, 0, 0.132);
  pointer-events: none;
  z-index: 1000;
  white-space: pre-line;
  opacity: 0;
  transition: opacity 0.15s ease;
}
#fluent-tooltip.show { opacity: 1; }

/* graphviz fallback message when the dot binary is missing */
.graph-fallback {
  padding: 16px;
  color: #d13438;
  font-size: 13px;
}
.spectra-graph .text-red-600 { padding: 16px; color: #d13438; font-size: 13px; }

/* ---- Cisco-style Compact Nodes risk-colored icons) ------- */
.cy-node-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  user-select: none;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.cy-node-chip svg,
.cy-node-chip i {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cy-node-chip:hover svg,
.cy-node-chip:hover i {
  transform: scale(1.15);
  filter: brightness(0.9);
}

.cy-node-critical { color: #d13438; }
.cy-node-high { color: #ff8c00; }
.cy-node-medium { color: #ffb900; }
.cy-node-low { color: #0078d4; }

.cy-node-ip {
  font-size: 11px;
  font-weight: 600;
  color: #323130;
  background: rgba(255, 255, 255, 0.85);
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ---- Patient Zero Pulse Highlight ---------------------- */
.cy-node-chip.highlighted .cy-node-icon,
.cy-dot-container.highlighted .cy-dot-node,
.node.highlighted {
  border-width: 3px !important;
  border-color: #d13438 !important;
  box-shadow: 0 0 16px rgba(209, 52, 56, 0.85), 0 0 0 4px rgba(209, 52, 56, 0.25) !important;
  transform: scale(1.25);
  transition: all 0.3s ease;
}

/* ---- Network zone labels --------------------------------- */
.cy-zone-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}

.cy-zone-label {
  position: absolute;
  transform: translate(-50%, -100%);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #a19f9d;
  background: rgba(255, 255, 255, 0.75);
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid #edebe9;
  white-space: nowrap;
}

/* ---- Cytoscape.js Palo Alto Card & Cluster Styling ------------- */
.cy-node-card {
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #edebe9;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 0.5px 1.5px rgba(0, 0, 0, 0.05);
  padding: 6px 10px;
  min-width: 120px;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.cy-node-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border-color: #0078d4;
}

.cy-node-card.cy-critical {
  border-color: #d13438;
  box-shadow: 0 0 8px rgba(209, 52, 56, 0.35);
}

.cy-node-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0078d4;
  margin-bottom: 1px;
}

.cy-node-icon svg, .cy-node-icon i {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
}

.cy-node-card.cy-external .cy-node-icon {
  color: #00b7c3;
}

.cy-node-ip {
  font-size: 11px;
  font-weight: 600;
  color: #323130;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.cy-risk-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 3px;
  line-height: 1.2;
  margin-top: 2px;
}

.cy-badge-critical {
  background: #fde8e8;
  color: #d13438;
  border: 1px solid #f8b4b4;
}

.cy-badge-high {
  background: #fff4e5;
  color: #ff8c00;
  border: 1px solid #ffe0b2;
}

.cy-badge-medium {
  background: #fff4ce;
  color: #ffb900;
  border: 1px solid #ffe1a1;
}

.cy-badge-low {
  background: #eff6fc;
  color: #0078d4;
  border: 1px solid #c7e0f4;
}

/* Side panel details for selected host */
.cy-host-details-panel {
  position: absolute;
  top: 16px;
  left: 340px;
  z-index: 50;
  background: #ffffff;
  border: 1px solid #edebe9;
  border-radius: 2px;
  box-shadow: 0 3.2px 7.2px rgba(0, 0, 0, 0.132);
  padding: 12px;
  width: 280px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.4;
  color: #323130;
}
.cy-host-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #edebe9;
}
.cy-host-details-header strong {
  font-size: 13px;
  color: #323130;
  font-weight: 600;
}
.cy-host-details-close {
  background: none;
  border: none;
  font-size: 16px;
  color: #605e5c;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cy-host-details-close:hover {
  background: #f3f2f1;
  border-radius: 2px;
  color: #323130;
}
.cy-host-detail-row {
  display: flex;
  margin-bottom: 6px;
  font-size: 12px;
}
.cy-host-detail-row .label {
  color: #605e5c;
  width: 105px;
  flex-shrink: 0;
}
.cy-host-detail-row .value {
  color: #323130;
  font-weight: 600;
}

/* Cluster popover (features-0005b): anchored near the cluster chip, with a
   fixed-height scrollable member list so large clusters (14+ IPs) scroll. */
.cy-host-details-panel.cy-popover {
  width: 280px;
  max-height: 240px;
  padding-bottom: 8px;
}
.cy-host-details-panel.cy-popover .cy-host-details-header {
  margin-bottom: 8px;
}
.cy-popover-members {
  max-height: 168px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c8c6c4 transparent;
}
.cy-popover-members::-webkit-scrollbar {
  width: 6px;
}
.cy-popover-members::-webkit-scrollbar-thumb {
  background: #c8c6c4;
  border-radius: 3px;
}
.cy-popover-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #323130;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.1s ease, color 0.1s ease;
}
.cy-popover-member:hover {
  background: #edebe9;
}
.cy-popover-member + .cy-popover-member {
  border-top: 1px solid #f3f2f1;
}
.cy-popover-member.cy-search-hit {
  background: #eff6fc;
  border: 1px solid #0078d4;
  font-weight: 600;
  color: #004578;
}
.cy-popover-member.cy-search-hit + .cy-popover-member {
  border-top-color: transparent;
}
.cy-popover-member.cy-search-miss {
  opacity: 0.45;
}
.cy-popover-match-pill {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 2px;
  background: #0078d4;
  color: #ffffff;
  margin-right: 4px;
  vertical-align: middle;
}
.cy-popover-match-count {
  color: #0078d4;
  font-weight: 600;
  font-size: 11px;
  margin-left: 6px;
}
.cy-popover-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.cy-popover-ip-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.cy-popover-ip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cy-popover-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: #8a8886;
  border-radius: 2px;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
  flex: none;
}
.cy-popover-copy-btn:hover {
  opacity: 1;
  background-color: #edebe9;
  color: #0078d4;
}
.cy-popover-copy-btn svg {
  width: 12px;
  height: 12px;
}
.cy-popover-copy-btn.copied {
  opacity: 1;
  color: #107c10;
  background-color: #dff6dd;
}
.cy-popover-copy-btn.copied .copy-icon {
  display: none !important;
}
.cy-popover-copy-btn.copied .check-icon {
  display: block !important;
}
.cy-popover-risk {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 2px;
}
.cy-popover-risk.risk-critical { background: #fde7e9; color: #d13438; }
.cy-popover-risk.risk-high { background: #fff4ce; color: #c55a11; }
.cy-popover-risk.risk-medium { background: #fff4ce; color: #b99000; }
.cy-popover-risk.risk-low { background: #eff6fc; color: #0078d4; }

/* ---- Investigation Focus Panel Overlay ------------------------------- */
/* ---- Collapsible Slide-out Sidebar Panel ------------- */
/* ---- Docked Collapsible Sidebar -------- */
.cy-docked-sidebar {
  width: 320px;
  min-width: 320px;
  height: 100%;
  background: #ffffff;
  border-right: 1px solid #edebe9;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
}

.cy-docked-sidebar.collapsed {
  width: 0;
  min-width: 0;
  margin-left: -320px;
  overflow: hidden;
  border-right: none;
}

.cy-docked-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px 16px;
  border-bottom: 1px solid #f3f2f1;
}

.cy-docked-title {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #605e5c;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.cy-docked-collapse-btn {
  background: none;
  border: none;
  color: #605e5c;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.cy-docked-collapse-btn:hover {
  background: #f3f2f1;
  color: #323130;
}
.cy-docked-collapse-btn svg, .cy-docked-collapse-btn i {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
}

.cy-docked-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cy-docked-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid #f3f2f1;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #323130;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cy-docked-row:hover {
  background: #f3f2f1;
}

.cy-docked-row.active, .cy-docked-row.selected {
  background: #eff6fc;
  border-left: 3px solid #0078d4;
  color: #0078d4;
}

.host-icon-container {
  width: 32px;
  height: 32px;
  background: #eff6fc;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.host-icon-container svg, .host-icon-container i {
  width: 16px;
  height: 16px;
  stroke: #0078d4;
  stroke-width: 2;
}

.host-ip {
  font-size: 13px;
  font-weight: 600;
  color: #323130;
  flex: 1;
}

.cy-docked-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.2;
}
.cy-docked-badge-critical {
  background: #fde7e9;
  color: #d13438;
  border: 1px solid #d13438;
}
.cy-docked-badge-high {
  background: #fff4ce;
  color: #ff8c00;
  border: 1px solid #ff8c00;
}
.cy-docked-badge-medium {
  background: #fff4ce;
  color: #ffb900;
  border: 1px solid #ffb900;
}
.cy-docked-badge-low {
  background: #eff6fc;
  color: #0078d4;
  border: 1px solid #c7e0f4;
}

.cy-docked-footer {
  padding: 12px 16px;
  border-top: 1px solid #f3f2f1;
}

.cy-docked-secondary-btn {
  width: 100%;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #c8c6c4;
  border-radius: 4px;
  color: #0078d4;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.cy-docked-secondary-btn:hover {
  background: #eff6fc;
  border-color: #0078d4;
}

.cy-docked-expand-btn {
  position: absolute;
  top: 12px;
  left: 0;
  z-index: 25;
  width: 32px;
  height: 36px;
  background: #ffffff;
  border: 1px solid #edebe9;
  border-left: none;
  border-radius: 0 4px 4px 0;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0078d4;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.cy-docked-expand-btn:hover {
  background: #0078d4;
  color: #ffffff;
}
.cy-docked-expand-btn svg, .cy-docked-expand-btn i {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
}


/* ---- features-0005: header search + layer chips ------------------------- */
.graph-head {
  flex-wrap: wrap;
  row-gap: 10px;
}
.graph-head .graph-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
}
.graph-head .graph-search svg {
  position: absolute;
  left: 8px;
  width: 14px;
  height: 14px;
  color: #a19f9d;
  pointer-events: none;
}
.graph-head .graph-search input {
  width: 190px;
  padding: 5px 10px 5px 28px;
  border: 1px solid #c8c6c4;
  border-radius: 2px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  color: #323130;
  outline: none;
  transition: border-color 0.1s ease;
}
.graph-head .graph-search input:focus {
  border-color: #0078d4;
}
.graph-head .graph-search input::placeholder {
  color: #a19f9d;
}
.graph-head .graph-legend {
  margin-top: 0;
  box-shadow: none;
}

/* ---- features-0005: node chips ------------------------------------------ */
.cy-node-chip {
  position: relative;
  gap: 2px;
  transition: opacity 0.15s ease;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.cy-node-chip.cy-moving {
  cursor: grabbing;
}
.cy-node-chip svg,
.cy-node-chip i {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}
.cy-node-chip.cy-dim {
  opacity: 0.2;
}
.cy-node-chip.cy-live,
.cy-node-chip.cy-selected {
  opacity: 1;
}
.cy-node-chip.cy-selected .cy-node-icon {
  filter: drop-shadow(0 0 5px rgba(0, 120, 212, 0.55));
}
/* subtle pin dot after a move (features-0005a) */
.cy-node-chip.cy-pinned::after {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #0078d4;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* glyph fallback: never a gray box — a neutral outlined circle carries the
   type icon until lucide renders the real glyph */
.cy-node-icon i[data-lucide]:not(.lucide) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #8a8886;
  background: #faf9f8;
  color: #605e5c;
}

.cy-node-risk-dot {
  position: absolute;
  top: -2px;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  border: 1.5px solid #ffffff;
}
.cy-node-chip.cy-search-hit {
  outline: 2px solid #0078d4;
  outline-offset: 3px;
  border-radius: 8px;
}
.cy-node-chip.cy-search-miss {
  opacity: 0.2;
}

/* risk halos on critical/high chips (always on) */
.cy-node-chip.cy-node-critical .cy-node-icon,
.cy-node-chip.cy-node-high .cy-node-icon {
  border-radius: 50%;
}
#spectra-graph-container .cy-node-chip.cy-node-critical .cy-node-icon {
  box-shadow: 0 0 0 4px rgba(209, 52, 56, 0.18);
}
#spectra-graph-container .cy-node-chip.cy-node-high .cy-node-icon {
  box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.18);
}

/* meta (cluster) chips: stacked glyph + (N) badge */
.cy-meta-chip .cy-node-icon {
  position: relative;
}
.cy-meta-chip .cy-node-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translate(3px, 3px);
  border: 1.5px solid currentColor;
  border-radius: 5px;
  opacity: 0.35;
}
.cy-meta-count {
  min-width: 16px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  background: currentColor;
  border-radius: 9px;
  padding: 0 5px;
  line-height: 15px;
  letter-spacing: 0.02em;
}

/* hide IP labels when zoomed far out (zoom event toggles .zoom-low) */
#spectra-graph-container.zoom-low .cy-node-ip {
  display: none;
}
#spectra-graph-container.zoom-low .cy-meta-count {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .cy-node-chip {
    transition: none;
  }
}


/* ---- MITRE ATT&CK UI --------------------------------------- */
.view-tabs {
  display: flex;
  gap: 4px;
  margin: 20px 0 0;
  border-bottom: 1px solid #edebe9;
}
.view-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #605e5c;
  cursor: pointer;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.1s ease, border-color 0.1s ease;
}
.view-tab:hover { color: #323130; }
.view-tab.active {
  color: #0078d4;
  border-bottom-color: #0078d4;
}
.view-tab-count {
  background: #deecf9;
  color: #0078d4;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 0 7px;
  line-height: 16px;
}
.attack-version {
  font-size: 11px;
  color: #605e5c;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
}

.view-panel {
  min-width: 0;
  max-width: 100%;
}

.attack-matrix-wrap {
  overflow-x: auto;
  padding: 16px;
  max-width: 100%;
  box-sizing: border-box;
}
.attack-matrix {
  display: flex;
  gap: 8px;
  min-width: max-content;
  align-items: stretch;
}
.matrix-col {
  display: flex;
  flex-direction: column;
  width: 176px;
  flex-shrink: 0;
}
.matrix-col-head {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #323130;
  background: #f3f2f1;
  border: 1px solid #edebe9;
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  min-height: 58px;
  display: flex;
  align-items: center;
}
.matrix-col-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #edebe9;
  border-radius: 0 0 2px 2px;
  flex: 1;
}

/* ---- matrix rows ----------- */
.mitre-controls {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 2px 10px;
  font-size: 12px;
  color: #605e5c;
  background: #ffffff;
  z-index: 2;
}
.mitre-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}
.mitre-controls input[type="checkbox"] { accent-color: #0078d4; margin: 0; }
.mitre-controls .mbtn {
  appearance: none;
  background: transparent;
  border: 1px solid #c8c6c4;
  color: #323130;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 2px;
  cursor: pointer;
}
.mitre-controls .mbtn:hover { border-color: #0078d4; color: #0078d4; }

.tech {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
  padding: 2px 6px;
  border: 1px solid #e1dfdd;
  border-radius: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: #605e5c;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.1s ease, background 0.1s ease;
}
.tech:hover { border-color: #0078d4; background: #f0f6fc; color: #323130; }
.tech.sub { margin-left: 16px; border-left: 2px solid #c8c6c4; font-size: 11px; }
.tech.dim { opacity: 0.55; }
.tech.dim:hover { opacity: 1; }
.tech.matched {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 8%, #ffffff);
  color: #323130;
  font-weight: 600;
}
.tech .name { min-width: 0; }
.tech.pulse {
  animation: mitre-pulse 1.2s ease 2;
}
.twist {
  appearance: none;
  border: 0;
  background: none;
  padding: 0 2px;
  color: #a19f9d;
  font-size: 11px;
  cursor: pointer;
  flex: none;
  line-height: 1;
}
.twist:hover { color: #0078d4; }
.twist-spacer { display: inline-block; width: 14px; flex: none; }
.badge {
  margin-left: auto;
  flex: none;
  min-width: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--c, #888);   /* unknown severity => grey, never green */
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
}
.tech.has-badge { border-style: dashed; border-width: 1px; }
.count {
  margin-left: auto;
  flex: none;
  min-width: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--c, #888);   /* unknown severity => grey, never green */
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
  text-align: center;
}
.sev-critical, .conf-critical { --c: var(--pal-critical); }
.sev-high,     .conf-high     { --c: var(--pal-high); }
.sev-medium,   .conf-medium   { --c: var(--pal-medium); }
.sev-low,      .conf-low      { --c: var(--pal-low); }
@keyframes mitre-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 120, 212, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(0, 120, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 120, 212, 0); }
}

/* agg-meta chips */
.mitre-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.mitre-chip {
  appearance: none;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid;
  background: #ffffff;
  cursor: pointer;
  line-height: 18px;
  transition: background 0.1s ease, transform 0.05s ease;
}
.mitre-chip:hover { transform: translateY(-1px); }
.mitre-chip:active { transform: translateY(0); }
.mitre-chip.mitre-high { color: #107c10; border-color: #107c10; background: #f4faf4; }
.mitre-chip.mitre-medium { color: #986f0b; border-color: #986f0b; background: #fffaf0; }
.mitre-chip.mitre-low { color: #0078d4; border-color: #0078d4; background: #f0f6fc; }
.mitre-chip.pulse {
  animation: mitre-pulse 1.2s ease 2;
}

/* shared interactive ATT&CK popover */
#attack-tip {
  position: fixed;
  z-index: 1000;
  max-width: 340px;
  padding: 10px 12px;
  background: #20242a;
  color: #e8e8e8;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 4px;
  box-shadow: 0 3.2px 7.2px rgba(0, 0, 0, 0.132);
  pointer-events: auto;          /* the whole point: hoverable, clickable */
}
#attack-tip[hidden] { display: none; }
#attack-tip code {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
}
#attack-tip .conf, #attack-tip .sev {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
  text-transform: uppercase;
  border-radius: 8px;
  padding: 0 6px;
  margin-left: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: var(--c, #888);   /* unknown value => grey, never green */
  color: #ffffff;
}
#attack-tip .t-name { margin: 3px 0 6px; font-size: 12.5px; opacity: 0.92; }
#attack-tip .t-row span {
  color: #9ab;
  margin-right: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#attack-tip .t-row { margin-top: 3px; }
#attack-tip .t-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}
#attack-tip a, #attack-tip button {
  color: #4cf;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
  text-decoration: none;
}
#attack-tip a:hover, #attack-tip button:hover { text-decoration: underline; }
