@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;600&display=swap');

/* ─── CSS Custom Properties ─────────────────────────────────────────────────── */
:root {
  /* Surface & Base */
  --bg-app:        #f8fafc;
  --bg-card:       #ffffff;
  --border-color:  #e2e8f0;

  /* Text */
  --text-main:     #0f172a;
  --text-muted:    #64748b;
  --text-subtle:   #94a3b8;

  /* Accent */
  --primary-blue:  #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  /* Sequence Track Highlights */
  --variant-bg:       #fee2e2;
  --variant-text:     #dc2626;
  --fwd-primer-bg:    #dbeafe;
  --fwd-primer-text:  #1d4ed8;
  --rev-primer-bg:    #d1fae5;
  --rev-primer-text:  #047857;
  --amplicon-bg:      #fef3c7;
  --amplicon-border:  #f59e0b;

  /* Shadows */
  --shadow-sm:  0 1px 3px 0 rgba(0,0,0,.08), 0 1px 2px -1px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.05);

  /* Transitions */
  --transition: 0.18s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Card Component ────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

/* ─── Button Components ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

.btn-primary {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-app);
  color: var(--text-main);
}

.btn-export {
  background: #059669;
  color: #fff;
  border-color: #059669;
}
.btn-export:hover:not(:disabled) {
  background: #047857;
  border-color: #047857;
  box-shadow: 0 0 0 3px rgba(5,150,105,0.2);
}

.btn-support {
  background: #fff;
  color: #047857;
  border-color: #a7f3d0;
}
.btn-support:hover:not(:disabled) {
  background: #ecfdf5;
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.14);
}

.btn-about {
  background: #fff;
  color: #334155;
  border-color: #cbd5e1;
}
.btn-about:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(100,116,139,0.12);
}

.btn-whatsapp {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.btn-whatsapp:hover:not(.is-disabled) {
  background: #15803d;
  border-color: #15803d;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.18);
}
.btn-ucsc {
  background: #4f46e5;
  color: #fff;
  border-color: #4338ca;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(67,56,202,0.25);
}
.btn-ucsc:hover:not(:disabled) {
  background: #4338ca;
  border-color: #3730a3;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.22), 0 3px 7px rgba(67,56,202,0.25);
}
.btn-ucsc svg { color: #fff; }
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: auto;
}

.btn-select {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 6px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s;
}
.btn-select:active { transform: scale(0.97); }

/* ─── Pipeline Progress ─────────────────────────────────────────────────────── */
.pipeline-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  transition: color var(--transition);
}
.pipeline-step:last-child { border-bottom: none; }

.step-icon-wrap {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-icon {
  width: 20px;
  height: 20px;
}

.step-name {
  font-weight: 500;
  min-width: 150px;
  color: var(--text-main);
}
.step-label {
  font-size: 13px;
  color: var(--text-muted);
}

.step-pending .step-icon { color: #cbd5e1; }
.step-pending .step-name { color: var(--text-muted); }

.step-running .step-icon { color: #2563eb; animation: spin 0.9s linear infinite; }
.step-running .step-name { color: #2563eb; }

.step-done .step-icon { color: #10b981; }
.step-done .step-name { color: var(--text-main); }

.step-error .step-icon { color: #ef4444; }
.step-error .step-name { color: #ef4444; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ─── Sequence Viewer ───────────────────────────────────────────────────────── */
#seq-ruler {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-subtle);
  padding: 4px 12px 0;
  user-select: none;
  display: flex;
  overflow: hidden;
}
.ruler-tick {
  display: inline-block;
  width: 10ch;
  text-align: left;
  border-left: 1px solid #e2e8f0;
  padding-left: 2px;
  flex-shrink: 0;
}

#seq-display {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.8;
  letter-spacing: 0.05em;
  word-break: break-all;
  white-space: normal;
  user-select: text;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  max-height: 290px;
  overflow-y: auto;
  scroll-behavior: smooth;
}
#seq-ruler-wrap {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

/* Individual character spans */
.seq-char {
  display: inline;
  cursor: default;
  border-radius: 2px;
  transition: background 0.12s;
  position: relative;
}

/* Highlight classes */
.highlight-variant {
  background-color: var(--variant-bg);
  color: var(--variant-text);
  font-weight: 700;
  outline: 2px solid var(--variant-text);
  outline-offset: 0px;
  border-radius: 3px;
  z-index: 2;
  position: relative;
}

.highlight-fwd {
  background-color: var(--fwd-primer-bg);
  color: var(--fwd-primer-text);
  font-weight: 600;
}

.highlight-rev {
  background-color: var(--rev-primer-bg);
  color: var(--rev-primer-text);
  font-weight: 600;
}

.highlight-amplicon {
  background-color: var(--amplicon-bg);
  border-bottom: 2px solid var(--amplicon-border);
}

/* Annotation Legend */
.seq-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch {
  width: 16px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-block;
}
.legend-swatch.variant  { background: var(--variant-bg);    outline: 2px solid var(--variant-text); }
.legend-swatch.fwd      { background: var(--fwd-primer-bg); border: 1px solid var(--fwd-primer-text); }
.legend-swatch.rev      { background: var(--rev-primer-bg); border: 1px solid var(--rev-primer-text); }
.legend-swatch.amplicon { background: var(--amplicon-bg);   border-bottom: 2px solid var(--amplicon-border); }
.legend-swatch.insertion { background: transparent; border-left: 3px solid var(--variant-text); width: 6px; }
.legend-swatch.repeat   { background: transparent; border-bottom: 2px dotted var(--variant-text); }
.legend-swatch.arms-outer-forward { background: #dbeafe; border: 1px solid #1d4ed8; }
.legend-swatch.arms-outer-reverse { background: #ede9fe; border: 1px solid #6d28d9; }
.legend-swatch.arms-reference-inner { background: #d1fae5; border: 1px solid #047857; }
.legend-swatch.arms-alternate-inner { background: #ffedd5; border: 1px solid #c2410c; }

.seq-char.arms-outer-forward { background: #dbeafe; color: #1e40af; }
.seq-char.arms-outer-reverse { background: #ede9fe; color: #5b21b6; }
.seq-char.arms-reference-inner { background: #d1fae5; color: #065f46; text-decoration: underline; text-decoration-thickness: 2px; }
.seq-char.arms-alternate-inner { background: #ffedd5; color: #9a3412; text-decoration: underline; text-decoration-thickness: 2px; }
.seq-char.highlight-repeat {
  box-shadow: inset 0 -2px 0 var(--variant-text);
  text-decoration: underline dotted var(--variant-text);
  text-underline-offset: 3px;
}
.seq-char.insertion-site-after::after {
  content: '';
  position: absolute;
  top: -3px;
  bottom: -3px;
  right: -2px;
  width: 3px;
  border-radius: 2px;
  background: var(--variant-text);
  z-index: 4;
}
.seq-char.insertion-site-after { position: relative; }
.seq-char.highlight-variant {
  position: relative;
  z-index: 3;
  background: var(--variant-bg) !important;
  color: var(--variant-text) !important;
  outline: 2px solid var(--variant-text);
  outline-offset: 1px;
}

/* ─── Primer Table ──────────────────────────────────────────────────────────── */
.primer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.primer-table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
.primer-table thead th.center { text-align: center; }

.primer-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.primer-pair-list-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 10px; }
.primer-pair-list { border-collapse: collapse; font-size: 12px; }
.primer-pair-list th { padding: 10px 12px; background: #f8fafc; color: #64748b; font-size: 10px; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.primer-pair-list td { padding: 11px 12px; border-top: 1px solid #e2e8f0; vertical-align: middle; }
.primer-pair-list tbody tr:hover { background: #f8fbff; }
.primer-pair-list small { display: block; margin-top: 4px; color: #64748b; font-size: 10px; }
.primer-pair-sequence { display: inline-block; padding: 4px 7px; border-radius: 5px; font: 600 11px/1.4 'JetBrains Mono', monospace; word-break: break-all; }
.primer-pair-forward { background: #dbeafe; color: #1e40af; }
.primer-pair-reverse { background: #d1fae5; color: #065f46; }
.primer-table tbody tr { transition: background var(--transition); }
.primer-table tbody tr:hover { background: #f8fafc; }
.primer-table tbody tr:last-child td { border-bottom: none; }

.primer-row.row-selected {
  background: var(--primary-light) !important;
  box-shadow: inset 3px 0 0 var(--primary-blue);
}

.seq-badge {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 5px;
  display: inline-block;
  letter-spacing: 0.03em;
  word-break: break-all;
}
.seq-badge.fwd { background: var(--fwd-primer-bg); color: var(--fwd-primer-text); }
.seq-badge.rev { background: var(--rev-primer-bg); color: var(--rev-primer-text); }

/* ─── Accordion ─────────────────────────────────────────────────────────────── */
.accordion-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-blue);
  font-size: 13px;
  font-weight: 500;
}
.accordion-toggle:hover { color: var(--primary-hover); }

.accordion-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
  font-size: 10px;
}

.accordion-content {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
#toast-error {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #f1f5f9;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 9999;
  display: none;
  animation: slideInToast 0.3s ease;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
@keyframes slideInToast {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
#toast-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
#toast-close:hover { color: #f1f5f9; }

/* ─── Validation Card ───────────────────────────────────────────────────────── */
.val-stat-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 18px;
  text-align: center;
}
.val-stat-box .stat-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-main);
}
.val-stat-box .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Meta Chip ─────────────────────────────────────────────────────────────── */
.meta-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
}
.meta-chip .chip-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.meta-chip .chip-value {
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
}
.meta-chip .chip-value.mono {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
}

/* ─── Staged Workflow & Tabbed Results Workspace ──────────────────────────── */
.app-container { width: 96vw; max-width: 1680px; }
.site-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.site-layout > main { min-width: 0; }

.workspace-shell {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 20px;
}
.workflow-panel,
.results-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}
.workflow-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}
.workflow-controls > .step-card:not(.is-collapsed) { grid-column: 1 / -1; }
.workflow-controls > .step-card.hidden { display: none !important; }

.stage-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
.stage-action-end { justify-content: flex-end; }
.result-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
}
.result-action-buttons,
.validation-actions-primary {
  display: flex;
  align-items: center;
  gap: 9px;
}
.validation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.ad-rail { display: none; min-width: 0; }
.ad-bottom { margin-top: 4px; }
.ad-card {
  min-height: 110px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #94a3b8;
  text-align: center;
}
.ad-card .adsbygoogle { min-height: 90px; }
.ad-card p { max-width: 640px; margin: 9px auto 0; font-size: 11px; line-height: 1.45; }
.ad-label { display: block; margin-bottom: 6px; font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

@media (min-width: 1760px) {
  .site-layout.has-ad-rail { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
  .ad-rail { display: block; position: sticky; top: 78px; }
  .ad-rail .ad-card { min-height: 420px; }
  .ad-rail .adsbygoogle { min-height: 300px; }
  .site-layout.has-ad-rail + .ad-bottom { display: none; }
}

.workspace-empty-state {
  display: grid;
  min-height: 280px;
  place-content: center;
  justify-items: center;
  padding: 48px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
  color: #64748b;
  text-align: center;
}
.workspace-empty-state.hidden { display: none; }
.workspace-empty-icon {
  display: grid;
  width: 68px;
  height: 68px;
  margin-bottom: 18px;
  place-content: center;
  border-radius: 18px;
  background: #eff6ff;
  color: #2563eb;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 1px #dbeafe;
}
.workspace-empty-icon span { color: #0f766e; }
.workspace-empty-state h2 { color: #334155; font-size: 17px; font-weight: 700; }
.workspace-empty-state p { max-width: 420px; margin-top: 7px; font-size: 13px; line-height: 1.6; }

.step-card-toggle {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font: 600 12px/1.3 inherit;
}
.step-card-toggle:hover { color: #1d4ed8; text-decoration: underline; }
.step-card-summary {
  overflow: hidden;
  color: #475569;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-card.is-collapsed { padding-top: 15px; padding-bottom: 15px; }
.step-card.is-collapsed .step-card-body { display: none; }
.step-card.is-collapsed > .flex { margin-bottom: 4px; }
.step-card.is-collapsed > .flex p { display: none; }

.metadata-summary,
.sequence-details {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.metadata-summary summary,
.sequence-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  color: #475569;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metadata-summary summary::-webkit-details-marker,
.sequence-details summary::-webkit-details-marker { display: none; }
.metadata-summary summary::after,
.sequence-details summary::after { content: '+'; color: #64748b; font-size: 17px; font-weight: 400; }
.metadata-summary[open] summary::after,
.sequence-details[open] summary::after { content: '−'; }
.metadata-summary p {
  padding: 0 12px 12px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.55;
}
.sequence-details { margin-top: 14px; }
.sequence-details summary { text-transform: none; letter-spacing: normal; }
.sequence-details summary::after { margin-left: auto; }
.sequence-details-hint { margin-left: 8px; color: #94a3b8; font-size: 11px; font-weight: 400; }
.sequence-details-content {
  max-height: 220px;
  overflow-y: auto;
  margin: 0 12px 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
  color: #475569;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.sequence-actions { display: flex; align-items: center; gap: 7px; }
.sequence-expanded #seq-display { max-height: none; }

.workspace-results-nav {
  position: sticky;
  top: 72px;
  scroll-margin-top: 72px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  max-width: 100%;
  padding: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: rgba(255,255,255,0.94);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  overflow-x: auto;
  scrollbar-width: none;
}
.workspace-results-nav::-webkit-scrollbar { display: none; }
.workspace-nav-label {
  padding: 0 10px;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.workspace-results-nav button {
  min-width: 92px;
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font: 600 12px/1.2 inherit;
  white-space: nowrap;
}
.workspace-results-nav button:hover:not(:disabled) { background: #eff6ff; color: #1d4ed8; }
.workspace-results-nav button.is-active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,0.22);
}
.workspace-results-nav button.is-active:hover:not(:disabled) { background: #1d4ed8; color: #fff; }
.workspace-results-nav button:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: -1px;
}
.workspace-results-nav button:disabled { display: none; }
.workspace-result-section:not(.hidden):not(.is-active-result) { display: none !important; }

/* Sequence → primer configuration → primer results stays in one visible flow. */
#section-sequence > .sequence-primer-config,
#section-sequence > .sequence-primer-results {
  scroll-margin-top: 128px;
  margin-top: 18px;
  box-shadow: none;
}
#section-sequence > .sequence-primer-config {
  border: 1px solid #bfdbfe;
  border-left: 4px solid #2563eb;
  background: #f8fbff;
}
#section-sequence > .sequence-primer-config h2 { color: #0f172a; }
#section-sequence > .sequence-primer-config p { color: #475569; }
#section-sequence > .sequence-primer-config .stage-action-bar { border-color: #bfdbfe; }
#section-sequence > .sequence-primer-config #btn-design-primers {
  min-width: 168px;
  background: #1d4ed8;
  border-color: #1e40af;
  color: #fff;
  box-shadow: 0 2px 5px rgba(30,64,175,0.22);
}
#section-sequence > .sequence-primer-config #btn-design-primers:hover { background: #1e40af; }
#section-sequence > .sequence-primer-results {
  border: 1px solid #cbd5e1;
  background: #fff;
}
#section-sequence > .sequence-primer-results h3 { color: #0f172a; }

@media (min-width: 1100px) {
  .workflow-panel > section[aria-label="Primer Design Wizard"] { padding: 16px 20px; }
  .workflow-panel > section[aria-label="Primer Design Wizard"] > .flex > div { min-width: 0; flex: 1; }
  .workflow-panel > section[aria-label="Primer Design Wizard"] .accordion-toggle { flex-shrink: 0; }

  #progress-container { padding: 14px 18px; }
  #progress-container > h3 { margin-bottom: 9px; }
  #progress-container > div {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .workflow-panel .pipeline-step {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 2px 8px;
    min-width: 0;
    padding: 9px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #f8fafc;
  }
  .workflow-panel .pipeline-step:last-child { border-bottom: 1px solid #e2e8f0; }
  .workflow-panel .step-icon-wrap { grid-row: 1 / span 2; }
  .workflow-panel .step-name { min-width: 0; font-size: 12px; }
  .workflow-panel .step-label {
    grid-column: 2;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workflow-controls .step-card { padding: 18px 20px; }
  .workflow-controls .step-card.is-collapsed { min-width: 0; }
  .workflow-controls .step-card.is-collapsed h2 { font-size: 13px; }
  .workflow-controls #step1-card:not(.is-collapsed) .step-card-body {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    align-items: end;
    gap: 14px;
  }
  .workflow-controls #step1-card:not(.is-collapsed) .step-card-body > .grid { margin-bottom: 0; }
  .workflow-controls #step2-card .step-card-body > .grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
  .workflow-controls #step3-card .step-card-body > .grid { grid-template-columns: minmax(260px, 420px); }
  .results-panel .card { padding: 22px; }
  .results-panel > .card { scroll-margin-top: 128px; }
}

@media (max-width: 1099px) {
  .workspace-results-nav { top: 68px; }
}

@media (max-width: 767px) {
  .validation-card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .validation-card-header .btn-ucsc {
    width: 100%;
    white-space: normal;
    line-height: 1.3;
  }
  .workflow-controls { grid-template-columns: minmax(0, 1fr); }
  .workflow-panel > section[aria-label="Primer Design Wizard"] > .flex { align-items: flex-start; gap: 12px; }
  .workflow-panel > section[aria-label="Primer Design Wizard"] > .flex > div { min-width: 0; flex: 1; }
  .workflow-panel > section[aria-label="Primer Design Wizard"] .accordion-toggle { flex-shrink: 0; }

  #progress-container { padding: 14px; }
  #progress-container > h3 { margin-bottom: 9px; }
  #progress-container > div {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .workflow-panel .pipeline-step,
  .workflow-panel .pipeline-step:last-child {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    padding: 9px 4px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    text-align: center;
  }
  .workflow-panel .step-name { min-width: 0; font-size: 0; }
  #step-gene .step-name::after { content: '1. Gene'; }
  #step-sequence .step-name::after { content: '2. Variant'; }
  #step-primer .step-name::after { content: '3. Primers'; }
  .workflow-panel .step-name::after { font-size: 10px; font-weight: 700; }
  .workflow-panel .step-label { display: none; }
  .workspace-nav-label { display: none; }
  .workspace-results-nav button { flex: 1; min-width: max-content; }
  .stage-action-bar,
  .result-action-bar,
  .validation-actions { align-items: stretch; flex-direction: column; }
  .stage-action-bar .btn,
  .result-action-buttons,
  .result-action-buttons .btn,
  .validation-actions > .btn,
  .validation-actions-primary,
  .validation-actions-primary .btn { width: 100%; }
  .result-action-buttons,
  .validation-actions-primary { flex-direction: column; }
}

@media (max-width: 639px) {
  .workflow-panel #step1-card .step-card-body > .flex {
    align-items: stretch;
    flex-direction: column;
  }
  .workflow-panel #step1-card .step-card-body > .flex .btn {
    justify-content: center;
    width: 100%;
  }
  .results-panel #section-sequence > .flex:first-child {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

/* ─── Variant Format Help & Resolution Feedback ───────────────────────────── */
.variant-format-help {
  display: grid;
  gap: 4px;
  margin: -4px 0 16px;
  padding: 11px 13px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
}
.variant-format-help strong { color: #475569; font-family: 'Inter', system-ui, sans-serif; }

.variant-feedback {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 9px;
  font-size: 13px;
}
.variant-feedback-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 700;
}
.variant-feedback-title { font-weight: 700; }
.variant-feedback-message { margin-top: 2px; line-height: 1.45; }
.variant-feedback-suggestions { margin: 7px 0 0 18px; list-style: disc; }
.variant-feedback-suggestions li + li { margin-top: 3px; }

.variant-feedback-info { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
.variant-feedback-info .variant-feedback-icon { background: #dbeafe; }
.variant-feedback-success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.variant-feedback-success .variant-feedback-icon { background: #d1fae5; }
.variant-feedback-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.variant-feedback-error .variant-feedback-icon { background: #fee2e2; }

/* ─── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.animate-spin { animation: spin 1s linear infinite; }
.text-center { text-align: center; }

@media (min-width: 640px) {
  .hidden.sm\:block { display: block !important; }
  .hidden.sm\:inline { display: inline !important; }
}

/* Scrollbar styling */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: #f1f5f9; border-radius: 3px; }
::-webkit-scrollbar-thumb  { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Pipeline connector line */
.pipeline-connector {
  width: 1px;
  height: 14px;
  background: #e2e8f0;
  margin: 0 10px;
}

/* ─── Allele-Specific ARMS Results ────────────────────────────────────────── */
.arms-mode-note,
.arms-experimental-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #fbbf24;
  border-radius: 9px;
  background: #fffbeb;
  color: #78350f;
  font-size: 13px;
  line-height: 1.5;
}
.arms-mode-note strong,
.arms-experimental-banner strong { display: block; color: #92400e; }
.arms-experimental-banner span { display: block; margin-top: 2px; }

.arms-assay-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.arms-assay-choice {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font: 500 12px/1.35 inherit;
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.arms-assay-choice:hover { border-color: #60a5fa; background: #f8fbff; }
.arms-assay-choice:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.arms-assay-choice.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37,99,235,.14);
}
.arms-assay-rank { color: #1e3a8a; font-size: 13px; font-weight: 800; }
.arms-score { color: #64748b; font-size: 11px; }
.arms-assay-detail { display: grid; gap: 16px; }

.arms-band-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.arms-band-summary > div {
  display: grid;
  grid-template-columns: 6px auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.arms-band { grid-row: 1 / 3; width: 6px; min-height: 38px; border-radius: 3px; }
.arms-band-ref { background: #059669; }
.arms-band-alt { background: #ea580c; }
.arms-band-control { background: #4f46e5; }
.arms-band-summary strong { color: #0f172a; font-size: 17px; }
.arms-band-summary small { color: #64748b; }

.arms-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 10px; }
.arms-primer-table,
.arms-genotype-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.arms-primer-table th,
.arms-genotype-table th {
  padding: 9px 10px;
  background: #f8fafc;
  color: #475569;
  font-size: 10px;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
}
.arms-primer-table td,
.arms-genotype-table td { padding: 10px; border-top: 1px solid #e2e8f0; vertical-align: top; }
.arms-genotype-table th { width: 190px; border-top: 1px solid #e2e8f0; }
.arms-direction { margin-top: 2px; color: #64748b; font-size: 10px; text-transform: uppercase; }
.arms-sequence { min-width: 230px; color: #0f172a; font: 600 11px/1.6 'JetBrains Mono', monospace; word-break: break-all; }
.arms-subheading { color: #334155; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }

.arms-reactions,
.arms-guidance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.arms-reaction-card,
.arms-guidance-grid > div { padding: 13px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.arms-reaction-card h5 { margin-bottom: 6px; color: #1e3a8a; font-size: 13px; }
.arms-reaction-card p { color: #475569; font-size: 12px; line-height: 1.5; }
.arms-reaction-card p + p { margin-top: 4px; }
.arms-guidance-grid strong,
.arms-guidance-grid span { display: block; }
.arms-guidance-grid strong { margin-bottom: 3px; color: #334155; font-size: 11px; text-transform: uppercase; }
.arms-guidance-grid span { color: #475569; font-size: 12px; line-height: 1.45; }
.arms-warnings { padding: 12px 14px; border: 1px solid #fbbf24; border-radius: 9px; background: #fffbeb; color: #78350f; font-size: 12px; }
.arms-warnings strong { color: #92400e; }
.arms-warnings ul { margin: 6px 0 0 18px; list-style: disc; }
.arms-warnings li + li { margin-top: 3px; }
.arms-ucsc-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.arms-ucsc-links > span { margin-right: 2px; color: #475569; font-size: 12px; font-weight: 700; }
.arms-ucsc-links .btn { padding: 8px 11px; font-size: 11px; }
.pair-rank { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 23px; border-radius: 50%; background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 700; }

@media (max-width: 767px) {
  .arms-band-summary,
  .arms-reactions,
  .arms-guidance-grid { grid-template-columns: 1fr; }
  .arms-genotype-table th { width: 135px; }
  .arms-ucsc-links { align-items: stretch; flex-direction: column; }
  .arms-ucsc-links .btn { width: 100%; }
}

/* ─── Optional Support Modal ───────────────────────────────────────────────── */
body.modal-open { overflow: hidden; }

.support-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
}
.support-modal.hidden { display: none !important; }

.support-modal-panel {
  position: relative;
  width: min(100%, 440px);
  padding: 30px;
  border: 1px solid #dbe4ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  text-align: center;
  animation: supportModalIn 180ms ease-out;
  outline: none;
}

@keyframes supportModalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.support-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}
.support-modal-close:hover,
.support-modal-close:focus-visible { background: #f1f5f9; color: #0f172a; }

.support-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #d1fae5;
  color: #047857;
}

.support-modal-panel h2 { font-size: 21px; line-height: 1.3; color: #0f172a; }
.support-modal-panel > p { margin-top: 8px; color: #64748b; font-size: 14px; }

.support-amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
  border: 0;
}
.support-amounts legend {
  grid-column: 1 / -1;
  width: 100%;
  margin-bottom: 3px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.support-amount {
  min-height: 44px;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font: 600 14px/1.2 inherit;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.support-amount:hover { border-color: #34d399; background: #ecfdf5; }
.support-amount.is-selected {
  border-color: #059669;
  background: #ecfdf5;
  color: #047857;
  box-shadow: 0 0 0 2px rgba(5,150,105,0.13);
}

.support-modal-panel .support-payment-note {
  min-height: 42px;
  margin-top: 15px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
}
.support-payment-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.support-method {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font: 600 12px/1.2 inherit;
}
.support-method.is-selected { border-color: #059669; background: #ecfdf5; color: #047857; box-shadow: 0 0 0 2px rgba(5,150,105,.12); }
.support-payment-panel {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  background: #fff;
  text-align: left;
}
.support-payment-panel[hidden] { display: none; }
.support-payment-panel img {
  width: 190px;
  height: auto;
  max-width: 100%;
  flex: 0 0 190px;
  image-rendering: crisp-edges;
  border-radius: 6px;
}
.support-payment-details { display: grid; gap: 3px; min-width: 0; color: #475569; font-size: 11px; line-height: 1.4; }
.support-payment-details strong { color: #047857; font-size: 13px; }
.support-payment-details code { color: #0f172a; font-family: 'JetBrains Mono', monospace; font-size: 10px; overflow-wrap: anywhere; }
.support-payment-details small { margin-top: 4px; color: #94a3b8; font-size: 10px; }
.support-modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.support-modal-actions .btn { flex: 1; min-height: 42px; }
.support-secondary { background: #f1f5f9; border-color: #e2e8f0; color: #334155; }
.support-secondary:hover { background: #e2e8f0; }
.support-primary { background: #059669; border-color: #059669; color: #fff; }
.support-primary:hover:not(:disabled) { background: #047857; border-color: #047857; }
.support-modal-panel .support-reassurance { margin-top: 12px; color: #94a3b8; font-size: 11px; }

@media (max-width: 480px) {
  .support-modal-panel { padding: 26px 18px 22px; }
  .support-amounts { grid-template-columns: 1fr; }
  .support-modal-actions { flex-direction: column-reverse; }
  .support-payment-panel { align-items: center; flex-direction: column; text-align: center; }
  .support-payment-details { justify-items: center; }
}

/* ─── About / transparency modal ─────────────────────────────────────────── */
.info-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
}
.info-modal.hidden { display: none !important; }
.info-modal-panel {
  position: relative;
  width: min(100%, 620px);
  max-height: min(720px, calc(100vh - 40px));
  overflow-y: auto;
  padding: 30px 34px;
  border: 1px solid #dbe4ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  outline: none;
  animation: supportModalIn 180ms ease-out;
}
.info-modal-close {
  position: absolute; top: 12px; right: 14px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: transparent; color: #64748b;
  font-size: 25px; line-height: 1; cursor: pointer;
}
.info-modal-close:hover, .info-modal-close:focus-visible { background: #f1f5f9; color: #0f172a; }
.info-modal-kicker { margin: 0 0 6px; color: #2563eb; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.info-modal-panel h2 { margin: 0; color: #0f172a; font-size: 22px; line-height: 1.3; }
.info-modal-lead { margin: 9px 0 0; color: #64748b; font-size: 14px; line-height: 1.55; }
.info-modal-section { margin-top: 20px; color: #475569; font-size: 13px; line-height: 1.55; }
.info-modal-section h3 { margin: 0 0 7px; color: #1e293b; font-size: 14px; }
.info-modal-section ol { margin: 0; padding-left: 21px; }
.info-modal-section p { margin: 0; }
.developer-block { padding-top: 16px; border-top: 1px solid #e2e8f0; }
.developer-block a { color: #2563eb; text-decoration: underline; }
@media (max-width: 640px) {
  .info-modal-panel { padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .support-modal-panel { animation: none; }
}
