:root {
  --bg: #070b14;
  --bg-card: #0e1525;
  --bg-card-alt: #131c31;
  --bg-elevated: #18233c;
  --border: #1e2d4a;
  --border-bright: #314875;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --cyan: #38bdf8;
  --emerald: #10b981;
  --amber: #facc15;
  --pink: #f472b6;
  --lime: #a3e635;
  --purple: #a855f7;
  --indigo: #818cf8;
  --red: #ef4444;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.45;
  font-size: 13.5px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1640px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ========================================================================= */
/* CLEAN SINGLE-ROW STICKY HEADER                                            */
/* ========================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 11, 20, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1640px;
  margin: 0 auto;
  padding: 0.45rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--emerald);
  letter-spacing: 0.04em;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.55; }
}

.brand-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-sub {
  font-weight: 500;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-left: 0.3rem;
}

@media (max-width: 1380px) {
  .brand-sub { display: none; }
}

/* Primary Workspace Navigation Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: #050811;
  padding: 0.2rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.34rem 0.72rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text);
  background: rgba(56, 189, 248, 0.08);
}

.nav-tab.active {
  background: rgba(56, 189, 248, 0.16);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.42);
}

.nav-tab-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--cyan);
}

.nav-tab.active .nav-tab-num {
  background: var(--cyan);
  color: #04101c;
  font-weight: 800;
}

/* Header Compact Telemetry Pills */
.header-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.h-pill {
  padding: 0.24rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.h-pill strong {
  color: var(--text);
  font-weight: 700;
}

.h-pill-emerald {
  border-color: rgba(16, 185, 129, 0.32);
  background: rgba(16, 185, 129, 0.08);
}
.h-pill-emerald strong { color: #34d399; }

.h-pill-purple {
  border-color: rgba(168, 85, 247, 0.32);
  background: rgba(168, 85, 247, 0.08);
}
.h-pill-purple strong { color: #c084fc; }

.h-pill-ok {
  color: var(--cyan);
}

/* ========================================================================= */
/* CONTEXT-AWARE ACTIVE SITE BANNER                                          */
/* ========================================================================= */
body[data-active-ws="scatter"] .active-site-banner,
body[data-active-ws="telemetry"] .active-site-banner {
  display: none;
}

.active-site-banner {
  margin: 0.65rem 0;
  padding: 0.55rem 0.85rem;
  background: linear-gradient(180deg, #121b30 0%, #0e1525 100%);
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(180px, 0.9fr) auto;
  align-items: center;
  gap: 0.85rem;
}

@media (max-width: 1280px) {
  .active-site-banner {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
}

.asb-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.asb-nav-btns {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-nav-arrow {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  color: var(--text);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-nav-arrow:hover {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.18);
}

.asb-identity {
  min-width: 0;
  flex: 1;
}

.asb-title-row {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  flex-wrap: wrap;
}

.asb-cid {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  margin-right: 0.15rem;
}

.asb-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  padding: 0.12rem 0.44rem;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-gene { background: rgba(56, 189, 248, 0.15); color: var(--cyan); border: 1px solid rgba(56, 189, 248, 0.35); }
.badge-lig { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-lig.no { background: rgba(148, 163, 184, 0.12); color: var(--text-muted); border: 1px solid var(--border); }
.badge-thiol { background: rgba(250, 204, 21, 0.15); color: var(--amber); border: 1px solid rgba(250, 204, 21, 0.35); }
.badge-row { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }

/* Single-Line Horizontal Scroll for Sibling Cysteines (Never Explodes Vertically!) */
.asb-siblings {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  overflow: hidden;
  padding: 0.25rem 0.55rem;
  background: rgba(7, 11, 20, 0.5);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.asb-sib-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.asb-sib-label strong {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.sibling-chips-inline {
  display: flex;
  gap: 0.28rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 1px;
}

.sibling-chips-inline::-webkit-scrollbar {
  height: 3px;
}
.sibling-chips-inline::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 3px;
}

.sib-chip {
  padding: 0.16rem 0.44rem;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.14s;
}

.sib-chip:hover {
  border-color: var(--cyan);
  color: var(--text);
}

.sib-chip.active {
  background: rgba(250, 204, 21, 0.18);
  border-color: var(--amber);
  color: var(--amber);
  font-weight: 700;
}

.asb-kpis {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.asb-kpi {
  background: rgba(7, 11, 20, 0.65);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.22rem 0.55rem;
  display: flex;
  flex-direction: column;
}

.asb-kpi-lbl {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 600;
}

.asb-kpi-val {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan);
  white-space: nowrap;
}

/* ========================================================================= */
/* WORKSPACE PANELS                                                          */
/* ========================================================================= */
.workspace-panel {
  display: none;
  padding-bottom: 1.5rem;
}

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

body.show-all-workspaces .workspace-panel {
  display: block;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

/* ========================================================================= */
/* WORKSPACE 1: 3D PROTEIN & 10.0 A CUT-OUT EXPLORER                         */
/* ========================================================================= */
.explorer-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}

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

/* Left Sidebar: Protein & Cysteine Browser */
.mol-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  height: 855px;
  overflow: hidden;
}

.sidebar-top-controls {
  padding: 0.65rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #060911;
  padding: 0.18rem;
  border-radius: 7px;
  border: 1px solid var(--border);
}

.sb-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem 0.35rem;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.sb-mode-btn.active {
  background: var(--bg-elevated);
  color: var(--cyan);
}

#site-search {
  width: 100%;
  background: #060911;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.42rem 0.6rem;
  border-radius: 6px;
  font-size: 0.76rem;
}

#site-search:focus {
  outline: none;
  border-color: var(--cyan);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.f-chip {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.16rem 0.44rem;
  border-radius: 5px;
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
}

.f-chip:hover {
  color: var(--text);
}

.f-chip.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Sidebar Curated Archetypes Strip */
.sidebar-archetypes {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(30, 45, 74, 0.65);
}

.qa-label {
  font-size: 0.64rem;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.qa-buttons {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
}
.qa-buttons::-webkit-scrollbar { display: none; }

.qa-btn {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.15rem 0.42rem;
  border-radius: 5px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.14s;
}

.qa-btn:hover, .qa-btn.active {
  border-color: var(--cyan);
  color: #fff;
  background: rgba(56, 189, 248, 0.15);
}

.site-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.site-item {
  padding: 0.5rem 0.6rem;
  border-radius: 7px;
  background: var(--bg-card-alt);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.13s;
}

.site-item:hover {
  border-color: var(--border-bright);
  background: var(--bg-elevated);
}

.site-item.active {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.12);
}

.site-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.12rem;
}

.site-item-cid {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text);
}

.site-item-gene {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  color: var(--cyan);
  font-weight: 600;
}

.site-item-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.22rem;
}

.site-item-meta {
  display: flex;
  gap: 0.32rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}

.prot-group-card {
  padding: 0.55rem 0.6rem;
  border-radius: 7px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
}

.prot-group-card.active {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.08);
}

.prot-group-hdr {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.15rem;
}

.prot-group-cys-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

/* Right Main Column */
.mol-main {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

/* 1. Clean 5-Step Cut-Out Anatomy Ribbon */
.cutout-anatomy-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (max-width: 1100px) {
  .cutout-anatomy-bar {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

.cab-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--border-bright);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  transition: all 0.14s;
  min-width: 0;
}

.cab-step-protein { border-top-color: #818cf8; }
.cab-step-sphere { border-top-color: #38bdf8; }
.cab-step-caps { border-top-color: #f472b6; }
.cab-step-neut { border-top-color: #a3e635; }
.cab-step-qm { border-top-color: #facc15; }

.cab-step:hover {
  border-color: var(--cyan);
  background: var(--bg-card-alt);
  transform: translateY(-1px);
}

.cab-step-hdr {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  margin-bottom: 0.15rem;
}

.cab-step-num {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  white-space: nowrap;
}

.cab-step-main {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #fff;
  margin-bottom: 0.08rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cab-step-sub {
  font-size: 0.66rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txt-cyan { color: var(--cyan); }
.txt-teal { color: #2dd4bf; }
.txt-pink { color: var(--pink); }
.txt-lime { color: var(--lime); }
.txt-amber { color: var(--amber); }

.cab-dot, .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-target { background: #facc15; box-shadow: 0 0 5px #facc15; }
.dot-inner { background: #38bdf8; }
.dot-outer { background: #14b8a6; }
.dot-excluded { background: #818cf8; }
.dot-cap { background: #f472b6; }
.dot-neut { background: #a3e635; }
.dot-sib { background: #fb923c; }
.dot-hbond { background: #22d3ee; }

/* 2. Compact Single-Row 3D Toolbar */
.dual-3d-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.36rem 0.65rem;
}

.d3d-layout-group, .d3d-layers-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-right: 0.15rem;
}

.layer-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: #070b14;
  border: 1px solid var(--border);
  font-size: 0.69rem;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: all 0.14s;
}

.layer-pill input {
  accent-color: var(--cyan);
  margin: 0;
  width: 12px;
  height: 12px;
}

.layer-pill:has(input:checked) {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.38);
  color: var(--text);
}

.layer-pill:hover {
  border-color: var(--border-bright);
  color: var(--text);
}

/* 3. Dual Side-by-Side 3D Stage */
.dual-3d-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.dual-3d-stage.layout-protein #pane-pocket-3d { display: none; }
.dual-3d-stage.layout-protein { grid-template-columns: 1fr; }
.dual-3d-stage.layout-pocket #pane-protein-3d { display: none; }
.dual-3d-stage.layout-pocket { grid-template-columns: 1fr; }

@media (max-width: 1100px) {
  .dual-3d-stage { grid-template-columns: 1fr; }
}

.stage-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pane-header {
  padding: 0.42rem 0.7rem;
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.pane-title-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.pane-title-group h4 {
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pane-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.badge-indigo {
  background: rgba(129, 140, 248, 0.16);
  color: #a5b4fc;
  border: 1px solid rgba(129, 140, 248, 0.35);
}

.badge-cyan {
  background: rgba(56, 189, 248, 0.16);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.canvas-wrap {
  position: relative;
  height: 410px;
  background: radial-gradient(circle at center, #0c1426 0%, #050811 100%);
}

.mol-canvas {
  width: 100%;
  height: 100%;
  position: relative;
}

.viewer-floating-hud {
  position: absolute;
  top: 0.5rem;
  left: 0.55rem;
  max-width: calc(100% - 1.1rem);
  pointer-events: none;
  background: rgba(7, 11, 20, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  padding: 0.24rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 10;
}

.canvas-legend-bottom {
  position: absolute;
  bottom: 0.45rem;
  left: 0.55rem;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.24rem 0.55rem;
  border-radius: 6px;
  background: rgba(7, 11, 20, 0.76);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(30, 45, 74, 0.85);
  font-size: 0.65rem;
  color: var(--text-muted);
  z-index: 10;
  pointer-events: none;
}

.leg-item {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

/* 4. 1D Primary Sequence & Cut-Out Footprint Bar */
.seq-bar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.5rem 0.75rem;
}

.seq-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.38rem;
}

.seq-bar-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.seq-bar-sub {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--cyan);
  margin-left: 0.45rem;
}

.seq-bar-legend {
  display: flex;
  gap: 0.65rem;
  font-size: 0.66rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.seq-track {
  position: relative;
  height: 24px;
  background: #060a12;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: visible;
}

.seq-crop-window {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(129, 140, 248, 0.14);
  border-left: 1px dashed var(--indigo);
  border-right: 1px dashed var(--indigo);
}

.seq-cut-tick {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 2.5px;
  background: rgba(56, 189, 248, 0.65);
  border-radius: 1px;
  cursor: pointer;
}

.seq-cut-tick.is-cap {
  background: var(--pink);
  top: 1px;
  bottom: 1px;
  width: 3px;
  z-index: 3;
}

.seq-cys-pin {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 7px;
  margin-left: -3.5px;
  border-radius: 3px;
  background: #fb923c;
  border: 1px solid #fff;
  cursor: pointer;
  z-index: 5;
  transition: transform 0.15s;
}

.seq-cys-pin:hover {
  transform: scale(1.35);
}

.seq-cys-pin.target {
  background: var(--amber);
  width: 10px;
  margin-left: -5px;
  box-shadow: 0 0 8px var(--amber);
  z-index: 6;
}

/* 5. Interactive Cut-Out Inspector Card */
.cutout-inspector-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.ci-tabs-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.42rem 0.75rem;
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
}

.ci-tabs {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.ci-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.3rem 0.62rem;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
}

.ci-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.ci-tab.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.42);
  color: #fff;
}

.ci-hint {
  font-size: 0.69rem;
  color: var(--text-dim);
}

.btn-link {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 0.69rem;
  cursor: pointer;
  text-decoration: underline;
}

.ci-panel {
  display: none;
  padding: 0.65rem 0.75rem;
}

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

.ci-explainer {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.45;
}

.ci-split-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 1000px) {
  .ci-split-two { grid-template-columns: 1fr; }
}

.ci-subhead {
  font-size: 0.77rem;
  margin-bottom: 0.22rem;
  color: var(--text);
}

.table-scroll {
  max-height: 215px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.73rem;
}

.data-table th {
  position: sticky;
  top: 0;
  background: #0a101d;
  color: var(--text-muted);
  text-align: left;
  padding: 0.38rem 0.55rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  z-index: 2;
}

.data-table td {
  padding: 0.34rem 0.55rem;
  border-bottom: 1px solid rgba(30, 45, 74, 0.45);
  font-family: var(--font-mono);
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.09);
}

.data-table tbody tr.selected-row {
  background: rgba(250, 204, 21, 0.16);
}

.prov-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.prov-kv {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.4rem 0.6rem;
}

.prov-kv span {
  display: block;
  font-size: 0.64rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.prov-kv strong {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
}

.study-matrix-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.study-badges {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.study-pill {
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  border: 1px solid var(--border);
}

.study-pill.yes {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.42);
  color: #34d399;
}

.study-pill.no {
  background: var(--bg-card-alt);
  color: var(--text-dim);
}

/* ========================================================================= */
/* COMMON BUTTONS & HEADERS                                                  */
/* ========================================================================= */
.btn-group {
  display: inline-flex;
  background: #060911;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.12rem;
  gap: 0.12rem;
}

.btn-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.24rem 0.52rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-toggle.active {
  background: rgba(56, 189, 248, 0.2);
  color: #fff;
}

.btn-xs {
  padding: 0.2rem 0.46rem;
  font-size: 0.68rem;
  border-radius: 5px;
}

.btn-ghost {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
}

.btn-ghost:hover {
  border-color: var(--cyan);
  color: #fff;
}

.btn-primary {
  background: var(--cyan);
  color: #04101c;
  border: none;
  padding: 0.42rem 0.8rem;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.42rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 0.8rem;
}

.section-header-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.07em;
  display: block;
  margin-bottom: 0.1rem;
}

.section-header h2 {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan);
  white-space: nowrap;
}

/* ========================================================================= */
/* WORKSPACE 2: 672-D FEATURE INSPECTOR                                      */
/* ========================================================================= */
.feature-top-grid {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr) 350px;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 1260px) {
  .feature-top-grid { grid-template-columns: 1fr; }
}

.feat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  margin-bottom: 0.75rem;
  min-width: 0;
}

.feature-top-grid .feat-card,
.ml-diagnostics-grid .feat-card {
  margin-bottom: 0;
}

.feat-card h4 {
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.feat-sub {
  font-size: 0.71rem;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}

.bob-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

#feat-search {
  background: #060911;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.36rem 0.6rem;
  border-radius: 6px;
  min-width: 240px;
  font-size: 0.74rem;
}

.feat-all-scroll {
  max-height: 330px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.sg-shells-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.shell-pill {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.34rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.steric-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

/* ========================================================================= */
/* WORKSPACE 3: UMAP MANIFOLD & LEAK-FREE CATBOOST CLASSIFIER                */
/* ========================================================================= */
.text-emerald { color: #34d399; }
.text-cyan { color: var(--cyan); }
.text-amber { color: var(--amber); }
.text-purple { color: #c084fc; }

/* 1. 5-Card KPI Summary Strip */
.ml-kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 1180px) {
  .ml-kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

.ml-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.ml-kpi-lbl {
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ml-kpi-val {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ml-kpi-sub {
  font-size: 0.67rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 2. Hero Grid: Left = Interactive 2D UMAP, Right = Score-Tier Hit Rate */
.ml-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(380px, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: stretch;
}

@media (max-width: 1220px) {
  .ml-hero-grid { grid-template-columns: 1fr; }
}

.scatter-wrap {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.umap-toolbar {
  padding-bottom: 0.55rem;
  margin-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.scatter-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.scatter-controls label {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
}

.scatter-controls select {
  background: #060911;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.26rem 0.45rem;
  border-radius: 5px;
  font-size: 0.71rem;
}

#scatter-canvas, #bob-canvas {
  width: 100%;
  display: block;
}

.scatter-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(7, 11, 20, 0.95);
  border: 1px solid var(--cyan);
  border-radius: 7px;
  padding: 0.45rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.scatter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Right Hero Panel: Score-Tier Hit Rate & Confusion Matrix */
.ml-accuracy-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.ml-acc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}

.ml-acc-header h4 {
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 0.1rem;
}

.ml-Acc-header .feat-sub {
  margin-bottom: 0;
}

.ml-baseline-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--amber);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.14rem 0.45rem;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.ml-tier-bars {
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
}

.tier-row {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr) 118px;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.7rem;
}

.tier-lbl {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tier-lbl small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.63rem;
}

.tier-track {
  height: 14px;
  background: #060911;
  border: 1px solid var(--border);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.tier-fill {
  height: 100%;
  border-radius: 3px;
}

.tier-baseline-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #f59e0b;
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.85);
  z-index: 2;
}

.tier-val {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-align: right;
  white-space: nowrap;
}

.ml-tier-footnote {
  margin: 0.45rem 0;
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.ml-cm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.38rem;
  margin-top: 0.35rem;
}

.ml-cm-cell {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.34rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
}

.ml-cm-cell strong {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.ml-cm-cell span {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* 3. Bottom 3-Column Diagnostics Grid */
.ml-diagnostics-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr 1.05fr;
  gap: 0.75rem;
}

@media (max-width: 1220px) {
  .ml-diagnostics-grid { grid-template-columns: 1fr; }
}

.ml-shap-bars {
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
  margin-top: 0.4rem;
}

.shap-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
}

.shap-fname {
  font-family: var(--font-sans);
  font-size: 0.69rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shap-track {
  height: 10px;
  background: #060911;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.shap-fill {
  height: 100%;
  border-radius: 3px;
}

.shap-val {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-align: right;
  color: var(--text-muted);
}

/* ========================================================================= */
/* WORKSPACE 4: TELEMETRY & 5-STAGE PIPELINE                                 */
/* ========================================================================= */
.telemetry-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

@media (max-width: 980px) {
  .telemetry-progress-grid { grid-template-columns: 1fr; }
}

.h-metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.6rem 0.8rem;
}

.h-metric-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.h-metric-label {
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.65rem;
}

.h-metric-val {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.h-progress-track {
  height: 6px;
  background: #060911;
  border-radius: 999px;
  overflow: hidden;
}

.h-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

.fill-emerald { background: linear-gradient(90deg, #059669, #34d399); }
.fill-cyan { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.fill-purple { background: linear-gradient(90deg, #7c3aed, #c084fc); }

.telemetry-split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0.75rem;
}

@media (max-width: 1100px) {
  .telemetry-split { grid-template-columns: 1fr; }
}

.wave-panel, .terminal-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
}

.panel-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.panel-hdr h3 {
  font-size: 0.82rem;
  font-weight: 700;
}

.wave-legend {
  display: flex;
  gap: 0.6rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 0.22rem;
}

.sw-done { background: var(--emerald); }
.sw-active { background: var(--cyan); }
.sw-queued { background: #3b82f6; }

.wave-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 0.32rem;
}

.wave-cell {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.28rem 0.38rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.wave-cell.done {
  border-color: rgba(16, 185, 129, 0.42);
  background: rgba(16, 185, 129, 0.1);
}

.wave-cell.active {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.15);
}

.terminal-box {
  background: #050811;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.6rem;
  height: 290px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #a7f3d0;
  white-space: pre-wrap;
}

.pipeline-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 1200px) {
  .pipeline-flow { grid-template-columns: 1fr 1fr; }
}

.pipe-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.7rem;
}

.pipe-step-hdr {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.pipe-num { color: var(--cyan); font-weight: 800; }
.pipe-tag { color: var(--emerald); }
.pipe-step h3 { font-size: 0.8rem; margin-bottom: 0.25rem; }
.pipe-step p { font-size: 0.71rem; color: var(--text-muted); line-height: 1.42; }

/* ========================================================================= */
/* MODAL & FOOTER                                                            */
/* ========================================================================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal.hidden, .hidden {
  display: none !important;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 11px;
  padding: 1.2rem;
  width: 450px;
  max-width: 92vw;
}

.modal-card input {
  width: 100%;
  margin: 0.7rem 0;
  padding: 0.48rem;
  background: #050811;
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 6px;
}

.modal-actions {
  display: flex;
  gap: 0.45rem;
  justify-content: flex-end;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 0.8rem 0;
  color: var(--text-dim);
  font-size: 0.72rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem;
}
