/* ============== RESET & BASE ============== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-0: #0f1419;
  --bg-1: #161b22;
  --bg-2: #1c2229;
  --bg-3: #242c36;
  --border: #2a3340;
  --border-strong: #3a4554;
  --text-0: #e6edf3;
  --text-1: #c1c9d0;
  --text-2: #8b95a3;
  --text-3: #6a7585;
  --accent: #4fc3f7;
  --accent-2: #81c784;
  --accent-warm: #ffb74d;
  --danger: #ef5350;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  --radius: 8px;
  --radius-sm: 5px;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout dimensions */
  --header-height: 64px;
  --panel-width: 300px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-0);
  color: var(--text-0);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ============== HEADER ============== */
.app-header {
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  position: relative;
}

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

.logo {
  font-size: 28px;
  filter: drop-shadow(0 0 12px rgba(79, 195, 247, 0.4));
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tagline {
  font-size: 12px;
  color: var(--text-2);
}

.header-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-1);
  font-weight: 500;
}

.badge-state {
  background: rgba(79, 195, 247, 0.12);
  color: var(--accent);
  border-color: rgba(79, 195, 247, 0.3);
}

/* ============== MAIN LAYOUT ============== */
.app-grid {
  display: grid;
  grid-template-columns: var(--panel-width) 1fr var(--panel-width);
  height: calc(100vh - var(--header-height));
}

.panel {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-right {
  border-right: none;
  border-left: 1px solid var(--border);
}

.panel-header {
  padding: 16px 16px 8px;
}

.panel-header h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  font-weight: 600;
  margin-bottom: 4px;
}

.panel-sub {
  font-size: 12px;
  color: var(--text-3);
}

.panel-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.muted { color: var(--text-3); }
.muted.small { font-size: 11px; }

/* ============== FILTER CHIPS ============== */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}

.chip {
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}
.chip:hover { background: var(--border-strong); }
.chip.active {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
}

/* ============== CUSTOM LOADER ============== */
.custom-loader {
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.custom-loader-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.custom-loader-row input {
  flex: 1;
  background: var(--bg-3);
  color: var(--text-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  outline: none;
  transition: var(--transition);
  min-width: 0;
}

.custom-loader-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.15);
}

.custom-loader-row input::placeholder {
  text-transform: none;
  letter-spacing: 0;
  font-family: inherit;
  color: var(--text-3);
}

.btn-load {
  flex-shrink: 0;
}

.drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-2);
}

.drop-zone:hover {
  border-color: var(--accent);
  background: var(--bg-3);
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(79, 195, 247, 0.08);
  color: var(--accent);
}

.drop-zone-icon {
  font-size: 14px;
  opacity: 0.7;
}

.drop-zone code {
  background: var(--bg-0);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10.5px;
  color: var(--text-1);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.custom-error {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid rgba(239, 83, 80, 0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.4;
}

.protein-card-custom {
  position: relative;
}

.protein-card-custom .remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
  padding: 0;
}

.protein-card-custom:hover .remove-btn {
  opacity: 1;
}

.protein-card-custom .remove-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.protein-card-custom .protein-card-name::before {
  content: "★";
  margin-right: 2px;
  color: var(--accent-warm);
}

/* ============== PROTEIN LIST ============== */
.protein-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.protein-card {
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}

.protein-card:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.protein-card.active {
  border-color: var(--accent);
  background: var(--bg-3);
}

.protein-card-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.protein-card-summary {
  font-size: 11.5px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.protein-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 10.5px;
}

.pdb-tag {
  background: var(--bg-0);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--text-1);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  border: 1px solid var(--border);
}

.category-tag {
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-0);
  color: var(--text-3);
}

/* ============== VIEWER SECTION ============== */
.viewer-section {
  position: relative;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer {
  flex: 1;
  position: relative;
  background: white;
}

.viewer canvas {
  display: block;
}

.viewer-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}

.toolbar-group {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

/* ============== BUTTONS ============== */
.btn {
  background: var(--bg-2);
  color: var(--text-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  font-weight: 500;
}

.btn:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
}

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

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:disabled { background: var(--primary); border-color: var(--primary); }

.btn-secondary {
  background: var(--bg-3);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-1);
}
.btn-ghost:hover { background: var(--bg-2); }

.btn-icon {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  color: white;
  border-color: transparent;
  padding: 6px 10px;
}
.btn-icon:hover { background: rgba(0, 0, 0, 0.7); }

/* ============== VIEWER OVERLAY ============== */
.viewer-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.overlay-loading {
  display: none;
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(8px);
  padding: 20px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}
.overlay-loading.active { display: flex; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.overlay-annotation {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(12px);
  padding: 14px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  max-width: 600px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.annotation-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.annotation-body {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.55;
}

.overlay-step {
  position: absolute;
  top: 60px;
  right: 14px;
  background: rgba(99, 102, 241, 0.9);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  pointer-events: auto;
}

.step-counter {
  color: white;
}

/* ============== RIGHT PANEL TABS ============== */
.tabs-header {
  display: flex;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  font-family: inherit;
}
.tab-btn:hover { color: var(--text-0); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.tab-panel.active { display: block; }

/* ============== CONTROLS ============== */
.control-section {
  margin-bottom: 22px;
}

.control-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  font-weight: 600;
  margin-bottom: 10px;
}

.control-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.control-row span:first-child {
  color: var(--text-2);
  font-weight: 500;
  min-width: 70px;
}

.control-row select,
.control-row input[type="range"] {
  background: var(--bg-3);
  color: var(--text-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  min-width: 130px;
}

.control-row input[type="range"] {
  padding: 0;
  flex: 1;
  cursor: pointer;
  accent-color: var(--accent);
}

.highlight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.highlight-actions .btn {
  font-size: 11px;
  padding: 5px 10px;
}

.protein-description {
  background: var(--bg-2);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-1);
  border: 1px solid var(--border);
}

/* ============== TOUR ============== */
.tour-empty, .trajectory-empty {
  text-align: center;
  color: var(--text-2);
  padding: 30px 16px;
  font-size: 13px;
}

.tour-content, .trajectory-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tour-title, .trajectory-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-0);
  line-height: 1.4;
}

.tour-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.tour-step {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid var(--border);
}

.tour-step:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
}

.tour-step.active {
  border-left-color: var(--accent);
  background: var(--bg-3);
}

.tour-step.completed {
  opacity: 0.7;
  border-left-color: var(--accent-2);
}

.tour-step-title {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-0);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tour-step-num {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-0);
  color: var(--text-2);
  font-size: 10px;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.tour-step.active .tour-step-num { background: var(--accent); color: var(--bg-0); }
.tour-step.completed .tour-step-num { background: var(--accent-2); color: var(--bg-0); }

.tour-step-body {
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.45;
  margin-left: 24px;
}

.tour-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tour-progress {
  height: 3px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
}

.tour-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.5s ease;
}

/* ============== TRAJECTORY ============== */
.trajectory-desc {
  font-size: 12.5px;
  color: var(--text-1);
  line-height: 1.5;
}

.trajectory-controls {
  background: var(--bg-2);
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trajectory-state-label {
  font-size: 12px;
  color: var(--text-2);
}

.trajectory-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trajectory-slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

.trajectory-percent {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}

.trajectory-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.speed-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-2);
  margin-left: auto;
}

.speed-row select {
  background: var(--bg-3);
  color: var(--text-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 11px;
  font-family: inherit;
}

/* ============== MODAL ============== */
[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  max-width: 540px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--bg-3); color: var(--text-0); }

.modal-body {
  padding: 22px;
}

.modal-body p {
  margin-bottom: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-1);
}

.modal-body h3 {
  font-size: 13px;
  margin: 18px 0 10px;
  color: var(--text-0);
  font-weight: 600;
}

.modal-body ul {
  margin-bottom: 14px;
  padding-left: 20px;
}

.modal-body li {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-1);
}

/* ============== SCROLLBARS ============== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* ============== LOADER TABS ============== */
.custom-loader-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
  background: var(--bg-2);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.loader-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 3px;
  transition: var(--transition);
  font-family: inherit;
}

.loader-tab:hover { color: var(--text-0); }

.loader-tab.active {
  background: var(--bg-3);
  color: var(--accent);
}

/* ============== COMPARE CONTROLS ============== */
.compare-controls {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.btn-clear-compare {
  margin-top: 6px;
  width: 100%;
}

/* ============== SEQUENCE PANEL ============== */
.sequence-panel {
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  flex-shrink: 0;
  max-height: 180px;
  overflow-y: auto;
}

.sequence-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.sequence-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  font-weight: 600;
}

.sequence-chains {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
}

.sequence-row {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.5;
}

.sequence-chain-label {
  color: var(--text-2);
  font-size: 10.5px;
  min-width: 22px;
  font-weight: 600;
  flex-shrink: 0;
}

.sequence-residue {
  display: inline-block;
  width: 12px;
  height: 16px;
  text-align: center;
  border-radius: 2px;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.85);
  font-weight: 600;
  font-size: 10px;
  line-height: 16px;
  transition: transform 0.1s;
  position: relative;
}

.sequence-residue:hover {
  transform: scale(1.4);
  z-index: 2;
  outline: 1.5px solid var(--accent);
}

.sequence-residue.active {
  outline: 2px solid var(--accent-warm);
  z-index: 3;
}

.sequence-residue.ss-helix {
  border-radius: 6px;
}
.sequence-residue.ss-sheet {
  transform: skewX(-12deg);
}
.sequence-residue.ss-coil {
  border-radius: 2px;
}

.sequence-secondary {
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text-2);
  background: var(--bg-2);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

.sequence-secondary-bar {
  display: inline-block;
  height: 12px;
  margin: 0 1px;
  vertical-align: middle;
  border-radius: 1px;
}

.sequence-secondary-bar.helix {
  height: 14px;
  border-radius: 7px;
}
.sequence-secondary-bar.sheet {
  height: 10px;
  transform: skewX(-12deg);
}

/* ============== OVERLAY PICK HINT ============== */
.overlay-pick-hint {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 183, 77, 0.95);
  color: #1a1a1a;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 12.5px;
  font-weight: 500;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.btn-tiny {
  padding: 3px 8px;
  font-size: 10.5px;
}

/* ============== MEASUREMENT TABLE ============== */
.measurement-table {
  margin-top: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  max-height: 220px;
  overflow-y: auto;
}

.measurement-table-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-3);
  font-style: italic;
}

.measurement-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

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

.measurement-type {
  font-weight: 600;
  color: var(--accent);
}

.measurement-value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 600;
  color: var(--text-0);
  text-align: right;
}

.measurement-atoms {
  grid-column: 1 / -1;
  font-size: 10.5px;
  color: var(--text-2);
  margin-top: 2px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.measurement-hint {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.45;
}

/* ============== COMPARE / RMSD ============== */
.rmsd-summary {
  margin-top: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 11.5px;
  line-height: 1.5;
}

.rmsd-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.rmsd-summary-row b {
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.rmsd-bar {
  height: 6px;
  background: linear-gradient(to right, #10b981 0%, #fbbf24 50%, #ef4444 100%);
  border-radius: 3px;
  margin: 6px 0;
  position: relative;
}

.rmsd-bar-marker {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 10px;
  background: var(--bg-1);
  border: 1px solid var(--bg-0);
}

/* ============== BIOINFORMATICS ANALYSIS PANELS ============== */
.analysis-status {
  margin-top: 8px;
  padding: 6px 8px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 11px;
  min-height: 1.5em;
}

/* pLDDT gradient (AlphaFold: blue → cyan → yellow → orange) */
.legend-bar {
  margin-top: 10px;
}
.legend-gradient {
  height: 10px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.plddt-gradient {
  background: linear-gradient(to right,
    #ff7d45 0%,
    #ffdb13 50%,
    #65cbf3 70%,
    #0053d6 90%,
    #0053d6 100%);
}
.legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--text-2);
  margin-top: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Inline legend swatches (conservation) */
.legend-inline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-left: 6px;
}
.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  vertical-align: middle;
}
.swatch-low { background: #5b8def; }
.swatch-mid { background: #f5c542; }
.swatch-high { background: #cc1f1f; }

/* Variant legend dots */
.variant-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text-2);
}
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.dot-path { background: #b91c1c; }
.dot-likpath { background: #f97316; }
.dot-vus { background: #fbbf24; }
.dot-likben { background: #84cc16; }
.dot-ben { background: #22c55e; }

/* Pocket / contact lists */
.pocket-list, .contact-list {
  margin-top: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  max-height: 180px;
  overflow-y: auto;
}

.pocket-row, .contact-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.pocket-row:last-child, .contact-row:last-child {
  border-bottom: none;
}
.pocket-rank {
  font-weight: 600;
  color: var(--accent-warm);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.pocket-name {
  font-weight: 600;
  color: var(--text-0);
}
.pocket-vol {
  font-size: 10.5px;
  color: var(--text-2);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.pocket-resis {
  grid-column: 1 / -1;
  font-size: 10px;
  color: var(--text-3);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.contact-dist {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent);
  font-weight: 600;
  text-align: right;
}
.contact-type {
  font-size: 10px;
  color: var(--text-2);
  text-align: right;
}

/* ============== TOAST ============== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  color: var(--text-0);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: slideUpFade 0.25s ease;
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

.toast.success {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

/* ============== RESPONSIVE ============== */
@media (max-width: 1100px) {
  :root { --panel-width: 240px; }
  .brand-text h1 { font-size: 15px; }
  .tagline { display: none; }
}

@media (max-width: 900px) {
  .app-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 60vh auto;
  }
  .panel-left, .panel-right {
    border: none;
    border-bottom: 1px solid var(--border);
    max-height: 280px;
  }
  .sequence-panel { max-height: 120px; }
}