/* ======================================================================
   ATLAS — Network Topology Engine
   Design: GitHub Dark default with 10 switchable themes
   ====================================================================== */

:root {
  /* Core palette — GitHub Dark (default) */
  --bg-deep:      #0d1117;
  --bg-surface:   #161b22;
  --bg-elevated:  #1c2128;
  --bg-hover:     #272d36;
  --border:       #30363d;
  --border-light: #484f58;

  /* Text */
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #6e7681;

  /* Accent — Blue */
  --accent:         #58a6ff;
  --accent-dim:     #1f6feb;
  --accent-glow:    rgba(88, 166, 255, 0.15);
  --accent-glow-strong: rgba(88, 166, 255, 0.3);

  /* Status */
  --green:  #3fb950;
  --red:    #f85149;
  --amber:  #d29922;
  --blue:   #58a6ff;

  /* Topology node/edge */
  --node-fill:    #1c2128;
  --node-border:  #58a6ff;
  --edge-color:   #484f58;

  /* Sizing */
  --topbar-h:     56px;
  --detail-w:     380px;
  --radius:       8px;
  --radius-sm:    5px;
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Utility ───────────────────────────────────────────────────────── */
/* Monospace size helpers — replaces repeated inline style declarations */
.mono-sm  { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.mono-md  { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; }
.mono-lg  { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }

/* ── Top Bar ───────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-tabs {
  display: flex;
  gap: 2px;
  margin-left: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.topbar-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.topbar-tab:hover {
  color: var(--text-secondary);
}

.topbar-tab.active {
  background: var(--accent-dim);
  color: #ffffff;
}

/* Tab views */
.tab-view {
  display: none;
  width: 100%;
  height: 100%;
}

.tab-view.active {
  display: flex;
}

.topbar-logo {
  width: 28px;
  height: 28px;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.topbar-subtitle {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding-right: 12px;
  border-right: 1px solid var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.status-dot.live {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.status-dot.collecting {
  background: var(--amber);
  animation: pulse 1s infinite;
}

.status-dot.error {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--accent-dim);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg-deep);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.btn-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ── Main Layout ───────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* ── Topology Container ────────────────────────────────────────────── */
.topology-container {
  flex: 1;
  position: relative;
}

.topology-canvas {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* ── Empty State ───────────────────────────────────────────────────── */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  max-width: 320px;
}

.empty-state.hidden { display: none; }

/* ── Topology Toolbar ──────────────────────────────────────────────── */
.topo-toolbar {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  z-index: 20;
}

.topo-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.topo-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
}
.topo-btn svg {
  width: 18px;
  height: 18px;
}

.topo-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
}

/* ── Detail Panel ──────────────────────────────────────────────────── */
.detail-panel {
  width: var(--detail-w);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 50;
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 60;
  transition: background 0.15s;
}

.detail-resize-handle:hover,
.detail-resize-handle.active {
  background: var(--accent);
  opacity: 0.5;
}

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

.detail-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* Detail content blocks */
.detail-section {
  margin-bottom: 20px;
}

.detail-section h4 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

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

.detail-label {
  color: var(--text-secondary);
  font-weight: 400;
}

.detail-value {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
}

.detail-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

.detail-badge.green { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.detail-badge.amber { background: rgba(251, 191, 36, 0.15); color: var(--amber); }
.detail-badge.cyan  { background: var(--accent-glow); color: var(--accent); }
.detail-badge.red   { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.detail-badge.blue  { background: rgba(99, 179, 237, 0.15); color: var(--blue); }
.detail-badge.pink  { background: rgba(236, 130, 196, 0.15); color: #ec84c4; }
.detail-badge.brown { background: rgba(232, 154, 114, 0.18); color: #e89a72; }

/* Prefix list in detail panel */
.prefix-list {
  list-style: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
}

.prefix-list li {
  padding: 4px 0;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.prefix-list li:last-child { border-bottom: none; }

.prefix-metric {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-left: 8px;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Loading spinner on collect ────────────────────────────────────── */
.btn.loading .btn-icon {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Path Analysis Bar ─────────────────────────────────────────────── */
.path-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
  z-index: 90;
}

.svc-trace-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--accent-dim);
  padding: 10px 20px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
  z-index: 90;
}

.svc-trace-input {
  padding: 6px 10px !important;
  appearance: auto !important;
  cursor: text !important;
}

/* ── Label color legend ── */
.label-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 4px 0 10px;
}

.label-legend-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-right: 2px;
}

.prefix-autocomplete-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prefix-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 200px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 9999;
}

.prefix-autocomplete-item {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.prefix-autocomplete-item:hover,
.prefix-autocomplete-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.prefix-autocomplete-empty {
  padding: 8px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.path-bar-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.path-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.path-select {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 10px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23536580' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  min-width: 140px;
  transition: border-color 0.2s;
}

.path-select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.path-bar-arrow {
  display: flex;
  align-items: center;
  padding-bottom: 2px;
  color: var(--text-muted);
}

.path-bar-arrow svg {
  width: 20px;
  height: 20px;
}

.path-bar-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  margin: 0 4px;
  align-self: flex-end;
  margin-bottom: 4px;
}

/* ── Path Result Summary ───────────────────────────────────────────── */
.path-result-banner {
  background: var(--accent-glow);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.path-result-banner.failure {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.2);
}

.path-result-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.path-result-text {
  font-size: 0.82rem;
  color: var(--text-primary);
}

.path-result-text strong {
  color: var(--accent);
}

.path-result-banner.failure .path-result-text strong {
  color: var(--red);
}

/* Path hop list */
.path-hops {
  list-style: none;
  position: relative;
}

.path-hops::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--accent-dim);
}

.path-hop {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}

.path-hop-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  flex-shrink: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.path-hop-dot.source { background: var(--accent); }
.path-hop-dot.dest   { background: var(--green); border-color: var(--green); }
.path-hop-dot.failed { background: var(--red); border-color: var(--red); }

.path-hop-dot-inner {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bg-deep);
}

.path-hop-info {
  flex: 1;
  min-width: 0;
}

.path-hop-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.path-hop-detail {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.path-hop-label {
  display: inline-block;
  background: var(--accent-glow);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 3px;
  margin-top: 3px;
}

/* ── Backup Path Section ───────────────────────────────────────────── */
.backup-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.backup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 6px 0;
}

.backup-header h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 0;
}

.backup-toggle {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.backup-body {
  display: none;
  padding-top: 8px;
}

.backup-body.open {
  display: block;
}

.backup-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.backup-item-header {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.backup-item-header strong {
  color: var(--red);
}

.backup-item-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent);
}

.backup-item-unreachable {
  font-size: 0.78rem;
  color: var(--red);
  font-style: italic;
}

/* ── Reachability Table ────────────────────────────────────────────── */
.reach-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reach-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.reach-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.reach-row.expanded {
  border-color: var(--accent-dim);
  background: var(--bg-hover);
}

.reach-shield {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reach-shield svg {
  width: 16px;
  height: 16px;
}

.reach-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.reach-hostname {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.reach-sid {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
}

.reach-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.reach-expand {
  display: none;
  padding: 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  margin-top: -3px;
  margin-bottom: 2px;
}

.reach-expand.open {
  display: block;
}

.reach-expand-section {
  margin-bottom: 10px;
}

.reach-expand-section:last-child {
  margin-bottom: 0;
}

.reach-expand-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.reach-path-chain {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent);
}

.reach-label-stack {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.reach-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.reach-loading {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 12px 0;
  text-align: center;
}

/* ── CLI Panel ─────────────────────────────────────────────────────── */
.cli-section {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.cli-input-row {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
}

.cli-input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  outline: none;
}

.cli-input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.cli-input::placeholder {
  color: var(--text-muted);
}

.cli-format-select {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  outline: none;
  width: 55px;
  text-align: center;
  appearance: none;
}

.cli-run-btn {
  background: var(--accent-dim);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 4px 14px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: background 0.15s;
}

.cli-run-btn:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg-deep);
}

.cli-run-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cli-quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.cli-quick-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  align-self: center;
  margin-right: 4px;
}

.cli-quick-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  padding: 2px 7px;
  cursor: pointer;
  transition: all 0.1s;
}

.cli-quick-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.cli-output {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px 12px;
}

.cli-output-empty {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  padding-top: 40px;
}

.cli-output pre {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.cli-output-error {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--red);
}

.cli-output-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

/* ── Devices Page ──────────────────────────────────────────────────── */
.devices-page {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 28px;
  overflow-y: auto;
  height: 100%;
}

.devices-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.devices-toolbar-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.devices-heading {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.devices-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.devices-toolbar-right {
  display: flex;
  gap: 6px;
}

/* Device Table */
.devices-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 20px;
}

.devices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.devices-table thead th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  white-space: nowrap;
}

.devices-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  white-space: nowrap;
}

.devices-table tbody tr:hover {
  background: var(--bg-elevated);
}

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

.devices-empty {
  display: none;
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.devices-empty.visible {
  display: block;
}

/* Status badges in table */
.dev-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
}

.dev-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.dev-status-dot.ok { background: var(--green); box-shadow: 0 0 5px var(--green); }
.dev-status-dot.fail { background: var(--red); }
.dev-status-dot.testing { background: var(--amber); animation: pulse 1s infinite; }

/* Action buttons in table */
.dev-actions {
  display: flex;
  gap: 5px;
}

.dev-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.1s;
}

.dev-action-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.dev-action-btn.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

.dev-visibility-btn {
  font-size: 0.78rem;
  padding: 2px 6px;
}

.dev-visibility-btn.hidden-from-topo {
  opacity: 0.45;
}

/* Add Device Form */
.devices-add-section,
.devices-import-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.devices-add-section h3,
.devices-import-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text-primary);
}

.devices-add-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.devices-add-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.devices-add-form .form-group label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.devices-add-form .form-group input {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  outline: none;
  width: 130px;
}

.devices-add-form .form-group.form-group-sm input {
  width: 65px;
}

.devices-add-form .form-group input:focus {
  border-color: var(--accent-dim);
}

.devices-add-error {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--red);
  margin-top: 8px;
}

/* Bulk Import Dropzone */
.devices-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.devices-dropzone:hover,
.devices-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.dropzone-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dropzone-browse {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.devices-import-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  margin-top: 8px;
}

.devices-import-status.success { color: var(--green); }
.devices-import-status.error { color: var(--red); }

/* ── Device Detail View ────────────────────────────────────────────── */
.dev-row-clickable { cursor: pointer; }

.device-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.device-detail-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-detail-identity h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.device-detail-host {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.device-detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.device-detail-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.device-detail-tab:hover {
  color: var(--text-secondary);
}

.device-detail-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

/* Info cards grid */
.device-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.device-info-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.device-info-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.device-info-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Running config viewer */
.device-config-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.device-config-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  gap: 8px;
  flex-wrap: wrap;
}

.device-config-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.device-config-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.device-config-body {
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px 16px;
}

/* ── Flash Navigator ───────────────────────────────────────────────── */
.flash-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.flash-breadcrumb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.flash-crumb {
  transition: color 0.1s;
}

.flash-crumb:hover {
  color: var(--accent);
}

.flash-crumb-root {
  font-weight: 600;
  color: var(--text-primary);
}

.flash-listing {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 60vh;
  overflow-y: auto;
}

.flash-table tbody tr:hover {
  background: var(--bg-elevated);
}

.flash-dir-row td {
  color: var(--accent) !important;
}

/* ── SSH Terminal ──────────────────────────────────────────────────── */
.ssh-wrapper {
  display: flex;
  flex-direction: column;
  height: 70vh;
}

.ssh-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.ssh-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ssh-terminal {
  flex: 1;
  background: var(--bg-deep);
  padding: 8px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.ssh-terminal .xterm {
  height: 100%;
}

/* ── Context Menu ──────────────────────────────────────────────────── */
.ctx-menu {
  position: fixed;
  z-index: 1000;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 4px 0;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
}

.ctx-menu-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 14px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.1s;
}

.ctx-menu-item:hover {
  background: var(--accent-glow);
  color: var(--text-primary);
}

.ctx-icon {
  font-size: 0.75rem;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.ctx-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 3px 0;
}

/* ── BGP Page ─────────────────────────────────────────────────────── */
.bgp-page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  overflow-y: auto;
  height: 100%;
}

.bgp-status-section {
  margin-bottom: 28px;
}

.bgp-status-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.bgp-status-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.bgp-status-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.bgp-status-value {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.bgp-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.bgp-dot.ok { background: var(--green); }
.bgp-dot.fail { background: var(--red); }
.bgp-dot.warn { background: var(--amber); }

.bgp-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 10px 0;
}

.bgp-neighbors-section {
  margin-top: 16px;
}

.bgp-neighbors-section .devices-table {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Settings */
.bgp-settings-section {
  margin-bottom: 28px;
}

.bgp-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .bgp-settings-grid {
    grid-template-columns: 1fr;
  }
}

.bgp-settings-form {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.bgp-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.bgp-form-row .form-group {
  flex: 1;
  min-width: 140px;
}

.bgp-form-row .form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.bgp-form-row .form-group input {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.bgp-form-row .form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Neighbor rows */
.bgp-neighbor-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.bgp-neighbor-row input {
  flex: 1;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.bgp-neighbor-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.bgp-nbr-addr { flex: 2 !important; }
.bgp-nbr-desc { flex: 3 !important; }

.bgp-nbr-remove {
  color: var(--red);
  padding: 4px 8px;
  font-size: 0.72rem;
}

/* AFI toggles */
.bgp-afi-toggles {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.bgp-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.bgp-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* Form actions */
.bgp-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.bgp-deploy-status {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.bgp-deploy-status.success { color: var(--green); }
.bgp-deploy-status.error { color: var(--red); }
.bgp-deploy-status.warn { color: var(--amber); }

/* Preview panel */
.bgp-preview-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.bgp-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.bgp-preview-header .bgp-section-title {
  margin: 0;
}

.bgp-preview-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-secondary);
  padding: 16px;
  margin: 0;
  overflow: auto;
  max-height: 500px;
  white-space: pre;
  background: var(--bg-deep);
}

/* ── VRF Section ──────────────────────────────────────────────────── */
.bgp-vrf-section {
  margin-bottom: 28px;
}

.bgp-vrf-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.bgp-vrf-row {
  cursor: pointer;
  transition: background 0.15s;
}

.bgp-vrf-row:hover {
  background: var(--bg-hover);
}

.bgp-vrf-row.expanded {
  background: var(--bg-elevated);
}

.bgp-vrf-chevron {
  width: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  user-select: none;
}

.bgp-vrf-expand > td {
  padding: 0 !important;
  border-top: none !important;
}

.bgp-vrf-detail {
  padding: 12px 16px 16px;
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
}

.bgp-prefix-table {
  font-size: 0.78rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.bgp-prefix-table thead th {
  font-size: 0.65rem;
}

.bgp-prefix-table tbody td {
  padding: 6px 12px;
}

.bgp-vrf-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.bgp-vrf-search-input {
  flex: 1;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.bgp-vrf-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.bgp-vrf-search-input::placeholder {
  color: var(--text-muted);
}

/* Prefix row click-to-expand */
.bgp-pfx-row {
  cursor: pointer;
  transition: background 0.15s;
}

.bgp-pfx-row:hover {
  background: var(--bg-hover);
}

.bgp-pfx-row.expanded {
  background: var(--bg-elevated);
}

.bgp-pfx-expand > td {
  padding: 0 !important;
  border-top: none !important;
}

.bgp-pfx-detail-body {
  padding: 12px 16px 16px;
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
}

/* Path detail card */
.bgp-path-detail {
  margin-bottom: 12px;
}

.bgp-path-detail:last-child {
  margin-bottom: 0;
}

.bgp-path-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.bgp-path-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 800px) {
  .bgp-path-grid {
    grid-template-columns: 1fr;
  }
}

.bgp-path-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

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

.bgp-path-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.bgp-path-value {
  font-size: 0.75rem;
  color: var(--text-primary);
  text-align: right;
  word-break: break-all;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: flex-end;
}

/* ── Service Path Trace Picker ────────────────────────────────────── */
.trace-picker {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 200;
  background: var(--bg-surface);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  min-width: 280px;
}

.trace-picker-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.trace-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trace-picker-row label {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.trace-picker-select {
  flex: 1;
  padding: 5px 8px;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.trace-picker-select:focus {
  border-color: var(--accent);
}

.btn-trace-svc {
  font-size: 0.68rem !important;
  white-space: nowrap;
  color: var(--accent) !important;
}

/* ── Searchable Combobox ─────────────────────────────────────────── */
.combo-container {
  position: relative;
  display: inline-block;
}

.combo-input {
  width: 100%;
}

.combo-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--bg-surface);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 2px;
  min-width: 160px;
}

.combo-dropdown.open {
  display: block;
}

.combo-option {
  padding: 6px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-option:hover,
.combo-option.combo-highlighted {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.combo-option.combo-selected {
  color: var(--accent);
}

.combo-empty {
  padding: 8px 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.combo-count {
  padding: 4px 10px;
  font-size: 0.62rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* sFlow / Flows Tab                                                          */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* Generic badge */
.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.badge-algo {
  background: rgba(236, 130, 196, 0.15);
  color: #ec84c4;
}

/* Topology toolbar active button */
.topo-btn-active {
  background: var(--accent-glow) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* Utility text classes */
.text-warn { color: var(--red); }
.text-amber { color: var(--amber); }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* sFlow LSP row hover */
.sflow-lsp-row {
  cursor: pointer;
  transition: background 0.15s;
}
.sflow-lsp-row:hover {
  background: rgba(34, 211, 238, 0.06);
}

/* Detail panel — mini table for top talkers */
.detail-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  margin-top: 6px;
}
.detail-mini-table th {
  text-align: left;
  padding: 4px 8px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-mini-table td {
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}
.detail-mini-table tr:last-child td {
  border-bottom: none;
}

.detail-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Input field for sFlow config form */
.input-field {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
}
.input-field:focus {
  outline: none;
  border-color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════════
   THEMES — override :root variables via [data-theme] on <html>
   GitHub Dark is the default (:root). 5 dark + 5 light themes below.
   ══════════════════════════════════════════════════════════════════════ */

/* ━━━━━━━━━━━━━━━━━━━ DARK THEMES ━━━━━━━━━━━━━━━━━━━ */

/* ── Nord — Cool blue-gray with frost accents (VS Code Nord) ── */
[data-theme="nord"] {
  --bg-deep:      #2e3440;
  --bg-surface:   #3b4252;
  --bg-elevated:  #434c5e;
  --bg-hover:     #4c566a;
  --border:       #4c566a;
  --border-light: #616e88;

  --text-primary:   #eceff4;
  --text-secondary: #d8dee9;
  --text-muted:     #7b88a1;

  --accent:             #88c0d0;
  --accent-dim:         #5e81ac;
  --accent-glow:        rgba(136, 192, 208, 0.15);
  --accent-glow-strong: rgba(136, 192, 208, 0.3);

  --green: #a3be8c;  --red: #bf616a;  --amber: #ebcb8b;  --blue: #81a1c1;

  --node-fill:    #3b4252;
  --node-border:  #88c0d0;
  --edge-color:   #616e88;
}

/* ── Dracula — Purple-tinted dark with vibrant accents (VS Code Dracula) ── */
[data-theme="dracula"] {
  --bg-deep:      #21222c;
  --bg-surface:   #282a36;
  --bg-elevated:  #343746;
  --bg-hover:     #3c3f52;
  --border:       #44475a;
  --border-light: #565970;

  --text-primary:   #f8f8f2;
  --text-secondary: #c0bfcc;
  --text-muted:     #6272a4;

  --accent:             #bd93f9;
  --accent-dim:         #7c5cbf;
  --accent-glow:        rgba(189, 147, 249, 0.15);
  --accent-glow-strong: rgba(189, 147, 249, 0.3);

  --green: #50fa7b;  --red: #ff5555;  --amber: #f1fa8c;  --blue: #8be9fd;

  --node-fill:    #343746;
  --node-border:  #bd93f9;
  --edge-color:   #565970;
}

/* ── Midnight — Dark navy with cyan accents (the OG ATLAS theme) ── */
[data-theme="midnight"] {
  --bg-deep:      #0d1220;
  --bg-surface:   #151d2e;
  --bg-elevated:  #1e293b;
  --bg-hover:     #273449;
  --border:       #334155;
  --border-light: #475569;

  --text-primary:   #e8edf5;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --accent:             #22d3ee;
  --accent-dim:         #0e7490;
  --accent-glow:        rgba(34, 211, 238, 0.15);
  --accent-glow-strong: rgba(34, 211, 238, 0.3);

  --green: #34d399;  --red: #f87171;  --amber: #fbbf24;  --blue: #63b3ed;

  --node-fill:    #1e3a5f;
  --node-border:  #22d3ee;
  --edge-color:   #475569;
}

/* ── Monokai — Warm dark with cyan accents (VS Code Monokai) ── */
[data-theme="monokai"] {
  --bg-deep:      #1e1f1c;
  --bg-surface:   #272822;
  --bg-elevated:  #32332c;
  --bg-hover:     #3e3f37;
  --border:       #525449;
  --border-light: #696b5e;

  --text-primary:   #f8f8f2;
  --text-secondary: #c0c0b0;
  --text-muted:     #75715e;

  --accent:             #66d9ef;
  --accent-dim:         #3a7a8a;
  --accent-glow:        rgba(102, 217, 239, 0.15);
  --accent-glow-strong: rgba(102, 217, 239, 0.3);

  --green: #a6e22e;  --red: #f92672;  --amber: #fd971f;  --blue: #66d9ef;

  --node-fill:    #3b3c31;
  --node-border:  #66d9ef;
  --edge-color:   #696b5e;
}

/* ── Arista Dark — Official Arista Networks brand palette ── */
[data-theme="arista-dark"] {
  --bg-deep:      #0c1a30;
  --bg-surface:   #132340;
  --bg-elevated:  #1a2d4d;
  --bg-hover:     #23395e;
  --border:       #2d4470;
  --border-light: #3d5a8a;

  --text-primary:   #e8ecf2;
  --text-secondary: #96a7bf;
  --text-muted:     #5f7a9a;

  --accent:             #4473a9;
  --accent-dim:         #16325b;
  --accent-glow:        rgba(68, 115, 169, 0.18);
  --accent-glow-strong: rgba(68, 115, 169, 0.35);

  --green: #aad037;  --red: #f87171;  --amber: #e9d554;  --blue: #4473a9;

  --node-fill:    #16325b;
  --node-border:  #4473a9;
  --edge-color:   #3d5a8a;
}

/* ━━━━━━━━━━━━━━━━━━━ LIGHT THEMES ━━━━━━━━━━━━━━━━━━━ */

/* ── Horizon — Clean white with slate blue accents ── */
[data-theme="horizon"] {
  --bg-deep:      #f1f5f9;
  --bg-surface:   #ffffff;
  --bg-elevated:  #f8fafc;
  --bg-hover:     #e2e8f0;
  --border:       #cbd5e1;
  --border-light: #94a3b8;

  --text-primary:   #1e293b;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  --accent:             #0284c7;
  --accent-dim:         #0369a1;
  --accent-glow:        rgba(2, 132, 199, 0.1);
  --accent-glow-strong: rgba(2, 132, 199, 0.2);

  --green:  #16a34a;  --red: #dc2626;  --amber: #d97706;  --blue: #2563eb;

  --node-fill:    #dbeafe;
  --node-border:  #0284c7;
  --edge-color:   #94a3b8;
}

/* ── Solarized — Warm cream with teal accents (Solarized Light) ── */
[data-theme="solarized"] {
  --bg-deep:      #fdf6e3;
  --bg-surface:   #eee8d5;
  --bg-elevated:  #f5efdc;
  --bg-hover:     #e8e0c8;
  --border:       #d4c9a8;
  --border-light: #b0a68a;

  --text-primary:   #073642;
  --text-secondary: #586e75;
  --text-muted:     #93a1a1;

  --accent:             #2aa198;
  --accent-dim:         #1a7a72;
  --accent-glow:        rgba(42, 161, 152, 0.12);
  --accent-glow-strong: rgba(42, 161, 152, 0.22);

  --green:  #859900;  --red: #dc322f;  --amber: #b58900;  --blue: #268bd2;

  --node-fill:    #e0dbc5;
  --node-border:  #2aa198;
  --edge-color:   #b0a68a;
}

/* ── GitHub — Pure white with crisp blue accents ── */
[data-theme="github"] {
  --bg-deep:      #f6f8fa;
  --bg-surface:   #ffffff;
  --bg-elevated:  #f6f8fa;
  --bg-hover:     #eaeef2;
  --border:       #d0d7de;
  --border-light: #afb8c1;

  --text-primary:   #1f2328;
  --text-secondary: #656d76;
  --text-muted:     #8b949e;

  --accent:             #0969da;
  --accent-dim:         #0550ae;
  --accent-glow:        rgba(9, 105, 218, 0.1);
  --accent-glow-strong: rgba(9, 105, 218, 0.2);

  --green:  #1a7f37;  --red: #cf222e;  --amber: #bf8700;  --blue: #0969da;

  --node-fill:    #ddf4ff;
  --node-border:  #0969da;
  --edge-color:   #afb8c1;
}

/* ── Quiet — Soft warm white with purple accents ── */
[data-theme="quiet"] {
  --bg-deep:      #f5f3f7;
  --bg-surface:   #fdfcfe;
  --bg-elevated:  #f5f3f7;
  --bg-hover:     #ebe7f0;
  --border:       #d6d0de;
  --border-light: #b5acbf;

  --text-primary:   #2d2640;
  --text-secondary: #5e5573;
  --text-muted:     #9a90ab;

  --accent:             #7c3aed;
  --accent-dim:         #6d28d9;
  --accent-glow:        rgba(124, 58, 237, 0.1);
  --accent-glow-strong: rgba(124, 58, 237, 0.2);

  --green:  #16a34a;  --red: #dc2626;  --amber: #d97706;  --blue: #6366f1;

  --node-fill:    #ede9fe;
  --node-border:  #7c3aed;
  --edge-color:   #b5acbf;
}

/* ── Sand — Warm beige with earthy brown/amber accents ── */
[data-theme="sand"] {
  --bg-deep:      #f5f0e8;
  --bg-surface:   #faf8f4;
  --bg-elevated:  #f0ebe1;
  --bg-hover:     #e5ddd0;
  --border:       #d1c5b4;
  --border-light: #b5a68f;

  --text-primary:   #2c2418;
  --text-secondary: #5e5240;
  --text-muted:     #998a74;

  --accent:             #b45309;
  --accent-dim:         #92400e;
  --accent-glow:        rgba(180, 83, 9, 0.1);
  --accent-glow-strong: rgba(180, 83, 9, 0.2);

  --green:  #16a34a;  --red: #dc2626;  --amber: #d97706;  --blue: #0284c7;

  --node-fill:    #e8dcc8;
  --node-border:  #b45309;
  --edge-color:   #b5a68f;
}

/* ── Arista Light — Official Arista Networks brand palette ── */
[data-theme="arista-light"] {
  --bg-deep:      #eef2f6;
  --bg-surface:   #ffffff;
  --bg-elevated:  #f4f6f9;
  --bg-hover:     #e2e8f0;
  --border:       #c8d2df;
  --border-light: #96a7bf;

  --text-primary:   #16325b;
  --text-secondary: #3d5478;
  --text-muted:     #738a96;

  --accent:             #146095;
  --accent-dim:         #16325b;
  --accent-glow:        rgba(20, 96, 149, 0.1);
  --accent-glow-strong: rgba(20, 96, 149, 0.2);

  --green: #5a8c1a;  --red: #c82828;  --amber: #b8860b;  --blue: #146095;

  --node-fill:    #d6e3f0;
  --node-border:  #146095;
  --edge-color:   #96a7bf;
}

/* ── Login Overlay ──────────────────────────────────────────────────── */
.login-overlay, .modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 36px 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.login-logo {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.08em;
}

.login-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-field {
  text-align: left;
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-field input {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  font-size: 0.88rem;
}

.login-error {
  background: rgba(248, 81, 73, 0.12);
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.78rem;
  margin-bottom: 14px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

.login-github-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-github-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

/* ── User Badge ────────────────────────────────────────────────────── */
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-elevated);
  font-size: 0.78rem;
}

.user-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.user-badge-name {
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
}

.user-badge-role {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-signout {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
}

.btn-signout:hover {
  color: var(--red);
}

/* ── Mgmt Tab ──────────────────────────────────────────────────────── */
.mgmt-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.mgmt-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.mgmt-tab:hover {
  color: var(--text-secondary);
}

.mgmt-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.mgmt-panel {
  display: none;
}

.mgmt-panel.active {
  display: block;
}

/* ── Theme Picker ───────────────────────────────────────────────────── */
.theme-picker {
  position: relative;
}

.theme-picker-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.theme-picker-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.theme-picker-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.theme-picker-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 9999;
  padding: 4px 0;
}

.theme-picker-dropdown.open {
  display: block;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: background 0.1s, color 0.1s;
}

.theme-option:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-option.active {
  color: var(--accent);
  font-weight: 600;
}

.theme-option-swatch {
  display: flex;
  gap: 2px;
  border-radius: 3px;
  overflow: hidden;
}

.theme-option-swatch span {
  width: 10px;
  height: 18px;
}
