/* ============================================================
   STYLE.CSS — Component styles for Arch Explorer
   ============================================================ */

/* ── App Shell ─────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.sidebar-logo {
  padding: var(--space-5) var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo svg {
  flex-shrink: 0;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.03em;
  font-family: var(--font-mono);
}

.sidebar-section-label {
  padding: var(--space-4) var(--space-4) var(--space-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0;
  transition: background 150ms var(--ease-out),
              color 150ms var(--ease-out);
  position: relative;
  user-select: none;
  margin: 1px var(--space-2);
  border-radius: var(--radius-md);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--avi-surface);
  color: var(--color-aviatrix);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  background: var(--color-aviatrix);
  border-radius: 0 2px 2px 0;
  margin-left: -8px;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.sidebar-footer-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-raised);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

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

.status-text {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── Main content ──────────────────────────────────────── */
#main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#topbar {
  height: var(--header-h);
  min-height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.topbar-breadcrumb span {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-sep {
  color: var(--border-strong);
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: background 150ms, color 150ms;
  margin-right: var(--space-2);
}
.theme-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
[data-theme="light"] .theme-icon-sun { display: none !important; }
[data-theme="light"] .theme-icon-moon { display: block !important; }

.topbar-tags {
  margin-left: auto;
  display: flex;
  gap: var(--space-2);
}

.tag {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: 500;
  letter-spacing: 0.03em;
  border: 1px solid;
}

.tag-aws    { color: var(--color-aws);    background: var(--aws-surface);   border-color: rgba(255,149,0,0.25); }
.tag-azure  { color: var(--color-azure);  background: var(--azure-surface); border-color: rgba(0,120,212,0.25); }
.tag-gcp    { color: var(--color-gcp);    background: var(--gcp-surface);   border-color: rgba(52,168,83,0.25); }
.tag-avi    { color: var(--color-aviatrix); background: var(--avi-surface); border-color: rgba(0,180,216,0.25); }

#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.section {
  display: none;
  animation: fadeIn 200ms var(--ease-out);
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Section layouts ───────────────────────────────────── */
.section-header {
  padding: var(--space-8) var(--space-8) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.section-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--space-2);
}

.section-subtitle {
  font-size: var(--text-md);
  color: var(--text-secondary);
  font-weight: 400;
}

.section-body {
  padding: var(--space-6) var(--space-8);
}

/* ── Diagram container ─────────────────────────────────── */
.diagram-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.diagram-title-bar {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-raised);
}

.diagram-title-bar h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.diagram-badge {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.diagram-svg-area {
  padding: var(--space-4);
  overflow: visible;
}

/* ── Info panels ───────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.info-grid-3col {
  grid-template-columns: repeat(3, 1fr) !important;
}
@media (max-width: 900px) {
  .info-grid-3col { grid-template-columns: 1fr !important; }
}

.info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color 180ms var(--ease-out),
              background 180ms var(--ease-out);
}

.info-card:hover {
  border-color: var(--border-default);
  background: var(--bg-raised);
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.info-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-aws   { background: var(--aws-surface);   color: var(--color-aws);    border: 1px solid rgba(255,149,0,0.25); }
.icon-azure { background: var(--azure-surface); color: var(--color-azure);  border: 1px solid rgba(0,120,212,0.25); }
.icon-gcp   { background: var(--gcp-surface);   color: var(--color-gcp);    border: 1px solid rgba(52,168,83,0.25); }
.icon-avi   { background: var(--avi-surface);   color: var(--color-aviatrix); border: 1px solid rgba(0,180,216,0.25); }
.icon-fw    { background: var(--fw-surface);    color: var(--color-firewall); border: 1px solid rgba(231,76,60,0.25); }
.icon-colo  { background: var(--colo-surface);  color: var(--color-colo);   border: 1px solid rgba(155,89,182,0.25); }
.icon-mtt   { background: var(--mtt-surface);   color: var(--color-mtt);    border: 1px solid rgba(241,196,15,0.25); }

.info-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.info-card-content {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
}

.info-card-content ul {
  padding-left: var(--space-4);
  list-style: disc;
}

.info-card-content li { margin-bottom: 2px; }

/* ── Key details table ─────────────────────────────────── */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.detail-table th {
  text-align: left;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: top;
}

.detail-table tr:last-child td { border-bottom: none; }
.detail-table tr:hover td { background: var(--bg-raised); }

.cell-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  width: 180px;
}

/* ── Color chips ───────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  padding: 2px var(--space-2);
  border-radius: 3px;
  font-weight: 500;
  white-space: nowrap;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* ── Section divider ───────────────────────────────────── */
.section-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-6) 0;
}

/* ── Flow animation panel ──────────────────────────────── */
.flow-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.flow-header {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.flow-header-left {
  flex: 1;
  min-width: 0;
}

.flow-header-left h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.flow-header-left p {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-play {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--color-aviatrix);
  color: var(--bg-base);
  transition: background 150ms var(--ease-out),
              transform 80ms var(--ease-out);
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-play:hover {
  background: #00caed;
}

.btn-play:active {
  transform: scale(0.97);
}

.btn-play.playing {
  background: var(--bg-overlay);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.flow-diagram {
  padding: var(--space-5);
  overflow: visible;
}

.flow-diagram svg {
  width: 100%;
  height: auto;
  max-width: 100%;
}

.flow-steps {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}

.flow-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.flow-step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
  color: var(--text-primary);
}

.flow-step.active .flow-step-num {
  background: var(--color-aviatrix);
  color: var(--bg-base);
  border-color: var(--color-aviatrix);
}

.flow-step.active {
  color: var(--text-primary);
}

/* ── Legend ────────────────────────────────────────────── */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-4);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Key/Notes blocks ──────────────────────────────────── */
.note-block {
  background: var(--bg-raised);
  border-left: 3px solid var(--color-aviatrix);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  line-height: 1.7;
}

.note-block strong {
  color: var(--text-primary);
}

.note-block.warning {
  border-left-color: var(--color-warning);
}

.note-block.info {
  border-left-color: var(--color-info);
}

/* ── Overview specific ─────────────────────────────────── */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ── Tooltip ───────────────────────────────────────────── */
.tooltip-trigger {
  position: relative;
  cursor: help;
}

.tooltip-box {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-primary);
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  font-family: var(--font-sans);
}

.tooltip-trigger:hover .tooltip-box {
  display: block;
}

/* ── SVG component styles ──────────────────────────────── */
.svg-component {
  cursor: pointer;
  transition: opacity 150ms;
}

.svg-component:hover {
  opacity: 0.85;
}

/* ── Flow dot animation ────────────────────────────────── */
.flow-dot {
  r: 6;
  filter: drop-shadow(0 0 4px currentColor);
}

/* ── Underlay section ──────────────────────────────────── */
.underlay-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

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

.underlay-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.underlay-card-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.underlay-card-body {
  padding: var(--space-4);
}

/* ── Ownership boundary ────────────────────────────────── */
.ownership-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 700px) {
  .ownership-row { grid-template-columns: 1fr; }
}

.ownership-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: var(--space-5);
}

.ownership-card h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ownership-card ul {
  padding-left: var(--space-4);
  list-style: disc;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.8;
}

.own-yours { border-top: 3px solid var(--color-aviatrix); }
.own-them  { border-top: 3px solid var(--text-muted); }

/* ── MTT specific ──────────────────────────────────────── */
.mtt-peer-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-6);
  flex-wrap: wrap;
}

.mtt-csp-block {
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  padding: var(--space-4);
  min-width: 130px;
  text-align: center;
}

.mtt-arrow {
  font-size: 20px;
  color: var(--color-mtt);
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ── Tab bar inside section ────────────────────────────── */
.tab-bar {
  display: flex;
  gap: var(--space-1);
  padding: 0 var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow-x: auto;
}

.tab-btn {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 150ms var(--ease-out),
              border-color 150ms var(--ease-out);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--color-aviatrix);
  border-bottom-color: var(--color-aviatrix);
}

.tab-panel { display: none; }
.tab-panel.active {
  display: block;
  animation: fadeIn 250ms var(--ease-out);
}

/* ── Full diagram wrapper scrollable ───────────────────── */
.full-diagram {
  width: 100%;
  overflow-x: auto;
  padding: var(--space-2);
}

.full-diagram svg {
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* ── Quick Reference / Glossary ─────────────────────── */
#sec-glossary .detail-table td:first-child {
  color: var(--color-aviatrix);
  font-weight: 600;
}

/* ── Component popover ─────────────────────────────── */
#component-popover {
  transition: opacity 150ms var(--ease-out);
}

/* ── Click-to-Expand Detail Panel ──────────────────── */
.detail-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms cubic-bezier(0.16, 1, 0.3, 1),
              padding 300ms cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--bg-raised);
  border-top: 1px solid transparent;
}

.detail-panel.open {
  max-height: 400px;
  padding: var(--space-5) var(--space-6);
  border-top-color: var(--border-subtle);
}

.detail-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.detail-panel-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
}

.detail-panel-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border-subtle);
  font-size: 14px;
  transition: background 150ms, color 150ms;
}

.detail-panel-close:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

.detail-panel-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-3);
}

.detail-panel-facts {
  list-style: disc;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-3);
}

.detail-panel-location {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-aviatrix);
  background: var(--avi-surface);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,180,216,0.2);
  display: inline-block;
}

.detail-panel-location::before {
  content: '📍 ';
}

/* ── Overview highlight: tag hover dims non-matching ── */
.tag[data-highlight] {
  cursor: pointer;
  transition: opacity 150ms var(--ease-out),
              box-shadow 150ms var(--ease-out);
}
.tag[data-highlight]:hover {
  box-shadow: 0 0 0 2px currentColor;
}

/* ── Flow steps for xcsp (more columns needed) ────── */
#flow-xcsp-steps {
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
}

/* ── Trace-a-Path Panel ────────────────────────────── */
.trace-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.trace-header {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 150ms;
}

.trace-header:hover {
  background: var(--bg-overlay);
}

.trace-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.trace-header-left h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.trace-badge {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.trace-chevron {
  transition: transform 200ms;
  color: var(--text-muted);
}

.trace-panel.open .trace-chevron {
  transform: rotate(180deg);
}

.trace-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.trace-panel.open .trace-body {
  max-height: 800px;
}

.trace-controls {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5) var(--space-4);
  flex-wrap: wrap;
}

.trace-select-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 180px;
}

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

.trace-select {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  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 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%238fa3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.trace-select:focus {
  outline: none;
  border-color: var(--color-aviatrix);
  box-shadow: 0 0 0 2px rgba(0,180,216,0.2);
}

.trace-select option, .trace-select optgroup {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.trace-arrow-icon {
  font-size: 18px;
  color: var(--text-muted);
  padding-bottom: var(--space-2);
  flex-shrink: 0;
}

.btn-trace {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--color-aviatrix);
  color: var(--bg-base);
  border: none;
  cursor: pointer;
  transition: background 150ms, transform 80ms;
  white-space: nowrap;
}

.btn-trace:hover { background: #00caed; }
.btn-trace:active { transform: scale(0.97); }

.trace-result {
  padding: 0 var(--space-5) var(--space-5);
}

.trace-result-card {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.trace-result-header {
  padding: var(--space-3) var(--space-5);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.trace-type-badge {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid;
}

.trace-type-ew { color: var(--color-aviatrix); border-color: rgba(0,180,216,0.3); background: var(--avi-surface); }
.trace-type-xregion { color: #e056a0; border-color: rgba(224,86,160,0.3); background: rgba(224,86,160,0.08); }
.trace-type-xcsp { color: var(--color-mtt); border-color: rgba(241,196,15,0.3); background: var(--mtt-surface); }
.trace-type-hybrid { color: var(--color-colo); border-color: rgba(155,89,182,0.3); background: var(--colo-surface); }

.trace-result-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.trace-result-diagram {
  padding: var(--space-4);
  overflow-x: auto;
}

.trace-result-hops {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.trace-hop {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  padding: 2px 6px;
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
}

.trace-hop:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.trace-hop-arrow {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Command Palette Results ──────────────────────── */
.cmd-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 100ms;
}
.cmd-result:hover, .cmd-result-active {
  background: var(--bg-hover);
}
.cmd-result-icon {
  font-size: 14px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.cmd-result-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.cmd-result-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}
.cmd-result-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd-result-type {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.cmd-empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ── Component Glow on Hover ──────────────────────── */
[data-component] {
  transition: filter 200ms var(--ease-out);
}
[data-component]:hover {
  filter: drop-shadow(0 0 6px currentColor) brightness(1.1);
}
