/* ============================================================
   奥科客户中心 — styles.css
   Refactored 2026-09-24:
   - Design tokens added (--fs-*, --sp-*, --radius-*, --btn-*)
   - Duplicate definitions consolidated (.orders-layout, .query-form.compact-form, media queries)
   - Dead code removed
   - .table-wrap base rule added
   - .sidebar-foot bottom-anchoring restored
   ============================================================ */

:root {
  /* Brand colors */
  --bg: #f7fafc;
  --panel: #ffffff;
  --ink: #334155;
  --muted: #64748b;
  --line: #e6ecf2;
  --brand: #4a90d9;
  --brand-strong: #3574b8;
  --accent: #5bb8b0;
  --ok: #34a17a;
  --warn: #b07d2e;

  /* Shadows */
  --shadow: 0 18px 48px rgba(70, 96, 128, 0.12);
  --shadow-sm: 0 8px 24px rgba(70, 96, 128, 0.06);

  /* Typography scale */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-base: 14px;
  --fs-lg: 16px;
  --fs-xl: 19px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;

  /* Button heights */
  --btn-sm: 28px;
  --btn-md: 34px;
  --btn-lg: 42px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(74, 144, 217, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(91, 184, 176, 0.10), transparent 36%),
    var(--bg);
  font-family: "IBM Plex Sans", Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

/* ============================================================
   Shell & Sidebar
   ============================================================ */

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 16px;
  color: var(--ink);
  background: linear-gradient(180deg, #f9fbfe 0%, #eef5fb 100%);
  border-right: 1px solid var(--line);
}

/* Collapse / expand handle pinned to the sidebar edge.
   Uses position: fixed so it stays pinned to the viewport (top-right of the
   sidebar) while the page scrolls — the button never scrolls out of view. */
.sidebar-toggle {
  position: fixed;
  top: 26px;
  left: 207px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--brand-strong);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(70, 96, 128, 0.16);
  cursor: pointer;
  line-height: 1;
}

.sidebar-toggle:hover {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.sidebar-toggle-icon {
  display: block;
  font-size: 17px;
  font-weight: 800;
  transform: translateX(-1px);
}

/* Immediate hover tooltip for the collapse/expand handle (custom, no native delay).
   Appears to the right of the button so it is never clipped by the viewport edge. */
.sidebar-toggle::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  padding: 6px 11px;
  background: #1f2d3d;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(31, 45, 61, 0.30);
  opacity: 0;
  pointer-events: none;
  z-index: 60;
}

.sidebar-toggle::before {
  content: "";
  position: absolute;
  left: calc(100% + 9px);
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #1f2d3d;
  opacity: 0;
  pointer-events: none;
  z-index: 60;
}

.sidebar-toggle:hover::after,
.sidebar-toggle:focus-visible::after,
.sidebar-toggle:hover::before,
.sidebar-toggle:focus-visible::before {
  opacity: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 4px 2px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #7cb8e8;
  color: #2b3644;
  font-size: 22px;
  font-weight: 800;
}

/* Logo replaces the letter mark. The source PNG has a white background, so on
   the pale sidebar it sits on a subtle white plate with a hairline border. */
.brand-logo {
  flex: 0 0 auto;
  height: 38px;
  width: auto;
  max-width: 100%;
  padding: 3px 5px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: 0 1px 4px rgba(70, 96, 128, 0.08);
}

/* Login brand lockup: drop the white plate (the panel is already light) so the
   blue wordmark sits directly on the surface, and scale it up for presence. */
.brand.compact .brand-logo {
  justify-self: start;
  height: 64px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.brand-title {
  font-size: var(--fs-lg);
  font-weight: 750;
  line-height: 1.25;
}

/* Slightly tighter title inside the narrower sidebar so it never wraps. */
.sidebar .brand-title {
  font-size: 15px;
}

.brand-subtitle,
.foot-label {
  color: #7c8b9d;
  font-size: var(--fs-sm);
  margin-top: var(--sp-1);
}

.menu {
  display: grid;
  gap: var(--sp-2);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  font-size: var(--fs-md);
  color: #4a5b6e;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
}

.menu-item.active {
  color: var(--brand-strong);
  background: rgba(74, 144, 217, 0.13);
  border-color: rgba(74, 144, 217, 0.22);
}

.menu-item:hover {
  color: var(--brand-strong);
  background: rgba(74, 144, 217, 0.07);
  border-color: rgba(74, 144, 217, 0.16);
}

.menu-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(74, 144, 217, 0.12);
  color: var(--brand);
}

/* Collapsible "分子生物学工具包" group (SMS2 / SMS3 submenu) */
.menu-group {
  display: grid;
  gap: var(--sp-2);
}

.menu-parent .menu-caret {
  margin-left: auto;
  font-size: 11px;
  line-height: 1;
  color: #90a2b6;
  transition: transform 0.22s ease;
}

.menu-parent.open .menu-caret {
  transform: rotate(180deg);
}

.menu-submenu {
  display: grid;
  gap: 4px;
  margin: 0 0 0 13px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid rgba(74, 144, 217, 0.2);
  overflow: hidden;
  animation: menu-submenu-in 0.22s ease;
}

.menu-submenu.hidden {
  display: none;
}

@keyframes menu-submenu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu-item.menu-subitem {
  min-height: 36px;
  padding: 0 10px 0 12px;
  font-size: var(--fs-sm);
  color: #5b6b7e;
}

.menu-item.menu-subitem::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
}

.menu-item.menu-subitem.active::before {
  opacity: 0.85;
}

/* FIX: restore bottom-anchoring (was overridden by margin-top:10px) */
.sidebar-foot {
  margin-top: auto;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(70, 96, 128, 0.05);
}

.foot-value {
  margin-top: var(--sp-1);
  font-size: var(--fs-md);
}

/* Current-customer details + action stack in the sidebar footer */
.foot-customer {
  margin-top: var(--sp-1);
}

.foot-detail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: 4px;
  font-size: var(--fs-sm);
}

.foot-detail span {
  flex: 0 0 auto;
  color: #8a98a9;
}

.foot-detail strong {
  min-width: 0;
  color: #3f4d5f;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.sidebar-foot-actions {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.sidebar-foot-actions .sidebar-button {
  margin-top: 0;
}

.sidebar-button.active {
  color: var(--brand-strong);
  background: rgba(74, 144, 217, 0.13);
  border-color: rgba(74, 144, 217, 0.22);
}

/* ============================================================
   我要反馈（客户服务）
   ============================================================ */
.feedback-hero {
  max-width: 880px;
  margin-bottom: var(--sp-5);
}

.feedback-hero h2 {
  margin-top: var(--sp-1);
  font-size: var(--fs-xl);
}

.feedback-hero p {
  margin-top: var(--sp-2);
  max-width: 760px;
  color: var(--muted);
  line-height: 1.8;
}

.feedback-form {
  display: grid;
  gap: var(--sp-4);
  max-width: 880px;
  padding: var(--sp-5);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.feedback-field {
  display: grid;
  gap: var(--sp-2);
}

.feedback-field-label {
  color: #334155;
  font-size: var(--fs-md);
  font-weight: 600;
}

.feedback-field-label em {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-style: normal;
  font-weight: 400;
}

.feedback-form textarea {
  width: 100%;
  padding: var(--sp-3);
  color: #334155;
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1.65;
  background: #fdfefe;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  resize: vertical;
}

.feedback-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.feedback-drop {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: #f8fbfe;
  border: 1px dashed #c6d6e6;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.feedback-drop:hover,
.feedback-drop.dragging {
  background: #eef6fd;
  border-color: var(--brand);
}

.feedback-drop-hint {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.feedback-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-1);
}

.feedback-preview {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.feedback-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feedback-preview-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  background: rgba(20, 30, 45, 0.6);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.feedback-preview-remove:hover {
  background: rgba(20, 30, 45, 0.85);
}

.feedback-contact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.feedback-contact span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.feedback-contact strong {
  overflow-wrap: anywhere;
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.feedback-actions .form-message {
  flex: 1 1 100%;
  margin: 0;
}

@media (max-width: 760px) {
  .feedback-contact {
    grid-template-columns: 1fr;
  }

  .feedback-form {
    padding: var(--sp-4);
  }
}

/* ============================================================
   Workspace & Topbar
   ============================================================ */

.workspace {
  min-width: 0;
  padding: var(--sp-8);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: var(--fs-3xl);
  line-height: 1.2;
}

.topbar p {
  margin-top: var(--sp-2);
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: var(--sp-2);
}

/* ============================================================
   Buttons
   ============================================================ */

.ghost-button,
.primary-button,
.reserved-button {
  min-height: var(--btn-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  cursor: pointer;
}

.ghost-button {
  padding: 0 var(--sp-4);
  color: var(--brand);
  background: var(--panel);
}

.primary-button {
  align-self: end;
  padding: 0 var(--sp-5);
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 700;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.primary-button.full {
  width: 100%;
}

.link-button {
  min-height: var(--btn-md);
  padding: 0;
  color: var(--brand);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.reserved-button {
  padding: 0 var(--sp-3);
  color: #64748b;
  background: #f4f8fc;
  border-color: #cbd5e1;
  cursor: not-allowed;
}

.sidebar-button {
  width: 100%;
  min-height: var(--btn-md);
  margin-top: var(--sp-3);
  color: #52627a;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.sidebar-button:hover {
  color: var(--brand-strong);
  border-color: #cfe0f2;
  background: #f3f8fd;
}

.file-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  color: #ffffff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 700;
}

.file-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   Module panels
   ============================================================ */

.module-panel {
  display: none;
}

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

/* ============================================================
   Customer strip
   ============================================================ */

.auth-copy,
.auth-card,
.modal-card,
.customer-strip {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(230, 236, 242, 0.9);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.customer-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: var(--sp-4);
}

.customer-strip div {
  padding: var(--sp-4) var(--sp-5);
  background: #ffffff;
}

.customer-strip span,
.order-info-grid span {
  display: block;
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-1);
}

.customer-strip strong,
.order-info-grid strong {
  font-size: var(--fs-lg);
}

.compact-customer-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: var(--sp-3);
}

.compact-customer-strip > div {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  min-width: 0;
  padding: var(--sp-2) var(--sp-4);
}

.compact-customer-strip span {
  display: inline;
  flex: none;
  margin-bottom: 0;
  white-space: nowrap;
}

.compact-customer-strip strong {
  min-width: 0;
  font-size: var(--fs-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .compact-customer-strip {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Query band & form
   ============================================================ */

.query-band {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(230, 236, 242, 0.86);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: var(--sp-4);
}

.query-form {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(150px, 1.1fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr) auto;
  gap: var(--sp-3);
}

/* CONSOLIDATED: single definition (was 3 conflicting) */
.query-form.compact-form {
  grid-template-columns: minmax(310px, 1.3fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr) minmax(180px, 1fr) auto;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: 650;
}

input {
  width: 100%;
  min-height: var(--btn-lg);
  padding: 0 var(--sp-3);
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
}

select {
  width: 100%;
  min-height: var(--btn-lg);
  padding: 0 var(--sp-3);
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
}

select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.18);
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.18);
}

textarea {
  width: 100%;
  min-height: 220px;
  padding: var(--sp-3);
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  resize: vertical;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  line-height: 1.45;
}

textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.18);
}

/* Quick range filter pills */
.quick-ranges {
  display: flex;
  align-items: end;
  gap: var(--sp-2);
  min-height: var(--btn-lg);
  flex-wrap: wrap;
}

.quick-range,
.synthesis-quick-range {
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: #2f4a63;
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(74, 144, 217, 0.16);
}

.quick-range[data-range="1m"],
.synthesis-quick-range[data-range="1m"] { background: linear-gradient(135deg, #a9cdea, #c2e0f5); }
.quick-range[data-range="3m"],
.synthesis-quick-range[data-range="3m"] { background: linear-gradient(135deg, #93b8de, #aecfee); }
.quick-range[data-range="6m"],
.synthesis-quick-range[data-range="6m"] { background: linear-gradient(135deg, #c3b8ea, #d7cdf4); }
.quick-range[data-range="year"],
.synthesis-quick-range[data-range="year"] { background: linear-gradient(135deg, #f2b8c8, #f8d3dd); }
.quick-range[data-range="month"],
.synthesis-quick-range[data-range="month"] { background: linear-gradient(135deg, #a9d4f0, #b9e6e0); }

.quick-range.active,
.synthesis-quick-range.active {
  outline: 3px solid rgba(74, 144, 217, 0.32);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(74, 144, 217, 0.24);
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: flex-end;
}

.status-message {
  min-height: 24px;
  margin: var(--sp-3) var(--sp-1);
  color: var(--muted);
  font-size: var(--fs-base);
}

.status-message.error {
  color: #d64545;
}

.form-message {
  min-height: 22px;
  color: var(--muted);
  font-size: var(--fs-md);
}

.form-message.error {
  color: #d64545;
}

/* ============================================================
   Tables — base
   ============================================================ */

/* NEW: base overflow rule for all table wrappers */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: var(--fs-base);
}

th {
  color: var(--muted);
  background: #f4f8fc;
  font-size: var(--fs-sm);
  font-weight: 760;
}

tr:last-child td {
  border-bottom: 0;
}

/* ============================================================
   Orders layout — CONSOLIDATED (was 4 definitions)
   ============================================================ */

.orders-layout {
  display: block;
  width: min(90%, 1400px);
  min-height: 0;
  margin: 0 auto;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.orders-list {
  width: 100%;
  border-right: 0;
  background: transparent;
  overflow: visible;
}

.order-list-section,
.detail-data-section {
  padding: var(--sp-3);
}

.order-card {
  display: grid;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-4);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
}

.order-card:hover,
.order-card.active {
  background: #ffffff;
}

.order-title {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  font-weight: 760;
}

.badge {
  flex: 0 0 auto;
  padding: 3px var(--sp-2);
  border-radius: var(--radius-full);
  color: var(--ok);
  background: rgba(52, 161, 122, 0.12);
  font-size: var(--fs-sm);
}

.order-meta,
.sample-meta {
  color: var(--muted);
  font-size: var(--fs-md);
}

/* Details pane is hidden — content shows in drawer */
.details-pane {
  display: none;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 450px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: var(--sp-3);
  border-radius: var(--radius-md);
  color: var(--brand);
  background: rgba(74, 144, 217, 0.1);
  font-size: var(--fs-3xl);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
}

.detail-head h2 {
  font-size: var(--fs-2xl);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.pill {
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-full);
  color: var(--muted);
  background: #f4f8fc;
  font-size: var(--fs-sm);
}

.sample-table-wrap {
  margin-top: var(--sp-4);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.path-text {
  max-width: 320px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  word-break: break-all;
}

.order-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.order-info-grid div {
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f7fafd;
}

/* ============================================================
   Detail drawer
   ============================================================ */

body.drawer-open {
  overflow: hidden;
}

.detail-drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 900;
}

.detail-drawer-shell.hidden {
  display: none;
}

.detail-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 41, 59, 0.28);
}

.detail-drawer {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(78vw, 1360px);
  height: 100vh;
  background: #ffffff;
  box-shadow: -24px 0 60px rgba(30, 41, 59, 0.18);
}

.detail-drawer-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.detail-drawer-bar h2 {
  font-size: var(--fs-xl);
  line-height: 1.3;
}

.detail-drawer-bar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--fs-md);
}

.detail-drawer-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  color: var(--brand);
  background: #f7fafd;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--fs-2xl);
  line-height: 1;
}

.detail-drawer-close:hover {
  background: #edf5fb;
  border-color: #bcd9f0;
}

.detail-drawer-content {
  min-width: 0;
  overflow: auto;
  padding: var(--sp-4);
  background: #f7fafd;
}

.detail-drawer-content .empty-state {
  min-height: calc(100vh - 96px);
}

.detail-drawer-content .data-section,
.detail-drawer-content .order-detail-card {
  background: #ffffff;
}

.detail-drawer-content .table-wrap {
  overflow-x: auto;
}

/* ============================================================
   Data tables (sequencing/synthesis results)
   ============================================================ */

.data-section h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-2);
  color: #64748b;
  font-size: var(--fs-md);
  font-weight: 700;
}

.data-section h4 span {
  color: #94a3b8;
  font-size: var(--fs-xs);
  font-weight: 400;
}

.data-table {
  font-size: var(--fs-sm);
  min-width: 720px;
}

.orders-table {
  min-width: 680px;
}

.reactions-table {
  min-width: 1080px;
}

.data-table thead th {
  padding: 7px var(--sp-2);
  background: #f4f8fc;
  color: #64748b;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 7px var(--sp-2);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table tbody tr.clickable {
  cursor: pointer;
}

.data-table tbody tr.clickable:hover,
.data-table tbody tr.active-row {
  background: #eef6fc;
}

.data-table tbody td.sequence-cell {
  max-width: 360px;
  white-space: normal;
  word-break: break-all;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.link-strong {
  color: var(--brand);
}

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.tag-green { background: #e6f6ee; color: #2f8f5b; }
.tag-red { background: #fdeeee; color: #c0453f; }
.tag-blue { background: #edf5fb; color: #3574b8; }
.tag-gray { background: #f4f8fc; color: #64748b; }
.tag-purple { background: #f3f0fb; color: #8b7ec8; }
.tag-teal { background: #e8f7f4; color: #1f8a7d; }
.tag-orange { background: #fdf4ec; color: #a9682a; }

.null-val {
  color: #cbd5e1;
  font-style: italic;
}

/* ============================================================
   Order detail card
   ============================================================ */

.order-detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
}

.teal-head {
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  color: #ffffff;
  background: linear-gradient(135deg, #3574b8, #4a90d9);
  border-bottom: 0;
}

.teal-head h2,
.teal-head .pill {
  color: #ffffff;
}

.teal-head .pill {
  background: rgba(255, 255, 255, 0.15);
}

.order-lite-info {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  padding: var(--sp-2) var(--sp-3);
  color: #64748b;
  background: #f4f8fc;
  font-size: var(--fs-sm);
}

.detail-summary {
  box-shadow: none;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

.success-text { color: var(--ok); }
.danger-text { color: #d64545; }
.warn-text { color: var(--warn); }
.brand-text { color: var(--brand); }

.download-button {
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  color: #3574b8;
  background: #edf5fb;
  border: 1px solid rgba(53, 116, 184, 0.18);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
}

.download-button:hover {
  background: #d6e8f7;
}

.mini-downloads {
  display: inline-flex;
  gap: var(--sp-1);
}

.mini-downloads a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  color: #3574b8;
  background: #edf5fb;
  border: 1px solid #bcd9f0;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-decoration: none;
}

.mini-downloads a:hover {
  background: #d6e8f7;
}

.mini-downloads .download-link-disabled {
  opacity: 0.42;
  color: var(--muted-text, #94a3b8);
  cursor: not-allowed;
  text-decoration: none;
  pointer-events: none;
}

.inline-stats {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--line);
  background: #ffffff;
  white-space: nowrap;
  overflow-x: auto;
}

.inline-stats span {
  color: #64748b;
  font-size: var(--fs-sm);
}

.inline-stats strong {
  margin-right: 3px;
  font-size: var(--fs-lg);
}

.compact-order-detail .detail-head {
  align-items: center;
}

.compact-order-detail .download-actions {
  flex-wrap: nowrap;
}

/* ============================================================
   Synthesis tables
   ============================================================ */

.synthesis-orders-table {
  min-width: 760px;
}

.synthesis-sequences-table {
  min-width: 1180px;
}

.synthesis-detail-table {
  min-width: 980px;
}

.synthesis-delivery-table {
  min-width: 820px;
}

/* ============================================================
   Pagination
   ============================================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--sp-2) 0 2px;
  flex-wrap: wrap;
}

.pagination button {
  min-height: var(--btn-sm);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  font-size: var(--fs-sm);
}

.pagination button:hover:not(:disabled) {
  background: #f4f8fc;
}

.pagination button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.page-info {
  color: #64748b;
  font-size: var(--fs-sm);
}

/* ============================================================
   History
   ============================================================ */

.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}

.history-header h2 {
  margin: 5px 0;
  color: var(--brand-strong);
  font-size: var(--fs-3xl);
}

.history-header p {
  margin: 0;
  color: var(--muted);
}

.history-list {
  --history-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
  --history-serif: "DejaVu Serif", "Liberation Serif", Georgia, "Times New Roman", "Songti SC", "SimSun", "Noto Serif CJK SC", serif;
  --history-line: #e8edf4;
  --history-label: #8494a8;
  display: grid;
  gap: 12px;
}

.history-card {
  overflow: hidden;
  border: 1px solid var(--history-line);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.history-card:hover {
  border-color: #d3dfee;
  box-shadow: 0 8px 22px rgba(47, 111, 237, 0.06);
}

.history-card.expanded {
  border-color: #c7d9f2;
  box-shadow: 0 12px 30px rgba(47, 111, 237, 0.08);
}

.history-card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 16px 20px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.history-card-summary:hover {
  background: #f8fbff;
}

.history-card-main {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.history-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.history-card-extra {
  min-width: 0;
  overflow: hidden;
  color: #7b8a9e;
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-type-badge {
  flex: none;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.history-type-badge.is-sequencing {
  color: #b23a2e;
  background: #fdeeeb;
  border-color: #f6d6d0;
}

.history-type-badge.is-synthesis {
  color: #166a66;
  background: #e9f6f4;
  border-color: #cde9e4;
}

.history-type-badge.is-gene {
  color: #1e40af;
  background: #e9effc;
  border-color: #cfdcf7;
}

.history-type-badge.is-mixed {
  color: #6d3bbf;
  background: #f3edff;
  border-color: #e2d4fb;
}

.history-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #93a1b3;
  font-size: var(--fs-sm);
}

.history-meta-label {
  flex: none;
}

.history-order-id {
  min-width: 0;
  color: #5c6d84;
  font-family: var(--history-mono);
  font-size: 12px;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.history-meta-sep {
  color: #c6d0dc;
}

.history-card-side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-status {
  flex: none;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.4;
}

.history-status.is-submitted {
  color: #166534;
  background: #e8f6ee;
  border-color: #c9ead5;
}

.history-status.is-processing {
  color: #92400e;
  background: #fff4e0;
  border-color: #f3dfb9;
}

.history-status.is-failed {
  color: #991b1b;
  background: #fde8e8;
  border-color: #f3caca;
}

.history-chevron {
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 1.6px solid #9aa8ba;
  border-bottom: 1.6px solid #9aa8ba;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.18s ease;
}

.history-card.expanded .history-chevron {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.history-detail {
  display: none;
  padding: 2px 20px 20px;
  border-top: 1px solid var(--history-line);
  background: #fcfdff;
}

.history-card.expanded .history-detail {
  display: block;
}

.history-sheet {
  padding-top: 14px;
}

.history-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--history-line);
}

.history-sheet-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.history-sheet-eyebrow {
  color: var(--history-label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.history-sheet-id {
  overflow-wrap: anywhere;
  color: #64748b;
  font-family: var(--history-mono);
  font-size: 12px;
}

.history-section {
  margin-top: 18px;
}

.history-section h5 {
  margin: 0 0 6px;
  color: var(--history-label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.history-facts {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--history-serif);
}

.history-facts th,
.history-facts td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--history-line);
  text-align: left;
  vertical-align: baseline;
}

.history-facts th {
  width: 128px;
  color: var(--history-label);
  font-family: "IBM Plex Sans", Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.history-facts td {
  color: #243447;
  font-size: 14px;
  line-height: 1.55;
}

.history-facts tr:last-child th,
.history-facts tr:last-child td {
  border-bottom: 0;
}

.history-facts td.is-mono {
  font-family: var(--history-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--history-line);
  border-radius: 8px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--history-serif);
  background: #fff;
}

.history-table th {
  padding: 8px 10px;
  border-bottom: 1px solid #d8e1ec;
  color: #6b7c93;
  background: #f8fafc;
  font-family: "IBM Plex Sans", Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: nowrap;
}

.history-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--history-line);
  color: #243447;
  font-size: 13px;
  vertical-align: top;
}

.history-table tbody tr:last-child td {
  border-bottom: 0;
}

.history-table .num {
  color: #93a1b3;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.history-table td.is-mono {
  font-family: var(--history-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.history-seq {
  max-height: 280px;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--history-line);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-family: var(--history-mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre;
}

.history-seq-note {
  margin-top: 7px;
  color: #8a97a8;
  font-size: var(--fs-sm);
}

.history-files {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.history-file-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid #d5e1f2;
  border-radius: 8px;
  color: #2f6fed;
  background: #fff;
  font-size: var(--fs-sm);
  text-decoration: none;
}

.history-file-link:hover {
  border-color: #b9d0ee;
  background: #f3f8ff;
}

.history-muted {
  color: var(--muted);
  font-size: var(--fs-md);
}

/* ============================================================
   Placeholder
   ============================================================ */

.placeholder {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(230, 236, 242, 0.86);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: var(--sp-8);
}

.placeholder h2 {
  font-size: var(--fs-2xl);
}

.placeholder p {
  margin-top: var(--sp-2);
  color: var(--muted);
}

/* ============================================================
   Auth screen
   ============================================================ */

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-8);
}

.auth-panel {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 420px;
  gap: var(--sp-6);
  align-items: stretch;
}

.auth-copy {
  padding: 34px;
  display: grid;
  align-content: center;
  gap: var(--sp-6);
}

/* Login brand block reads as a proper branded header: wordmark on top, then a
   strong portal name, a tracked tagline, and a hairline separating it from the
   headline below. */
.brand.compact {
  display: grid;
  gap: 20px;
  padding: 0 0 18px;
  color: var(--ink);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.brand.compact .brand-title {
  color: #334155;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.045em;
  line-height: 1.2;
}

.brand.compact .brand-subtitle {
  margin-top: 8px;
  color: #8a99ab;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.5;
}

.auth-copy h1 {
  font-size: 42px;
  max-width: 580px;
}

.auth-copy p {
  max-width: 580px;
  color: var(--muted);
  line-height: 1.8;
}

.auth-card {
  padding: 26px;
  display: grid;
  gap: var(--sp-4);
}

.auth-card h2,
.modal-card h2 {
  font-size: var(--fs-2xl);
}

/* ============================================================
   Modal
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: grid;
  place-items: center;
  padding: var(--sp-6);
  background: rgba(30, 41, 59, 0.35);
}

.modal-card {
  width: min(440px, 100%);
  display: grid;
  gap: 15px;
  padding: var(--sp-6);
}

.modal-card p {
  color: var(--muted);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.wide-modal-card {
  width: min(760px, calc(100vw - 32px));
}

.order-confirm-card {
  width: min(1180px, 94vw);
  max-width: none;
}

.order-summary-box {
  display: grid;
  gap: var(--sp-2);
  max-height: 56vh;
  overflow: auto;
  color: var(--ink);
  font-size: var(--fs-md);
}

.order-summary-table-wrap {
  width: 100%;
  padding: var(--sp-3);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: auto;
}

.order-confirm-card .ordering-preview-table {
  min-width: 90%;
  margin: 0 auto;
}

/* ============================================================
   Primer design module
   ============================================================ */

.primer-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 0.9fr);
  gap: var(--sp-4);
  align-items: stretch;
}

.primer-input-panel,
.primer-params-panel,
.primer-results {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(230, 236, 242, 0.9);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.primer-input-panel,
.primer-params-panel {
  padding: var(--sp-4);
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.panel-title-row h2 {
  font-size: var(--fs-xl);
  line-height: 1.25;
}

.panel-title-row p {
  margin-top: var(--sp-1);
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.45;
}

.segmented-control {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f7fafd;
}

.segmented-control label {
  display: block;
  color: var(--muted);
  font-size: var(--fs-md);
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  place-items: center;
  min-width: 62px;
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.segmented-control input:checked + span {
  color: #ffffff;
  background: var(--brand);
}

.sequence-input-label {
  gap: var(--sp-2);
}

.sequence-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.sequence-input-label:has(.sequence-clear-button) > span:first-child::after {
  content: none;
}

.sequence-label-text::after {
  content: " *";
  color: #d64545;
  font-weight: 700;
}

.sequence-clear-button {
  min-height: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.sequence-clear-button:hover {
  color: var(--brand-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

#primerSequence {
  min-height: 410px;
}

.sequence-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  color: var(--muted);
  font-size: var(--fs-md);
}

.primer-param-grid,
.primer-core-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

.primer-core-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: var(--sp-3);
}

.checkbox-line {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  margin-top: var(--sp-4);
  color: var(--ink);
  font-size: var(--fs-base);
  cursor: pointer;
}

.checkbox-line input {
  width: 16px;
  min-height: 16px;
}

.primer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.primer-actions .primary-button,
.primer-actions .ghost-button {
  align-self: auto;
}

.primer-results {
  margin-top: var(--sp-4);
  overflow: hidden;
}

.primer-results .msg-empty {
  padding: var(--sp-6);
}

.primer-results-section {
  padding: var(--sp-4);
}

.primer-batch-section + .primer-batch-section {
  border-top: 1px solid rgba(230, 236, 242, 0.9);
}

.error-text {
  color: #d64545;
}

/* Specificity browser */

.primer-specificity-section {
  border-top: 1px solid rgba(230, 236, 242, 0.9);
}

.specificity-header {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  align-items: flex-start;
  margin-bottom: var(--sp-3);
}

.specificity-header p {
  margin-top: var(--sp-1);
  color: var(--muted);
  font-size: var(--fs-md);
}

.specificity-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: flex-end;
}

.specificity-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--sp-3);
}

.specificity-categories {
  display: grid;
  gap: var(--sp-2);
}

.specificity-category {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 48px;
  padding: var(--sp-2) var(--sp-2);
  color: var(--ink);
  background: #f7fafd;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.specificity-category span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #ffffff;
  background: var(--brand);
  border-radius: 50%;
  font-size: var(--fs-sm);
  font-weight: 900;
}

.specificity-category.active {
  border-color: rgba(74, 144, 217, 0.5);
  background: #eef6fc;
}

.specificity-browser {
  display: grid;
  gap: var(--sp-2);
}

.specificity-search {
  width: 100%;
}

.specificity-microbe-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: var(--sp-2);
  align-items: center;
}

.specificity-microbe-input {
  width: 100%;
}

.specificity-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.specificity-subtabs button {
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
}

.specificity-subtabs button.active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.specificity-species-list {
  display: grid;
  gap: var(--sp-2);
  max-height: 320px;
  overflow: auto;
}

.specificity-species {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
}

.specificity-species.active {
  border-color: rgba(74, 144, 217, 0.55);
  background: #eef6fc;
}

.specificity-species strong,
.specificity-species em,
.specificity-species small {
  display: block;
}

.specificity-species em {
  margin-top: 3px;
  color: var(--muted);
  font-style: normal;
  font-size: var(--fs-sm);
}

.specificity-species small {
  color: var(--muted);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.specificity-selected {
  color: var(--brand);
  font-size: var(--fs-md);
  font-weight: 800;
}

.specificity-confirm-note {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-left: 4px solid #e8964a;
  border-radius: var(--radius-md);
  background: #fdf4ec;
  color: #a9682a;
  line-height: 1.65;
}

.specificity-confirm-ack {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  color: var(--ink);
  font-weight: 700;
}

.specificity-confirm-ack input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

/* Primer table & popover */

.primer-table {
  min-width: 1380px;
}

.primer-table th,
.primer-table td {
  vertical-align: middle;
}

.primer-table th:first-child,
.primer-table td:first-child {
  width: 42px;
  text-align: center;
}

.primer-pair-select,
.primer-select-page {
  width: 16px;
  min-height: 16px;
  cursor: pointer;
}

.primer-pair-row.primer-pair-alt td {
  background: #f7fafd;
}

.primer-pair-row:hover td {
  background: #eef6fc;
}

.primer-pagination {
  padding-top: var(--sp-3);
}

.primer-sequence {
  min-width: 190px;
}

.primer-metric {
  display: inline-block;
  margin-left: var(--sp-1);
  color: #64748b;
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.primer-structure-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 26px;
  cursor: help;
  outline: none;
}

.primer-position-trigger {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  color: var(--brand);
  border-bottom: 1px dotted rgba(74, 144, 217, 0.5);
  cursor: help;
  font-weight: 800;
  outline: none;
}

.primer-position-trigger:focus-visible {
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.18);
  border-radius: var(--radius-sm);
}

.primer-structure-trigger:focus-visible {
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.18);
  border-radius: var(--radius-sm);
}

.primer-structure-popover {
  position: fixed;
  z-index: 1000;
  margin: 0;
  padding: var(--sp-3);
  color: #e9f2fa;
  background: #2b3644;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 40px rgba(31, 41, 55, 0.28);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  line-height: 1.45;
  text-align: left;
  pointer-events: none;
}

.primer-structure-popover.hidden {
  display: none;
}

.primer-structure-popover pre {
  margin: var(--sp-2) 0 0;
  overflow-x: auto;
  white-space: pre;
}

.primer-structure-popover .primer-position-diagram {
  color: #e9f2fa;
  overflow: visible;
  white-space: pre;
  font-size: var(--fs-xs);
  line-height: 1.55;
}

.primer-position-heading {
  color: #7cb8e8;
  font-family: "IBM Plex Sans", Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: var(--fs-md);
  font-weight: 800;
}

.primer-position-sub,
.primer-position-note {
  margin-top: var(--sp-1);
  color: #c7d3e0;
  font-family: "IBM Plex Sans", Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.primer-position-map {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 5px var(--sp-2);
  width: 540px;
  margin-top: var(--sp-2);
}

.primer-position-label {
  color: #c7d3e0;
  font-family: "IBM Plex Sans", Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: var(--fs-sm);
  font-weight: 800;
  line-height: 18px;
  white-space: nowrap;
}

.primer-position-track {
  position: relative;
  height: 18px;
  margin-right: var(--sp-5);
  overflow: visible;
}

.primer-position-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 1px;
  background: #9fb3c8;
}

.primer-position-product {
  position: absolute;
  top: 1px;
  height: 16px;
  min-width: 2px;
  background: #d64545;
  border-radius: 3px;
  z-index: 1;
}

.primer-forward-primer,
.primer-reverse-primer {
  position: absolute;
  top: 0;
  height: 18px;
  min-width: 18px;
  color: #ffffff;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  font-weight: 800;
  line-height: 18px;
  white-space: nowrap;
  z-index: 2;
}

.primer-reverse-primer {
  text-align: right;
}

.primer-position-coord-row {
  height: 16px;
}

.primer-position-coord {
  position: absolute;
  color: #7cb8e8;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  font-weight: 800;
  white-space: nowrap;
}

.primer-position-coord.coord-start {
  transform: translateX(0);
}

.primer-position-coord.coord-end {
  transform: translateX(-50%);
}

.primer-structure-title {
  color: #7cb8e8;
  font-family: "IBM Plex Sans", Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: var(--fs-sm);
  font-weight: 800;
  white-space: normal;
}

/* ============================================================
   Ordering module
   ============================================================ */

/* Service-type tabs (引物合成 / 测序下单 / 基因合成) */
.ordering-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-sm);
}

.ordering-tab {
  flex: 1 1 190px;
  display: grid;
  gap: 2px;
  padding: 10px 16px;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ordering-tab:hover {
  color: var(--brand-strong);
  background: #f1f7fd;
}

.ordering-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  box-shadow: 0 10px 22px rgba(74, 144, 217, 0.28);
}

.ordering-tab-title {
  font-size: var(--fs-base);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ordering-tab-desc {
  font-size: var(--fs-xs);
  opacity: 0.82;
}

.ordering-tab-panel.hidden {
  display: none;
}

.sequencing-mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
}

.sequencing-mode-button {
  padding: 8px 18px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.sequencing-mode-button:hover {
  color: var(--brand-strong);
  background: #f1f7fd;
}

.sequencing-mode-button.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  box-shadow: 0 8px 18px rgba(74, 144, 217, 0.26);
}

.sequencing-mode-panel.hidden {
  display: none;
}

.ordering-placeholder {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--sp-2);
  min-height: 280px;
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px dashed #cddcec;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.ordering-placeholder-badge {
  display: inline-block;
  padding: 4px 14px;
  color: var(--brand-strong);
  background: #eaf3fc;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.14em;
}

.ordering-placeholder h2 {
  font-size: var(--fs-xl);
}

.ordering-placeholder p {
  max-width: 440px;
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.6;
}

.ordering-layout {
  display: block;
}

.ordering-panel {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(230, 236, 242, 0.86);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.ordering-actions {
  display: flex;
  justify-content: flex-end;
}

.ordering-extra-grid {
  display: grid;
  gap: var(--sp-3);
}

.address-manager {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8fbfb;
}

.address-manager-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
}

.address-select-label {
  display: grid;
  gap: var(--sp-1);
  flex: 1 1 320px;
}

.address-select-label span {
  font-weight: 600;
  color: var(--muted);
}

.address-empty-hint {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.address-empty-hint.hidden {
  display: none;
}

.address-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}

.address-list:empty {
  display: none;
}

.address-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: pointer;
}

.address-item:hover {
  border-color: var(--primary, #176b69);
}

.address-item.selected {
  border-color: var(--primary, #176b69);
  background: #eef7f6;
}

.address-item-info {
  display: grid;
  gap: 2px;
  flex: 1 1 200px;
  min-width: 0;
}

.address-item-title {
  font-weight: 600;
}

.address-item-detail {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.address-item-actions {
  display: flex;
  gap: var(--sp-2);
}

.address-link {
  cursor: pointer;
  border: none;
  background: none;
  color: var(--primary, #176b69);
  font-size: var(--fs-sm);
  padding: 2px 4px;
  text-align: left;
}

.address-link:hover {
  text-decoration: underline;
}

.address-link.danger {
  color: #c0392b;
}

.address-link.is-default,
.address-link:disabled {
  color: var(--muted);
  cursor: default;
  text-decoration: none;
}

.address-form-grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.address-form-grid .address-detail-label {
  grid-column: 1 / -1;
}

.address-form-grid textarea {
  width: 100%;
}

@media (max-width: 560px) {
  .address-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.address-modal-hint {
  margin: 0;
}

.ordering-grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: flex-end;
}

.ordering-sheet-wrap {
  max-height: 50vh;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.ordering-sheet {
  width: 100%;
  min-width: 0;
  table-layout: auto;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.ordering-sheet col.col-name { width: 15%; }
.ordering-sheet col.col-sequence { width: 27%; }
.ordering-sheet col.col-od { width: 9%; }
.ordering-sheet col.col-tubes { width: 8%; }
.ordering-sheet col.col-purification { width: 11%; }
.ordering-sheet col.col-mod-five { width: 10%; }
.ordering-sheet col.col-mod-three { width: 9%; }
.ordering-sheet col.col-note { width: 12%; }
.ordering-sheet col.col-actions { width: 3%; }

.ordering-sheet th,
.ordering-sheet td {
  padding: 0;
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  overflow-wrap: break-word;
}

.ordering-sheet th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: var(--btn-md);
  padding: 0 var(--sp-2);
  color: var(--muted);
  background: #f4f8fc;
  text-align: left;
  font-weight: 800;
  white-space: nowrap;
}

.ordering-sheet input,
.ordering-sheet select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: var(--btn-md);
  padding: 0 6px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  font-size: var(--fs-sm);
}

.ordering-sheet select {
  padding-right: 2px;
  text-overflow: ellipsis;
}

.ordering-sheet input[data-order-field="sequence"] {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  overflow-wrap: break-word;
}

.ordering-sheet input:focus,
.ordering-sheet select:focus {
  position: relative;
  z-index: 1;
  box-shadow: inset 0 0 0 2px rgba(74, 144, 217, 0.45);
}

.ordering-sheet .ordering-row-delete {
  min-height: 30px;
  padding: 0 var(--sp-2);
  border: 0;
  box-shadow: none;
  white-space: nowrap;
}

.ordering-dup-hint {
  margin-top: var(--sp-2);
  padding: 9px var(--sp-3);
  border: 1px solid #f2c9a3;
  border-radius: var(--radius-md);
  background: #fdf4ec;
  color: #a9682a;
  font-size: var(--fs-md);
  line-height: 1.5;
}

.ordering-dup-inline {
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  background: #fdf4ec;
  color: #a9682a;
  font-size: var(--fs-sm);
}

.ordering-sheet tr.ordering-row-duplicate td,
.order-summary-table-wrap tr.ordering-row-duplicate td {
  background: #fdf4ec;
  box-shadow: inset 3px 0 0 #e8964a;
}

.ordering-sheet tr.ordering-row-duplicate input,
.ordering-sheet tr.ordering-row-duplicate select {
  background: #fdf4ec;
}

.dup-legend {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: #fbe4d3;
  color: #a9682a;
  font-weight: 700;
}

.ordering-preview {
  display: grid;
  gap: var(--sp-2);
  color: var(--muted);
  font-size: var(--fs-md);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f7fafd;
}

.ordering-preview:empty {
  display: none;
}

.ordering-preview-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
  font-size: var(--fs-sm);
}

.ordering-preview-table th,
.ordering-preview-table td {
  padding: var(--sp-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  word-break: break-all;
}

/* ============================================================
   Sequencing upload / edit
   ============================================================ */

.sequencing-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f7fafd;
}

.sequencing-upload-row > span {
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: 700;
}

.sequencing-upload-row a {
  color: var(--brand);
  font-size: var(--fs-md);
  font-weight: 700;
  text-decoration: none;
}

.sequencing-upload-row a:hover {
  text-decoration: underline;
}

.sequencing-upload-row strong {
  min-width: 0;
  color: var(--ink);
  font-size: var(--fs-md);
  overflow-wrap: anywhere;
}

.sequencing-card {
  margin-top: var(--sp-5);
  padding: var(--sp-6);
  border: 1px solid #d6e8f7;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eef6fc 0%, #ffffff 58%, #f7fafc 100%);
  box-shadow: 0 14px 36px rgba(74, 144, 217, 0.10);
}

.sequencing-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-4);
}

.sequencing-eyebrow {
  color: #4a90d9;
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.sequencing-card h2 {
  margin: 5px 0 5px;
  color: #2b5d8a;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -.04em;
}

.sequencing-card p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-base);
}

.template-link {
  color: #4a90d9;
  font-size: var(--fs-md);
  font-weight: 800;
  white-space: nowrap;
}

.sequencing-dropzone {
  display: flex;
  min-height: 145px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 2px dashed #7cb8e8;
  border-radius: var(--radius-lg);
  color: #64748b;
  background: rgba(255, 255, 255, .76);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.sequencing-dropzone:hover,
.sequencing-dropzone.is-dragging {
  border-color: #4a90d9;
  background: #eef6fc;
  transform: translateY(-2px);
}

.sequencing-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.sequencing-dropzone strong {
  color: #2b5d8a;
  font-size: 17px;
}

.sequencing-dropzone em {
  color: #4a90d9;
  font-size: var(--fs-md);
  font-style: normal;
  font-weight: 700;
}

.dropzone-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #4a90d9;
  font-size: 22px;
  font-weight: 800;
}

.sequencing-editor {
  margin-top: var(--sp-4);
  border: 1px solid #e6ecf2;
  border-radius: var(--radius-lg);
  background: #ffffff;
  overflow: hidden;
}

.sequencing-editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid #eaf0f6;
  color: var(--muted);
  font-size: var(--fs-md);
}

.sequencing-editor-toolbar span:nth-child(2) { margin-right: auto; }

.sequencing-table-wrap { overflow: auto; max-height: 420px; }
.sequencing-edit-table { min-width: 720px; width: 100%; border-collapse: collapse; }
.sequencing-edit-table td { min-width: 125px; padding: 5px; border-right: 1px solid #eef2f7; border-bottom: 1px solid #eef2f7; }
.sequencing-edit-table td input { width: 100%; box-sizing: border-box; padding: var(--sp-2) 9px; border: 1px solid transparent; border-radius: var(--radius-sm); background: #fbfcfe; }
.sequencing-edit-table td input:focus { border-color: #4a90d9; outline: 2px solid rgba(74, 144, 217, .14); background: white; }
.sequencing-edit-table .sequencing-row-action { min-width: 68px; text-align: center; }

/* ============================================================
   Utility
   ============================================================ */

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   分子生物学工具 (SMS2)
   ============================================================ */

.mtools-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}

.mtools-heading h2 {
  margin: 5px 0;
  color: var(--brand-strong);
  font-size: var(--fs-3xl);
}

.mtools-heading p {
  max-width: 760px;
  color: var(--muted);
}

.mtools-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.mtools-actions .ghost-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.mtools-frame-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mtools-frame-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-4);
  color: var(--brand-strong);
  background: linear-gradient(180deg, #f6fafe, #eef5fb);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-md);
}

.mtools-frame-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(74, 144, 217, 0.15);
}

.mtools-frame-title {
  font-weight: 700;
}

.mtools-frame-hint {
  max-width: 46%;
  margin-left: auto;
  overflow: hidden;
  color: var(--muted);
  font-family: "DejaVu Sans Mono", Consolas, monospace;
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mtools-frame {
  display: block;
  width: 100%;
  height: clamp(560px, calc(100vh - 250px), 1100px);
  border: 0;
  background: #f7fafc;
}

/* 分子生物学 SMS2 汉化：整页嵌入，去掉包裹层多余头部 */
.mtools-embed {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mtools-embed .mtools-frame {
  height: calc(100vh - 168px);
  min-height: 640px;
}

/* ============================================================
   Media queries — CONSOLIDATED
   (was 3× @media 1100px, 3× @media 720px, 1× 1180px, 1× 900px, 1× 760px)
   ============================================================ */

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

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .query-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .query-form.compact-form {
    grid-template-columns: 1fr 1fr;
  }

  .quick-ranges {
    grid-column: 1 / -1;
  }

  .primary-button {
    align-self: stretch;
  }

  .orders-layout {
    width: min(95%, 1400px);
  }
}

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

  .auth-copy h1 {
    font-size: 32px;
  }

  .customer-strip,
  .order-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    display: block;
  }

  .sidebar {
    min-height: auto;
  }

  .menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: var(--sp-4);
  }

  .topbar {
    display: grid;
  }

  .query-form,
  .query-form.compact-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .orders-layout {
    width: 100%;
  }

  .detail-drawer {
    width: min(94vw, 100%);
  }

  .detail-drawer-content {
    padding: var(--sp-3);
  }

  .history-header {
    flex-direction: column;
  }

  .history-card-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .history-card-side {
    justify-content: flex-end;
  }

  .history-card-extra {
    white-space: normal;
  }

  .history-facts th {
    width: 100px;
  }

  .panel-title-row,
  .sequence-meta {
    display: grid;
  }

  .primer-param-grid,
  .primer-core-grid {
    grid-template-columns: 1fr;
  }

  .specificity-microbe-tools {
    grid-template-columns: 1fr;
  }

  .sequencing-card {
    padding: var(--sp-4);
  }

  .sequencing-card-heading {
    flex-direction: column;
    gap: var(--sp-2);
  }

  .sequencing-editor-toolbar span:nth-child(2) {
    margin-right: 0;
  }
}

/* ============================================================
   Collapsible sidebar (icon-only mode)
   Only applies on tablet/desktop; on phones the sidebar is
   already full-width so the collapsed class is ignored.
   ============================================================ */

@media (min-width: 761px) {
  .sidebar.sidebar-collapsed,
  .shell.sidebar-collapsed > .sidebar {
    transition: padding 0.18s ease;
  }

  .shell.sidebar-collapsed {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .shell.sidebar-collapsed .sidebar {
    gap: 14px;
    padding: 18px 12px;
    align-items: center;
  }

  .shell.sidebar-collapsed .brand {
    flex-direction: column;
    gap: 0;
    padding: 2px 0 12px;
    width: 100%;
  }

  .shell.sidebar-collapsed .brand > div {
    display: none;
  }

  .shell.sidebar-collapsed .brand-logo {
    display: none;
  }

  .shell.sidebar-collapsed .brand::before {
    content: "奥";
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #ffffff;
    background: linear-gradient(145deg, #4a90d9, #3574b8);
    font-size: 18px;
    font-weight: 800;
  }

  .shell.sidebar-collapsed .menu {
    width: 100%;
  }

  .shell.sidebar-collapsed .menu-item {
    justify-content: center;
    gap: 0;
    padding: 0;
    min-height: 40px;
  }

  .shell.sidebar-collapsed .menu-item > span + span {
    display: none;
  }

  .shell.sidebar-collapsed .menu-icon {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .shell.sidebar-collapsed .sidebar-foot {
    width: 100%;
    padding: 8px;
  }

  .shell.sidebar-collapsed .foot-label,
  .shell.sidebar-collapsed .foot-value {
    display: none;
  }

  .shell.sidebar-collapsed .sidebar-button {
    min-height: 34px;
    padding: 0;
    font-size: 0;
  }

  .shell.sidebar-collapsed .sidebar-button::before {
    content: "退";
    font-size: 15px;
  }

  .shell.sidebar-collapsed .sidebar-password::before {
    content: "密";
  }

  .shell.sidebar-collapsed .sidebar-feedback::before {
    content: "馈";
  }

  .shell.sidebar-collapsed .foot-customer {
    display: none;
  }

  .shell.sidebar-collapsed .sidebar-toggle-icon {
    transform: rotate(180deg) translateX(-1px);
  }

  /* Keep the fixed handle on the narrower (64px) sidebar edge when collapsed. */
  .shell.sidebar-collapsed .sidebar-toggle {
    left: 51px;
  }

  /* Icon-only sidebar: fold the tool submenu away, keep a single group icon. */
  .shell.sidebar-collapsed .menu-submenu {
    display: none;
  }

  .shell.sidebar-collapsed .menu-parent .menu-caret {
    display: none;
  }
}

@media (max-width: 760px) {
  .sidebar-toggle {
    display: none;
  }
}

/* ============================================================
   Detail drawer actions + fullscreen overlay
   ============================================================ */

.detail-drawer-actions {
  display: flex;
  flex: 0 0 auto;
  gap: var(--sp-2);
}

.detail-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--bg);
}

.detail-fullscreen.hidden {
  display: none;
}

.detail-fullscreen-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(70, 96, 128, 0.04);
}

.detail-fullscreen-bar h2 {
  font-size: var(--fs-xl);
  line-height: 1.3;
}

.detail-fullscreen-bar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--fs-md);
}

.detail-fullscreen-content {
  min-width: 0;
  overflow: auto;
  padding: var(--sp-4) var(--sp-5);
}

/* ============================================================
   Compact detail tables (drawer + fullscreen)
   ============================================================ */

.detail-drawer-content .data-table th,
.detail-drawer-content .data-table td,
.detail-fullscreen-content .data-table th,
.detail-fullscreen-content .data-table td {
  padding: 5px 7px;
  font-size: var(--fs-xs);
}

.detail-drawer-content .data-table tbody td,
.detail-fullscreen-content .data-table tbody td {
  max-width: 240px;
}

.detail-fullscreen-content .data-table {
  min-width: 0;
}

/* ============================================================
   Toasts + download feedback
   ============================================================ */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(70, 96, 128, 0.18);
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: 1.5;
  cursor: pointer;
  pointer-events: auto;
  animation: toast-in 0.22s ease;
}

.toast.toast-out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 14px;
  background: rgba(74, 144, 217, 0.14);
  color: var(--brand-strong);
}

.toast.success .toast-icon {
  background: rgba(52, 161, 122, 0.16);
  color: #2f8f5b;
}

.toast.error .toast-icon {
  background: rgba(214, 69, 69, 0.14);
  color: #d64545;
}

.toast-body {
  min-width: 0;
}

.toast-body strong {
  display: block;
  font-size: var(--fs-md);
  font-weight: 700;
  word-break: break-word;
}

.toast-body span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-sm);
  word-break: break-all;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Inline "downloading" indicator for clicked buttons / links */
.is-downloading {
  opacity: 0.65;
  pointer-events: none;
}

.is-downloading::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: download-spin 0.6s linear infinite;
}

@keyframes download-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   课题组（子母号）视图
   ============================================================ */
.group-view-banner {
  margin: var(--sp-3) var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  background: #eef6f5;
  border: 1px solid #cfe6e3;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  color: #1f5f5a;
  font-weight: 600;
  font-size: var(--fs-base);
}

/* 超级管理员：课题组管理 */
#adminGroupsPanel {
  padding: var(--sp-5);
}
.admin-group-create {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-3);
  align-items: end;
  padding: var(--sp-4);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin: var(--sp-3) var(--sp-1);
}
.admin-group-create .primary-button {
  grid-column: 1 / -1;
  justify-self: start;
}
.admin-groups-list {
  display: grid;
  gap: var(--sp-4);
  margin: var(--sp-3) var(--sp-1);
}
.admin-group-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  padding: var(--sp-4);
}
.admin-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.admin-group-head strong {
  font-size: var(--fs-lg);
}
.admin-group-head .admin-member-count {
  color: var(--muted);
  font-size: var(--fs-sm);
}
.admin-group-head .admin-group-delete {
  margin-left: auto;
}
.admin-member-add {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-3);
}
.admin-member-add .primary-button {
  grid-column: 1 / -1;
  justify-self: start;
}
.admin-group-card .data-table {
  width: 100%;
}

/* ============================================================
   BioRun-style primer workspace + global UI polish (3D)
   Added 2026-09-25
   ============================================================ */

/* ---- Global polish: no horizontal page scroll, smooth module switch ---- */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.workspace {
  max-width: 100%;
}

.module-panel.active {
  animation: module-fade 0.26s ease both;
}

@keyframes module-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Required-field marker (*) */
label:has(> input[required]) > span:first-child::after,
label:has(> textarea[required]) > span:first-child::after {
  content: " *";
  color: #d64545;
  font-weight: 700;
}

/* Consistent focus ring */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgba(74, 144, 217, 0.55);
  outline-offset: 2px;
}

/* Button press feedback + danger variant */
.primary-button,
.ghost-button,
.sidebar-button,
.link-button {
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.08s ease, border-color 0.16s ease;
}

.primary-button:not(:disabled):active,
.ghost-button:not(:disabled):active,
.sidebar-button:not(:disabled):active {
  transform: translateY(1px);
}

.ghost-button:not(:disabled):hover {
  color: var(--brand-strong);
  background: #f2f8fd;
  border-color: #cfe0f2;
}

.danger-button {
  min-height: var(--btn-lg);
  padding: 0 var(--sp-4);
  color: #c0453f;
  background: #fff;
  border: 1px solid #f1cccc;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.danger-button:hover {
  color: #fff;
  background: #d64545;
  border-color: #d64545;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* ---- Spinner + skeleton loading ---- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(74, 144, 217, 0.25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: download-spin 0.7s linear infinite;
}

.status-message.is-loading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border: 2px solid rgba(74, 144, 217, 0.3);
  border-top-color: var(--brand);
  border-radius: 50%;
  vertical-align: -1px;
  animation: download-spin 0.7s linear infinite;
}

.primer-loading {
  display: grid;
  justify-items: center;
  gap: var(--sp-4);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
}

.primer-loading-text {
  color: var(--muted);
  font-size: var(--fs-base);
}

.skeleton-stack {
  display: grid;
  gap: var(--sp-3);
  width: min(560px, 100%);
}

.skeleton-card {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-4);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.skeleton {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef3f8 25%, #e2ebf3 37%, #eef3f8 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.3s ease infinite;
}

.skeleton-line.w40 { width: 40%; }
.skeleton-line.w70 { width: 70%; }
.skeleton-line.w90 { width: 90%; }

@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---- Empty states ---- */
.empty-state {
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
}

.empty-state .empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--sp-1);
  color: var(--brand);
  background: rgba(74, 144, 217, 0.1);
  border-radius: 50%;
  font-size: 26px;
}

.empty-state .empty-title {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--ink);
}

.empty-state .empty-detail {
  max-width: 520px;
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.55;
}

.empty-state.empty-warn .empty-icon {
  color: #b07d2e;
  background: rgba(176, 125, 46, 0.12);
}

.primer-results > .empty-state {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(230, 236, 242, 0.9);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   Primer parameter panel — advanced (collapsible)
   ============================================================ */

.primer-params-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.param-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 10px;
  color: var(--ink);
  background: #f2f8fd;
  border: 1px solid #dcebf8;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
}

.param-chip b {
  color: var(--brand-strong);
  font-weight: 800;
}

.primer-advanced-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: 10px var(--sp-3);
  color: var(--ink);
  background: #f8fbfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

.primer-advanced-toggle:hover {
  border-color: #cfe0f2;
  background: #f2f8fd;
}

.primer-advanced-chevron {
  display: inline-block;
  color: var(--brand);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  transition: transform 0.18s ease;
}

.primer-advanced-toggle.is-open .primer-advanced-chevron {
  transform: rotate(90deg);
}

.primer-advanced-hint {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
  font-size: var(--fs-sm);
}

.primer-advanced-panel {
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  background: #fbfdff;
  border: 1px dashed #d5e3ef;
  border-radius: var(--radius-md);
  animation: module-fade 0.2s ease both;
}

.primer-param-group {
  margin: 0 0 var(--sp-4);
  padding: 0;
  border: 0;
}

.primer-param-group:last-of-type {
  margin-bottom: 0;
}

.primer-param-group legend {
  padding: 0 0 var(--sp-2);
  color: var(--brand-strong);
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.primer-inline-error {
  margin-top: var(--sp-3);
  padding: 9px var(--sp-3);
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
}

/* ============================================================
   Primer results — toolbar, cards, sequence viewer, structures
   ============================================================ */

.primer-results-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  flex-wrap: wrap;
}

.primer-results-heading h4 {
  margin: 0;
  font-size: var(--fs-lg);
}

.primer-results-heading h4 span {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.primer-view-switch {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  background: #f2f6fa;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.primer-view-btn {
  min-height: 30px;
  padding: 0 var(--sp-3);
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 700;
}

.primer-view-btn.active {
  color: #fff;
  background: var(--brand);
}

.primer-cards-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--line);
}

.primer-select-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: var(--fs-md);
  cursor: pointer;
}

.primer-select-all input {
  width: 16px;
  min-height: 16px;
}

.primer-cards-count {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.primer-cards {
  display: grid;
  gap: var(--sp-4);
}

.primer-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.primer-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(70, 96, 128, 0.14);
  border-color: #d7e6f4;
}

.primer-card.is-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.18), var(--shadow-sm);
}

.primer-card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: linear-gradient(180deg, #fbfdff, #f5faff);
  border-bottom: 1px solid var(--line);
}

.primer-card-select {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.primer-card-select input {
  width: 17px;
  min-height: 17px;
  cursor: pointer;
}

.primer-card-rank {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--ink);
}

.primer-card-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 800;
  white-space: nowrap;
}

.primer-card-badge.badge-ok { color: #2f8f5b; background: #e6f6ee; }
.primer-card-badge.badge-warn { color: #a9682a; background: #fdf4ec; }
.primer-card-badge.badge-bad { color: #c0453f; background: #fdeeee; }

.primer-card-headline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.primer-card-headline strong {
  font-size: var(--fs-lg);
}

.primer-card-headline span {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.primer-card-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-left: auto;
  padding: 4px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.primer-card-score-value {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--brand-strong);
  line-height: 1.1;
}

.primer-card-score-label {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.primer-card-score-penalty {
  color: #94a3b8;
  font-size: var(--fs-xs);
}

.primer-expand-btn {
  flex: 0 0 auto;
  min-height: var(--btn-md);
  padding: 0 var(--sp-4);
  color: var(--brand);
  background: #fff;
  border: 1px solid #cfe0f2;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
  font-size: var(--fs-md);
}

.primer-expand-btn:hover {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.primer-card-body {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.primer-strand {
  padding: var(--sp-3) var(--sp-4);
  background: #fff;
}

.primer-strand-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.primer-strand-pos,
.primer-strand-len {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.primer-strand-seq,
.seq-line-bases {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: var(--fs-base);
  letter-spacing: 0.06em;
  line-height: 1.7;
  word-break: break-all;
}

.base-A { color: #3b82f6; }
.base-T { color: #ef4444; }
.base-G { color: #f59e0b; }
.base-C { color: #22c55e; }
.base-N { color: #94a3b8; }
.base-a { color: #3b82f6; }
.base-t { color: #ef4444; }
.base-g { color: #f59e0b; }
.base-c { color: #22c55e; }
.base-n { color: #94a3b8; }

.base {
  font-weight: 700;
}

.primer-strand-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.meta-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 9px;
  color: var(--ink);
  background: #f4f8fc;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
}

.meta-chip b {
  color: var(--muted);
  font-weight: 700;
}

.primer-copy-btn {
  margin-left: auto;
  padding: 3px 10px;
  color: var(--brand);
  background: #fff;
  border: 1px solid #cfe0f2;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.primer-copy-btn:hover {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.primer-card-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

.metric-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px var(--sp-4);
  background: #fbfdff;
  font-size: var(--fs-sm);
}

.metric-label {
  color: var(--muted);
  font-weight: 700;
}

.primer-card-detail {
  padding: var(--sp-4);
  background: #f9fcff;
  border-top: 1px solid var(--line);
  display: grid;
  gap: var(--sp-5);
  animation: module-fade 0.22s ease both;
}

.primer-detail-title {
  margin-bottom: var(--sp-3);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--brand-strong);
  font-size: var(--fs-md);
  font-weight: 800;
}

.structure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-3);
}

.structure-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.structure-block-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-3);
  background: #f5faff;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.structure-block-head .primer-metric {
  margin-left: 0;
}

.structure-block-head .tag {
  margin-left: auto;
}

.structure-pre {
  margin: 0;
  padding: var(--sp-3);
  max-height: 240px;
  overflow: auto;
  color: #26313d;
  background: #fff;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  line-height: 1.5;
  white-space: pre;
}

.structure-block-empty {
  padding: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ---- Complement map (dimer / hairpin visualization) ---- */
.structure-details {
  margin-top: var(--sp-3);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: #fbfdff;
}

.structure-details > summary {
  padding: 9px var(--sp-3);
  color: var(--brand-strong);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.structure-details > summary::before {
  content: "▸ ";
  color: var(--muted);
}

.structure-details[open] > summary::before {
  content: "▾ ";
}

.structure-details .structure-grid {
  padding: 0 var(--sp-3) var(--sp-3);
}

.comp-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.comp-block-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-3);
  background: #f5faff;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.comp-block-head .tag {
  margin-left: auto;
}

.comp-map {
  overflow-x: auto;
  padding: var(--sp-3);
}

.comp-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
}

.comp-bar-row {
  margin: 2px 0;
}

.comp-label {
  flex: 0 0 72px;
  color: var(--muted);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-align: right;
}

.comp-bases,
.comp-bars {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-md);
  letter-spacing: 0.04em;
}

.comp-base {
  display: inline-block;
  width: 15px;
  text-align: center;
  font-weight: 700;
}

.comp-base.comp-pair {
  color: #1f5c96;
  background: rgba(74, 144, 217, 0.2);
  border-radius: 2px;
}

.comp-base.comp-mismatch {
  color: #b4514a;
}

.comp-base.comp-gap {
  color: #c8d3de;
}

.comp-bar {
  display: inline-block;
  width: 15px;
  text-align: center;
  color: #c8d3de;
}

.comp-bar.hit {
  color: var(--brand);
  font-weight: 800;
}

.comp-summary {
  padding: 0 var(--sp-3) var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
}

.comp-summary b {
  color: var(--brand-strong);
}

.comp-empty {
  padding: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
}

.primer-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.primer-detail-actions .primer-copy-btn {
  margin-left: 0;
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  border-radius: var(--radius-md);
}

.primer-detail-hint {
  margin-top: var(--sp-2);
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ---- Sequence viewer ---- */
.seq-viewer {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.seq-viewer-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: 8px var(--sp-3);
  background: #f5faff;
  border-bottom: 1px solid var(--line);
}

.seq-direction {
  font-family: "IBM Plex Mono", Consolas, monospace;
  color: var(--brand-strong);
  font-weight: 800;
  font-size: var(--fs-md);
}

.seq-dir-arrow {
  margin: 0 3px;
  color: var(--accent);
}

.seq-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
}

.seq-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.seq-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.seq-zoom {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.seq-zoom-btn {
  min-width: 30px;
  min-height: 26px;
  padding: 0 8px;
  color: var(--brand);
  background: #fff;
  border: 1px solid #cfe0f2;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
}

.seq-zoom-btn:hover {
  color: #fff;
  background: var(--brand);
}

.seq-zoom-value {
  color: var(--muted);
  font-size: var(--fs-sm);
  min-width: 34px;
  text-align: center;
}

.seq-viewer-scroll {
  max-height: 340px;
  overflow: auto;
  padding: var(--sp-3) 0;
  background: #fff;
}

.seq-line {
  display: flex;
  align-items: baseline;
  white-space: nowrap;
}

.seq-line-gutter {
  flex: 0 0 62px;
  padding-right: var(--sp-2);
  color: #94a3b8;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: var(--fs-sm);
  text-align: right;
}

.seq-line-bases,
.seq-line-ruler {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--seq-fs, 14px);
  letter-spacing: 0.06em;
  white-space: pre;
}

.seq-line.ruler-line {
  margin-bottom: 4px;
}

.seq-line-ruler {
  color: #b6c4d2;
  font-size: calc(var(--seq-fs, 14px) - 3px);
}

.seq-hl {
  border-radius: 3px;
  padding: 0 1px;
}

.seq-hl-f {
  background: rgba(74, 144, 217, 0.22);
  box-shadow: inset 0 -2px 0 rgba(74, 144, 217, 0.7);
}

.seq-hl-r {
  background: rgba(139, 126, 200, 0.22);
  box-shadow: inset 0 -2px 0 rgba(139, 126, 200, 0.8);
}

.seq-legend-swatch.seq-hl-f { background: rgba(74, 144, 217, 0.32); }
.seq-legend-swatch.seq-hl-r { background: rgba(139, 126, 200, 0.32); }

.seq-viewer-note,
.seq-viewer-empty {
  padding: 8px var(--sp-3);
  color: var(--muted);
  background: #fbfdff;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}

.seq-viewer-empty {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

/* Narrow-desktop safety (customer desktops >= 1024px) */
@media (max-width: 1240px) {
  .primer-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .structure-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ============================================================
   Day2 · 引物设计目的选择器 (2C) + 测序在线下单表单 (2B)
   Soft light 主题，沿用 --brand / --bg / --ink 变量
   ============================================================ */

.primer-purpose-block {
  margin: var(--sp-3) 0 var(--sp-3);
  padding: var(--sp-3);
  background: linear-gradient(135deg, rgba(74, 144, 217, 0.08), rgba(91, 184, 176, 0.08));
  border: 1px solid rgba(74, 144, 217, 0.18);
  border-radius: var(--radius-md);
}

.primer-purpose-title {
  display: block;
  margin-bottom: var(--sp-2);
  color: var(--brand-strong);
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.purpose-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.purpose-pill {
  padding: 6px 12px;
  color: var(--brand-strong);
  background: #ffffff;
  border: 1px solid rgba(74, 144, 217, 0.3);
  border-radius: var(--radius-full);
  font-size: var(--fs-md);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.purpose-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(74, 144, 217, 0.18);
}

.purpose-pill.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(74, 144, 217, 0.28);
}

.primer-purpose-hint {
  margin: var(--sp-2) 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.primer-purpose-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  padding: var(--sp-3);
  background: rgba(255, 255, 255, 0.9);
  border: 1px dashed #cddcec;
  border-radius: var(--radius-md);
}

.primer-purpose-fields.hidden {
  display: none;
}

.primer-purpose-fields .field-hint,
.primer-purpose-fields p.field-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.primer-purpose-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: var(--fs-md);
}

.primer-purpose-fields label span {
  font-weight: 700;
  color: var(--ink);
}

.primer-purpose-fields textarea,
.primer-purpose-fields select,
.primer-purpose-fields input {
  width: 100%;
  min-height: var(--btn-md);
  padding: 7px 9px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.primer-known-controls {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

.primer-known-hint {
  grid-column: 1 / -1;
  margin: 0;
}

.primer-known-controls label {
  display: grid;
  gap: 5px;
}

.primer-known-controls label > span {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.primer-known-controls select,
.primer-known-controls input {
  width: 100%;
  min-height: var(--btn-md);
  padding: 0 10px;
  color: #334155;
  font: inherit;
  font-size: var(--fs-md);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.primer-known-controls input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.5px;
}

.primer-known-controls select:focus,
.primer-known-controls input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

@media (max-width: 760px) {
  .primer-known-controls {
    grid-template-columns: 1fr;
  }
}

.primer-order-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  color: var(--ink);
  font-size: var(--fs-md);
  background: #f2f8f4;
  border: 1px solid #cde8d8;
  border-radius: var(--radius-md);
}

/* Nested PCR combination cards */
.nested-combo-count {
  color: var(--muted);
  font-size: var(--fs-md);
}

.nested-combo-card {
  margin-bottom: var(--sp-3);
  padding: var(--sp-3);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.nested-combo-card.is-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.12);
}

.nested-combo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: 6px;
}

.nested-combo-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: var(--fs-md);
  cursor: pointer;
}

.nested-combo-check input[type="checkbox"] {
  width: 15px;
  min-width: 15px;
  min-height: 15px;
  padding: 0;
  accent-color: var(--brand);
}

.nested-lock-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  color: #ffffff;
  background: var(--brand);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: 1px;
}

.nested-combo-flow {
  color: var(--ink);
  font-size: var(--fs-md);
}

.nested-combo-flow b {
  color: var(--muted);
  padding: 0 4px;
}

.nested-combo-score {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--fs-md);
}

.nested-combo-score b {
  color: var(--brand-strong);
}

.nested-bar {
  margin: 2px 0 8px;
}

.nested-bar-row {
  position: relative;
  height: 7px;
  margin-bottom: 3px;
  background: #eef2f6;
  border-radius: 4px;
}

.nested-bar-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 4px;
}

.nested-bar-seg.is-outer {
  background: #4a90d9;
}

.nested-bar-seg.is-inner {
  background: #2f9e6e;
}

.nested-bar-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.nested-bar-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 400;
}

.nested-bar-dot {
  display: inline-block;
  width: 14px;
  height: 6px;
  margin: 0 3px 0 10px;
  border-radius: 3px;
  background: #eef2f6;
}

.nested-bar-dot.is-outer {
  background: #4a90d9;
}

.nested-bar-dot.is-inner {
  background: #2f9e6e;
  margin-left: 14px;
}

.nested-bar-dot.is-tpl {
  background: #e2e8f0;
  margin-left: 14px;
}

.nested-combo-table th,
.nested-combo-table td {
  font-size: var(--fs-sm);
}

.nested-combo-role {
  white-space: nowrap;
  font-weight: 700;
}

.nested-combo-role.is-outer {
  color: #2f6fb5;
}

.nested-combo-role.is-inner {
  color: #2f9e6e;
}

.nested-combo-seq {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Locked (user-provided) primer markers */
.primer-locked-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  color: #7a5310;
  font-size: var(--fs-xs);
  font-weight: 800;
  background: rgba(214, 158, 46, 0.16);
  border: 1px solid rgba(214, 158, 46, 0.4);
  border-radius: var(--radius-full);
}

.primer-strand.is-locked {
  border-color: rgba(214, 158, 46, 0.55);
  box-shadow: inset 0 0 0 1px rgba(214, 158, 46, 0.25);
}

.primer-strand.is-probe {
  border-color: rgba(31, 138, 125, 0.35);
  background: #f4fbf9;
}

.primer-lock-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
  background: linear-gradient(180deg, #fffdf5, #fff8e9);
  border: 1px solid rgba(214, 158, 46, 0.42);
  border-radius: var(--radius-md);
}

.primer-lock-icon {
  font-size: 20px;
  line-height: 1;
}

.primer-lock-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.primer-lock-body strong {
  color: #7a5310;
}

.primer-lock-seq {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-md);
  word-break: break-all;
}

.primer-lock-meta {
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ---- qPCR 结果指标 ---- */
.primer-qpcr-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 800;
}

.primer-qpcr-badge.pass {
  color: #1c7a55;
  background: rgba(52, 161, 122, 0.14);
}

.primer-qpcr-badge.fail {
  color: #a35b12;
  background: rgba(176, 125, 46, 0.16);
}

.primer-endgc {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 800;
}

.primer-endgc.ok {
  color: #1c7a55;
  background: rgba(52, 161, 122, 0.15);
}

.primer-endgc.warn {
  color: #a35b12;
  background: rgba(176, 125, 46, 0.16);
}

.primer-metric-note {
  margin: 0;
  padding: 10px 14px;
  color: var(--brand-strong);
  background: rgba(74, 144, 217, 0.08);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--fs-md);
  line-height: 1.6;
}

.primer-purpose-banner,
.primer-probe-card,
.primer-known-card {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-4);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.primer-probe-card {
  border-left: 4px solid var(--accent);
}

.primer-known-card {
  border-left: 4px solid var(--brand);
}

.primer-probe-card h4,
.primer-known-card h4 {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-lg);
  color: var(--ink);
}

.primer-probe-card h4 span,
.primer-known-card h4 span {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.primer-probe-metrics,
.primer-known-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--ink);
  font-size: var(--fs-md);
}

.primer-probe-metrics b,
.primer-known-metrics b {
  color: var(--brand-strong);
}

.primer-probe-sequence {
  margin-top: var(--sp-2);
  padding: 8px 10px;
  font-family: "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.06em;
  background: #f2f8f7;
  border-radius: var(--radius-sm);
  word-break: break-all;
}

.primer-known-warning {
  margin-top: 6px;
  color: #a35b12;
  font-size: var(--fs-sm);
}

/* ---- 测序在线下单表单 ---- */
.sequencing-order-form {
  display: block;
}

.sequencing-customer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: rgba(247, 250, 252, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.sequencing-customer-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: var(--fs-md);
}

.sequencing-customer-grid label span {
  font-weight: 700;
  color: var(--ink);
}

.sequencing-customer-grid input {
  width: 100%;
  min-height: var(--btn-lg);
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.sequencing-customer-grid input:focus,
.sequencing-sample-card input:focus,
.sequencing-sample-card select:focus,
.sequencing-order-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.16);
}

.sequencing-samples-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.sequencing-samples-head h3 {
  font-size: var(--fs-lg);
  color: var(--ink);
}

.sequencing-samples-head h3 span {
  color: var(--brand-strong);
}

/* Compact sequencing order header + spreadsheet-style sample table */
.sequencing-customer-grid.is-compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-3);
}

.sequencing-customer-grid.is-compact label {
  gap: 3px;
  font-size: var(--fs-sm);
}

.sequencing-customer-grid.is-compact input {
  min-height: 34px;
  padding: 5px 9px;
}

.seq-order-meta {
  display: grid;
  gap: var(--sp-2);
}

.seq-order-meta-note {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.seq-order-meta-note strong {
  color: var(--ink);
}

@media (max-width: 980px) {
  .sequencing-customer-grid.is-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sequencing-samples-tools {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.seq-table-wrap {
  margin-top: var(--sp-3);
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.seq-sample-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
}

.seq-sample-table th,
.seq-sample-table td {
  padding: 4px 6px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.seq-sample-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  background: #f1f5fa;
}

.seq-sample-table tbody tr:hover {
  background: #f8fbff;
}

.seq-sample-table input,
.seq-sample-table select {
  width: 100%;
  min-height: 30px;
  padding: 4px 7px;
  font-size: var(--fs-sm);
  color: var(--ink);
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.seq-sample-table input:focus,
.seq-sample-table select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.16);
}

.seq-cell-num {
  width: 34px;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--muted);
}

.seq-cell-actions {
  text-align: center;
  white-space: nowrap;
}

.seq-row-copy,
.seq-row-delete {
  padding: 4px 8px;
  font-size: var(--fs-xs);
  vertical-align: middle;
}

.seq-row-copy {
  margin-right: 4px;
}

.seq-resist-combo {
  position: relative;
  display: flex;
  align-items: center;
}

.seq-resist-combo input {
  padding-right: 26px;
}

.seq-resist-combo input::-webkit-calendar-picker-indicator {
  display: none;
}

.seq-resist-toggle {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.seq-resist-toggle:hover {
  color: var(--brand);
}

.seq-resist-menu {
  position: fixed;
  z-index: 1200;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

.seq-resist-menu button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-xs, 4px);
  background: none;
  color: var(--ink);
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.seq-resist-menu button:hover,
.seq-resist-menu button.active {
  background: #eef7f6;
  color: var(--brand-strong, #176b69);
}

.seq-table-hint {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.seq-table-hint b {
  color: var(--brand-strong);
}

.seq-col-num { width: 36px; }
.seq-col-name { width: 160px; }
.seq-col-type { width: 108px; }
.seq-col-len { width: 90px; }
.seq-col-vector { width: 130px; }
.seq-col-primer { width: 108px; }
.seq-col-resist { width: 132px; }
.seq-col-note { width: 110px; }
.seq-col-actions { width: 148px; }

.seq-note-field {
  display: grid;
  gap: var(--sp-1);
}

.seq-note-field span {
  font-weight: 600;
  color: var(--muted);
}

.seq-note-field textarea {
  width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.seq-note-field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.16);
}

.seq-confirm-lead {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.sequencing-sample-list {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}

.sequencing-sample-card {
  padding: var(--sp-3);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  animation: seq-card-in 0.22s ease;
}

@keyframes seq-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.sequencing-sample-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}

.sequencing-sample-card-head span {
  color: var(--brand-strong);
  font-size: var(--fs-md);
  font-weight: 800;
}

.sequencing-sample-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2);
}

.sequencing-sample-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.sequencing-sample-grid label span {
  font-weight: 700;
  color: var(--ink);
}

.sequencing-sample-grid input,
.sequencing-sample-grid select {
  width: 100%;
  min-height: var(--btn-md);
  padding: 6px 8px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.sequencing-primer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.sequencing-primer-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.sequencing-primer-grid label span {
  font-weight: 700;
  color: var(--ink);
}

.sequencing-primer-grid input {
  width: 100%;
  min-height: var(--btn-md);
  padding: 6px 8px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.sequencing-sample-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.sequencing-order-form .sequencing-note-field {
  display: grid;
  gap: 6px;
  margin-top: var(--sp-4);
}

.sequencing-order-form .sequencing-note-field span {
  font-weight: 700;
  color: var(--ink);
  font-size: var(--fs-md);
}

.sequencing-order-form textarea {
  width: 100%;
  padding: 9px 11px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.seq-remove-sample {
  min-height: var(--btn-sm);
  padding: 0 10px;
  color: #b04747;
  background: #fff5f5;
  border: 1px solid #f2d3d3;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.seq-remove-sample:hover {
  background: #ffecec;
}

@media (max-width: 1240px) {
  .sequencing-sample-grid,
  .sequencing-primer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .sequencing-customer-grid,
  .primer-purpose-fields,
  .sequencing-sample-grid,
  .sequencing-primer-grid,
  .sequencing-sample-row-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* qPCR warning metric cell (2C data merged into 3D cards) */
.primer-card-metrics .primer-qpcr-warn {
  background: #fffaf3;
}

.primer-card-metrics .primer-qpcr-warn .metric-label {
  color: #a35b12;
}

.primer-card-metrics .primer-qpcr-warn .primer-metric {
  margin-left: 0;
  color: #a35b12;
  white-space: normal;
}

/* Panel title row: keep action buttons intact on narrow cards */
.panel-title-row > div:first-child {
  min-width: 0;
}

.panel-title-row > .ghost-button,
.panel-title-row > .primary-button,
.panel-title-row > .template-link {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ============================================================
   3C 同源臂 / HDR (SOE-PCR) 引物设计
   沿用在线引物设计的卡片与 soft-light 主题
   ============================================================ */

.hdr-mode-fields {
  display: grid;
  gap: var(--sp-3);
}

#hdrLeftArm,
#hdrRightArm {
  min-height: 170px;
}

#hdrSequence {
  min-height: 200px;
}

.hdr-coord-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}

.hdr-base-grid {
  display: grid;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.hdr-set-list {
  display: grid;
  gap: var(--sp-4);
}

.hdr-set-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: module-fade 0.22s ease both;
}

.hdr-set-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: linear-gradient(135deg, rgba(74, 144, 217, 0.12), rgba(91, 184, 176, 0.12));
  border-bottom: 1px solid var(--line);
}

.hdr-set-number {
  color: var(--brand-strong);
  font-size: var(--fs-lg);
  font-weight: 800;
}

.hdr-set-arms {
  color: var(--muted);
  font-size: var(--fs-md);
}

.hdr-set-product {
  margin-left: auto;
  padding: 3px 10px;
  color: var(--brand-strong);
  background: #fff;
  border: 1px solid rgba(74, 144, 217, 0.3);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 700;
  white-space: nowrap;
}

.hdr-arms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.hdr-arm {
  min-width: 0;
  background: #fff;
}

.hdr-arm-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: #f7fafd;
  border-bottom: 1px solid var(--line);
}

.hdr-arm-note {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.hdr-primer + .hdr-primer {
  border-top: 1px solid var(--line);
}

.hdr-seq {
  overflow-wrap: anywhere;
}

/* SOE tail: highlighted + underlined; binding region stays plain bold. */
.hdr-tail {
  padding: 1px 0;
  background: rgba(74, 144, 217, 0.16);
  border-bottom: 2px solid var(--brand);
  border-radius: 2px;
}

.hdr-binding {
  font-weight: 700;
}

.hdr-tail-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px var(--sp-2);
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.hdr-tail-swatch,
.hdr-binding-swatch {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-radius: 2px;
}

.hdr-tail-swatch {
  background: rgba(74, 144, 217, 0.18);
  border-bottom: 2px solid var(--brand);
}

.hdr-binding-swatch {
  background: #eef2f7;
  border: 1px solid #dbe4ee;
}

.hdr-tail-chip {
  background: #eef5fb;
  border-color: #cfe0f2;
}

.hdr-binding-chip {
  background: #f2f7ee;
  border-color: #d6e6c9;
}

/* 前向接头引物：5' 重叠区与模板一致，不是人工尾巴（整条引物都退火） */
.hdr-overlap-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* 结合区 Tm 提示（接头 AT 富集时给出退火建议） */
.hdr-warn-box {
  display: grid;
  gap: 4px;
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: #fff8ec;
  border: 1px solid #f2ddb4;
  border-radius: var(--radius-sm);
}

.hdr-warn-note {
  margin: 0;
  color: #8a6116;
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.hdr-warn-note::before {
  content: "⚠ ";
}

.hdr-fusion {
  padding: var(--sp-3) var(--sp-4);
  background: #f9fcff;
  border-top: 1px solid var(--line);
}

.hdr-fusion-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.hdr-fusion-title {
  color: var(--brand-strong);
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.hdr-overlap {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.hdr-overlap-label {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.hdr-overlap-seq {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-md);
  letter-spacing: 0.06em;
  word-break: break-all;
}

#hdrSubmitButton.is-busy {
  opacity: 0.7;
  cursor: progress;
}

@media (max-width: 900px) {
  .hdr-arms {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .hdr-coord-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hdr-set-product {
    margin-left: 0;
  }
}

/* ============================================================
   HDR 向导 (4-step wizard) — 参考序列 / 目的序列 / 同源臂 / 引物
   Appended 2026-09-26. Scoped to #module-hdr; the rules above
   (single-screen SOE-PCR results) are left untouched.
   ============================================================ */

/* ---- Wizard shell & stepper ---- */

.hdr-layout {
  display: block;
}

.hdr-stepper {
  display: flex;
  align-items: stretch;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  padding: var(--sp-2);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(230, 236, 242, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hdr-step {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
  padding: 10px var(--sp-3);
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-weight: 700;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.hdr-step:hover {
  color: var(--brand-strong);
  background: #f3f8fd;
}

.hdr-step + .hdr-step::before {
  content: "›";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  color: #cbd8e4;
  font-size: 18px;
  font-weight: 800;
  pointer-events: none;
}

.hdr-step-num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: var(--muted);
  background: #eef3f8;
  border-radius: 50%;
  font-size: var(--fs-md);
  font-weight: 800;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.hdr-step-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-base);
}

.hdr-step.is-active {
  color: var(--brand-strong);
  background: #eef5fb;
  border-color: #cfe0f2;
}

.hdr-step.is-active .hdr-step-num {
  color: #ffffff;
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(74, 144, 217, 0.35);
}

.hdr-step.is-done {
  color: var(--ok);
}

.hdr-step.is-done .hdr-step-num {
  color: #ffffff;
  background: var(--ok);
  font-size: 0;
}

.hdr-step.is-done .hdr-step-num::before {
  content: "✓";
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

/* ---- Panels ---- */

.hdr-panel {
  padding: var(--sp-5);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(230, 236, 242, 0.9);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  animation: module-fade 0.24s ease both;
}

.hdr-panel .field-hint,
#hdrSeqTrack .field-hint,
#hdrStep1Track .field-hint {
  margin: var(--sp-2) 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.hdr-rec-hint {
  margin: 0 0 var(--sp-2);
}

.hdr-term-line {
  margin-top: var(--sp-1);
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ---- Nav row (back / next) ---- */

.hdr-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px dashed var(--line);
}

/* ---- Panel 1 / 2 — source & target inputs ---- */

#hdrRefPasteFields,
#hdrTargetPasteFields {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

#hdrRefSequence,
#hdrTargetSequence {
  min-height: 200px;
}

#hdrRefLibraryFields {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

#hdrRefLibraryFields .ghost-button {
  justify-self: start;
}

#hdrRefLibraryInfo {
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.5;
}

#hdrRefMeta,
#hdrTargetMeta,
#hdrSeqTrackLegend,
#hdrStep1TrackLegend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

#hdrTargetEditFields {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

#hdrEditReplacement {
  min-height: 110px;
}

/* ---- Panel 2 — diff & final sequence views ---- */

#hdrDiffView {
  margin-top: var(--sp-3);
}

.hdr-diff-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.hdr-diff-row + .hdr-diff-row {
  margin-top: 4px;
}

.hdr-diff-op {
  flex: 0 0 auto;
  min-width: 18px;
  color: var(--brand-strong);
  font-weight: 800;
  text-align: center;
}

.hdr-diff-arm {
  color: #64748b;
}

.hdr-diff-muted {
  color: #94a3b8;
}

.hdr-diff-edit {
  padding: 1px 3px;
  color: #9a3412;
  background: #fde8d7;
  border-bottom: 2px solid #f0a95c;
  border-radius: 2px;
  font-weight: 700;
}

.hdr-diff-edit.is-empty {
  color: #b9c4d0;
  background: #f1f5f9;
  border-bottom-color: #e2e8f0;
}

.hdr-diff {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  background: #f8fbfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.hdr-diff-op.is-add {
  color: #2f8f5b;
}

.hdr-diff-op.is-del {
  color: #c0453f;
}

.hdr-final-seq {
  margin-top: var(--sp-3);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.hdr-final-seq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  color: var(--brand-strong);
  background: #f8fbfe;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-md);
  font-weight: 700;
}

.hdr-seq-scroll {
  max-height: 220px;
  padding: var(--sp-3);
  overflow: auto;
}

.hdr-seq-block {
  display: block;
  white-space: nowrap;
  color: var(--ink);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  line-height: 1.75;
  letter-spacing: 0.02em;
}

.hdr-seq-pos {
  display: inline-block;
  width: 52px;
  margin-right: var(--sp-2);
  color: #94a3b8;
  text-align: right;
  user-select: none;
}

.hdr-final-seq .hdr-chip-row {
  margin-top: 0;
}

/* ---- Warnings / success ---- */

.hdr-warn {
  display: grid;
  gap: 6px;
  margin-top: var(--sp-3);
  padding: 10px var(--sp-3);
  color: #8a5a14;
  background: #fffaf3;
  border: 1px solid #f2e2c8;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  line-height: 1.45;
}

.hdr-warn:empty {
  display: none;
}

.hdr-warn-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.hdr-warn-item::before {
  content: "!";
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: #ffffff;
  background: #e6a23c;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.hdr-ok {
  color: var(--ok);
  font-size: var(--fs-md);
  font-weight: 700;
}

#hdrRefWarn:empty,
#hdrTargetWarn:empty,
#hdrLeftArmWarn:empty,
#hdrRightArmWarn:empty,
#hdrMiddleWarn:empty,
#hdrDonorWarn:empty {
  display: none;
}

/* ---- Panel 3 — presets, track, arm cards ---- */

#hdrArmPresets,
.hdr-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

#hdrArmPresets > button,
.hdr-chip-row > button {
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  color: var(--brand-strong);
  background: #ffffff;
  border: 1px solid #cfe0f2;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 700;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

#hdrArmPresets > button:hover,
.hdr-chip-row > button:hover {
  background: #f2f8fd;
}

#hdrArmPresets > button.active,
.hdr-chip-row > button.active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

#hdrArmLenHint {
  margin-top: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.5;
}

#hdrSeqTrack,
#hdrStep1Track {
  margin-top: var(--sp-4);
  padding: var(--sp-3);
  background: #f8fbfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

#hdrStep1TrackLegend:empty {
  display: none;
}

.hdr-track-bar {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 30px;
  overflow: hidden;
  background: #eef3f8;
  border: 1px solid #dbe4ee;
  border-radius: var(--radius-sm);
}

.hdr-track-bar.has-handles {
  overflow: visible;
}

.hdr-track-bar > .hdr-track-seg:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}

.hdr-track-bar > .hdr-track-seg.hdr-track-seg-tail {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.hdr-track-seg {
  flex: 0 0 auto;
  height: 100%;
  min-width: 2px;
  transition: width 0.15s ease;
}

.hdr-track-bar.is-dragging .hdr-track-seg {
  transition: none;
}

.hdr-track-seg-ref {
  background: #dbe4ee;
}

.hdr-track-seg-left {
  background: #7cb0e2;
}

.hdr-track-seg-middle {
  background: #f0a95c;
}

.hdr-track-seg-insert {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.9);
}

.hdr-track-seg-right {
  background: #a99ad8;
}

.hdr-track-handle {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 14px;
  margin-left: -7px;
  background: transparent;
  border-radius: 4px;
  cursor: ew-resize;
  touch-action: none;
  z-index: 6;
}

.hdr-track-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  background: #2f6f9f;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92);
  transition: background 0.12s ease, transform 0.12s ease;
}

.hdr-track-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
}

.hdr-track-handle:hover::before,
.hdr-track-bar.is-dragging .hdr-track-handle::before {
  background: #1f5c88;
  transform: translate(-50%, -50%) scaleY(1.08);
}

/* ---- 第 ① 步轨道图：拖选 / 点选 ---- */

.hdr-track-bar-interactive {
  cursor: crosshair;
  user-select: none;
}

.hdr-track-interaction-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: crosshair;
  touch-action: none;
}

.hdr-track-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  display: none;
  z-index: 4;
  pointer-events: none;
  background: rgba(74, 144, 217, 0.32);
  box-shadow: inset 0 0 0 1px rgba(45, 109, 168, 0.65);
  border-radius: 2px;
}

.hdr-track-selection.is-caret {
  background: #2d6da8;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
  border-radius: 1px;
}

.hdr-track-ruler {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: 6px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-xs);
}

/* ---- 第 ① 步：参考序列 + CDS / 转录方向基因图 ---- */

.hdr-ref-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}

.hdr-ref-input {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

#hdrRefSequence {
  height: 158px;
  min-height: 158px;
  resize: vertical;
}

.hdr-cds-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-height: 158px;
  padding: var(--sp-3);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.hdr-cds-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
}

.hdr-cds-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}

.hdr-cds-status {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-align: right;
}

.hdr-cds-note {
  font-size: var(--fs-xs);
  color: #b07d2e;
  line-height: 1.5;
}

.hdr-cds-map {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 104px;
}

.hdr-cds-empty {
  font-size: var(--fs-sm);
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.hdr-cds-graph {
  width: 100%;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.hdr-cds-ruler {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hdr-cds-labels {
  position: relative;
  height: 30px;
}

.hdr-cds-labels:empty {
  display: none;
}

.hdr-cds-name {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.hdr-cds-name.is-low {
  top: 14px;
}

.hdr-cds-name.is-plus {
  color: var(--brand-strong);
}

.hdr-cds-name.is-minus {
  color: var(--warn);
}

.hdr-cds-axis {
  position: relative;
  height: 30px;
  margin: 3px 0 2px;
  background: #eef3f8;
  border: 1px solid #dbe4ee;
  border-radius: var(--radius-sm);
}

.hdr-cds-block {
  position: absolute;
  top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3px;
  height: 20px;
  padding: 0 8px;
  overflow: hidden;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hdr-cds-block.is-plus {
  background: var(--brand);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 4px 50%);
}

.hdr-cds-block.is-minus {
  background: var(--warn);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 4px) 50%, 100% 100%, 8px 100%, 0 50%);
}

.hdr-cds-block.is-partial {
  background: #f0a3a3;
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.45) 0 4px, transparent 4px 8px);
}

.hdr-cds-block-label {
  pointer-events: none;
}

.hdr-cds-measures {
  position: relative;
  height: 52px;
  margin-top: 2px;
}

.hdr-cds-measure {
  position: absolute;
  top: 6px;
  height: 14px;
  border-top: 2px solid currentColor;
}

.hdr-cds-measure.is-low {
  top: 30px;
}

.hdr-cds-measure.is-plus {
  color: var(--brand);
}

.hdr-cds-measure.is-minus {
  color: var(--warn);
}

.hdr-cds-measure::before,
.hdr-cds-measure::after {
  content: "";
  position: absolute;
  top: -2px;
  width: 2px;
  height: 8px;
  background: currentColor;
}

.hdr-cds-measure::before {
  left: 0;
}

.hdr-cds-measure::after {
  right: 0;
}

.hdr-cds-num {
  position: absolute;
  top: 6px;
  padding: 0 1px;
  color: var(--ink);
  background: #fbfcfe;
  font-size: 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hdr-cds-num.is-start {
  left: 0;
  transform: translateX(-50%);
}

.hdr-cds-num.is-end {
  right: 0;
  transform: translateX(50%);
}

.hdr-cds-legend:empty {
  display: none;
}

/* 不完整 CDS：浅红填充 + 缺失端虚线切口 + 密码子坐标说明 */
.hdr-cds-cut {
  position: absolute;
  top: 2px;
  width: 0;
  height: 26px;
  border-left: 2px dashed #c0504d;
  z-index: 3;
  pointer-events: none;
}

.hdr-cds-cut.is-right {
  margin-left: -2px;
}

.hdr-cds-name.is-partial {
  color: #b23c3c;
}

.hdr-cds-measure.is-partial {
  color: #c0504d;
}

.hdr-cds-partials {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.hdr-cds-partial-item {
  font-size: 10px;
  line-height: 1.7;
  color: var(--ink);
}

.hdr-cds-partial-item b {
  margin-right: 5px;
  font-weight: 700;
}

.hdr-cds-partial-item b.is-plus {
  color: var(--brand-strong);
}

.hdr-cds-partial-item b.is-minus {
  color: var(--warn);
}

.hdr-cds-partial-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: #fde7e7;
  color: #b23c3c;
  font-weight: 600;
}

.hdr-cds-legend-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.hdr-cds-swatch {
  flex: 0 0 auto;
  width: 14px;
  height: 10px;
  border-radius: 2px;
}

.hdr-cds-swatch.is-partial {
  background: #f0a3a3;
  border-left: 2px dashed #c0504d;
}

@media (max-width: 900px) {
  .hdr-ref-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

#hdrLeftArmCard,
#hdrRightArmCard,
#hdrMiddleCard {
  margin-top: var(--sp-4);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

#hdrPanelArms > .hdr-set-card {
  margin-top: var(--sp-4);
}

.hdr-arm-seq {
  max-height: 150px;
  margin: var(--sp-3) var(--sp-4);
  padding: var(--sp-3);
  overflow: auto;
  color: var(--ink);
  background: #f8fbfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  line-height: 1.6;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.hdr-arm-seq:empty {
  display: none;
}

#hdrLeftArmStats,
#hdrRightArmStats,
#hdrMiddleStats,
#hdrDonorStats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0 var(--sp-4) var(--sp-4);
}

#hdrLeftArmStats:empty,
#hdrRightArmStats:empty,
#hdrMiddleStats:empty,
#hdrDonorStats:empty {
  display: none;
}

.hdr-promote {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  margin-left: auto;
  padding: 0 12px;
  color: #ffffff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(74, 144, 217, 0.28);
  cursor: pointer;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: 0.08em;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.08s ease;
}

.hdr-promote:hover {
  background: var(--brand-strong);
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.36);
}

.hdr-promote:active {
  transform: translateY(1px);
}

/* ---- Panel 3 — donor preview bar ---- */

.hdr-donor-bar {
  display: flex;
  align-items: stretch;
  height: 34px;
  margin: var(--sp-3) var(--sp-4);
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: var(--radius-sm);
}

.hdr-donor-seg-left,
.hdr-donor-seg-middle,
.hdr-donor-seg-right {
  flex: 0 0 auto;
  height: 100%;
  min-width: 2px;
}

.hdr-donor-seg-left {
  background: #7cb0e2;
}

.hdr-donor-seg-middle {
  background: #f0a95c;
}

.hdr-donor-seg-right {
  background: #a99ad8;
}

/* ---- Panel 4 — primer inputs ---- */

#hdrArmsFields,
#hdrMiddleFields {
  margin-bottom: var(--sp-3);
}

#hdrMiddleSeq {
  min-height: 110px;
}

/* ---- Misc injected bits ---- */

.hdr-order-btn {
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  color: #ffffff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.hdr-order-btn:hover {
  background: var(--brand-strong);
}

/* ---- Injected markup polish (#module-hdr wizard + results) ---- */

.hdr-arm-tools {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.hdr-arm-seq .hdr-arm-tools {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--sp-2);
  margin-left: 0;
}

.hdr-arm-tools .ghost-button,
.hdr-donor-head .ghost-button {
  min-height: var(--btn-sm);
  padding: 0 10px;
  font-size: var(--fs-sm);
}

.hdr-library-note {
  margin-top: var(--sp-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.hdr-donor {
  padding: var(--sp-3) var(--sp-4);
  background: #f9fcff;
  border-top: 1px solid var(--line);
}

.hdr-donor-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.hdr-donor-title {
  color: var(--brand-strong);
  font-size: var(--fs-md);
  font-weight: 800;
}

.hdr-donor .hdr-donor-bar {
  margin: var(--sp-3) 0 0;
}

.hdr-arm-left {
  border-top: 3px solid #7cb0e2;
}

.hdr-arm-middle {
  border-top: 3px solid #f0a95c;
}

.hdr-arm-right {
  border-top: 3px solid #a99ad8;
}

.hdr-set-head .hdr-order-btn {
  margin-left: var(--sp-2);
}

/* ---- Narrow viewports ---- */

@media (max-width: 900px) {
  .hdr-stepper {
    flex-direction: column;
  }

  .hdr-step {
    flex: 0 0 auto;
  }

  .hdr-step + .hdr-step::before {
    display: none;
  }

  .hdr-nav-row {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .hdr-nav-row > span {
    display: none;
  }

  .hdr-nav-row > button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .hdr-panel {
    padding: var(--sp-4);
  }

  #hdrArmPresets > button,
  .hdr-chip-row > button {
    flex: 1 1 auto;
  }

  .hdr-promote {
    padding: 0 10px;
  }
}

/* ============================================================
   HDR 场景驱动 (scenario-driven) — 场景选择器 + Engine A 体外无缝克隆
   Appended 2026-09-26. Scoped to #module-hdr; all Engine B rules
   above are left untouched. Aesthetic follows the soft-light
   theme (brand #4a90d9, pastel segment colours #7cb0e2 /
   #f0a95c / #a99ad8) used by .hdr-track-* / .hdr-donor-*.
   ============================================================ */

/* ---- Scenario picker (常驻，位于 stepper 之前) ---- */

#hdrScenarioPicker,
.hdr-scenario-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  padding: var(--sp-4);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(124, 176, 226, 0.10) 0%, rgba(255, 255, 255, 0) 46%),
    radial-gradient(120% 140% at 100% 0%, rgba(169, 154, 216, 0.10) 0%, rgba(255, 255, 255, 0) 46%),
    rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(230, 236, 242, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hdr-scenario-group {
  min-width: 0;
}

.hdr-scenario-group-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  color: var(--brand-strong);
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.hdr-scenario-group-title::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 14px;
  background: var(--brand);
  border-radius: var(--radius-full);
}

.hdr-scenario-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-2);
}

.hdr-scenario {
  position: relative;
  display: grid;
  align-content: start;
  gap: 2px;
  width: 100%;
  padding: var(--sp-3);
  color: var(--ink);
  text-align: left;
  background: #ffffff;
  border: 1px solid #dbe4ee;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.08s ease;
}

.hdr-scenario:hover {
  background: #f7fbff;
  border-color: #b9d3ec;
  box-shadow: var(--shadow-sm);
}

.hdr-scenario:active {
  transform: translateY(1px);
}

.hdr-scenario:focus-visible {
  outline: 2px solid rgba(74, 144, 217, 0.55);
  outline-offset: 2px;
}

.hdr-scenario-name {
  color: var(--brand-strong);
  font-size: var(--fs-base);
  font-weight: 800;
  line-height: 1.3;
}

.hdr-scenario-desc {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.hdr-scenario-chip {
  justify-self: start;
  margin-top: 5px;
  padding: 1px 9px;
  color: #3574b8;
  background: #eaf3fc;
  border: 1px solid #cfe0f2;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.hdr-scenario.is-active {
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.18), 0 10px 22px rgba(74, 144, 217, 0.16);
}

.hdr-scenario.is-active::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #ffffff;
  background: var(--brand);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(74, 144, 217, 0.42);
}

.hdr-scenario.is-active .hdr-scenario-chip {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

/* ---- Engine A — panel 1 (vector ends) & optional full vector ---- */

#hdrPanelVecEnds .sequence-input-label + .sequence-input-label {
  margin-top: var(--sp-3);
}

#hdrVecLeftEnd,
#hdrVecRightEnd {
  min-height: 96px;
}

.hdr-optional {
  margin-top: var(--sp-4);
  padding: 0 var(--sp-3) var(--sp-3);
  background: #f8fbfe;
  border: 1px dashed #d5e3ef;
  border-radius: var(--radius-md);
}

.hdr-optional > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) 0;
  color: var(--brand-strong);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 700;
  list-style: none;
}

.hdr-optional > summary::-webkit-details-marker {
  display: none;
}

.hdr-optional > summary::before {
  content: "▸";
  flex: 0 0 auto;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.16s ease;
}

.hdr-optional[open] > summary::before {
  transform: rotate(90deg);
}

.hdr-optional > summary:hover {
  color: var(--brand);
}

.hdr-optional .sequence-input-label {
  margin-top: var(--sp-2);
}

#hdrVecFull {
  min-height: 150px;
}

#hdrVecEndsMeta,
#hdrVecEndsWarn,
#hdrFragmentWarn {
  margin-top: var(--sp-3);
}

#hdrVecEndsMeta:empty,
#hdrVecEndsWarn:empty,
#hdrFragmentWarn:empty {
  display: none;
}

/* ---- Engine A — panel 2 (fragment cards) ---- */

#hdrFragmentList:empty::before {
  content: "尚未添加片段，点击右上「+ 添加片段」开始。";
  display: block;
  margin-top: var(--sp-3);
  padding: var(--sp-5);
  color: var(--muted);
  text-align: center;
  background: #f8fbfe;
  border: 1px dashed #d5e3ef;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
}

.hdr-fragment-row {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 3px solid #f0a95c;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hdr-fragment-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.hdr-fragment-idx {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: #ffffff;
  background: #f0a95c;
  border-radius: 50%;
  font-size: var(--fs-sm);
  font-weight: 800;
}

.hdr-fragment-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--ink);
  font-size: var(--fs-base);
  font-weight: 700;
}

.hdr-fragment-name input {
  min-height: var(--btn-md);
}

.hdr-fragment-remove {
  flex: 0 0 auto;
  margin-left: auto;
  min-height: var(--btn-sm);
  padding: 0 11px;
  color: #c0453f;
  background: #ffffff;
  border: 1px solid #f1c9c6;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.hdr-fragment-remove:hover {
  background: #fef3f2;
  border-color: #e8a9a4;
}

.hdr-fragment-seq {
  min-height: 120px;
}

.hdr-fragment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.hdr-fragment-meta:empty {
  display: none;
}

/* ---- Engine A — panel 3 (overlap presets & params) ---- */

#hdrOverlapPresets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

#hdrOverlapPresets > button {
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  color: var(--brand-strong);
  background: #ffffff;
  border: 1px solid #cfe0f2;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 700;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

#hdrOverlapPresets > button:hover {
  background: #f2f8fd;
}

#hdrOverlapPresets > button.active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

#hdrPanelAssemblyParams .primer-advanced-toggle {
  margin-top: var(--sp-3);
}

#hdrAssemblyParamSummary:empty {
  display: none;
}

/* ---- Engine B — 可选 gRNA / PAM 输入区 (第②步) ---- */

.hdr-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  background: #f8fbfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

/* ---- 结果页预留 — 组装结果块 (Engine A output) ---- */

.hdr-assembly-map,
.hdr-assembly-construct {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hdr-assembly-bar {
  display: flex;
  align-items: stretch;
  height: 34px;
  margin-top: var(--sp-3);
  overflow: hidden;
  background: #eef3f8;
  border: 1px solid #dbe4ee;
  border-radius: var(--radius-sm);
}

.hdr-assembly-seg-vector,
.hdr-assembly-seg-insert {
  flex: 0 0 auto;
  min-width: 2px;
  height: 100%;
}

.hdr-assembly-seg-vector {
  background: #7cb0e2;
}

.hdr-assembly-seg-insert {
  background: #f0a95c;
}

.hdr-assembly-junction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 3px;
  height: 100%;
  padding: 0 4px;
  color: #ffffff;
  background: #334155;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-xs);
  font-weight: 800;
  white-space: nowrap;
}

.hdr-assembly-reaction {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  color: #8a5a14;
  background: #fffaf3;
  border: 1px solid #f2e2c8;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  line-height: 1.6;
}

.hdr-construct-seq {
  max-height: 220px;
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  overflow: auto;
  color: var(--ink);
  background: #f8fbfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  line-height: 1.75;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* ---- Narrow viewports (900px / 720px) ---- */

@media (max-width: 900px) {
  #hdrScenarioPicker,
  .hdr-scenario-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .hdr-scenario-cards {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .hdr-guide-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hdr-assembly-bar {
    height: 28px;
  }
}

@media (max-width: 720px) {
  #hdrScenarioPicker,
  .hdr-scenario-picker {
    padding: var(--sp-3);
    gap: var(--sp-3);
  }

  .hdr-scenario-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  #hdrOverlapPresets > button {
    flex: 1 1 auto;
  }

  .hdr-fragment-row {
    padding: var(--sp-3);
  }
}

/* HDR 点突变上下文 */
.hdr-point-ctx {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 6px 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, rgba(127, 127, 127, 0.06));
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  letter-spacing: 1px;
}
.hdr-point-ctx-pos {
  color: var(--muted, #888);
  font-size: 11px;
  letter-spacing: 0;
}
.hdr-ctx-center {
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(240, 130, 60, 0.35);
  color: var(--text, inherit);
}

/* HDR 点突变碱基快捷按钮 */
.hdr-alt-control {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hdr-alt-control > input {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  text-transform: uppercase;
}

#hdrPointAltButtons {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.hdr-alt-button {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  height: 28px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: #3b6f9e;
  background: #eef5fb;
  border: 1px solid #cfe0f0;
  border-radius: 7px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.hdr-alt-button:hover {
  color: #2b5b84;
  background: #e2eefa;
  border-color: #a9cbe8;
}

.hdr-alt-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.25);
}

.hdr-alt-button.is-active,
.hdr-alt-button.is-active:hover {
  color: #ffffff;
  background: #4a90d9;
  border-color: #4a90d9;
}

.hdr-title-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ============================================================
   HDR 批次 1 — 术语提示 / 步骤勾选 / 预览轨道 / 结果卡统一
   ============================================================ */

/* ---- 术语 ⓘ 提示（纯 CSS，hover / focus 均可触发） ---- */
.hdr-i {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-left: 4px;
  padding: 0;
  color: var(--brand-strong);
  background: #eaf3fc;
  border: 1px solid #c4dcf1;
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  vertical-align: 1px;
  cursor: help;
  outline: none;
}

.hdr-i::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 90;
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  color: #5a6f83;
  background: #ffffff;
  border: 1px solid #dbe7f2;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(50, 78, 105, 0.16);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.6;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 4px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  pointer-events: none;
}

.hdr-i:hover::after,
.hdr-i:focus::after,
.hdr-i:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.hdr-i:hover,
.hdr-i:focus,
.hdr-i:focus-visible {
  color: var(--brand);
  border-color: var(--brand);
}

/* ---- 结果页：工具栏 + 推荐下单 ---- */
.hdr-results-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.hdr-results-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.hdr-recommend-order {
  min-height: var(--btn-md);
}

/* ---- 结果卡：编号 / ★推荐 / 评分 / 统一操作区 ---- */
.hdr-set-card.is-recommended {
  border-color: #d9c9a2;
  box-shadow: 0 10px 28px rgba(168, 118, 43, 0.10);
}

.hdr-set-star {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  color: #a8762b;
  background: #fbf2df;
  border: 1px solid #efdcb4;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 800;
  line-height: 1.6;
  white-space: nowrap;
}

.hdr-set-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding-left: var(--sp-2);
  border-left: 1px solid rgba(74, 144, 217, 0.22);
}

.hdr-set-score b {
  color: var(--brand-strong);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.hdr-set-score > span {
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

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

.hdr-set-actions .primer-copy-btn {
  margin-left: 0;
}

.hdr-set-actions .ghost-button,
.hdr-set-actions .primer-copy-btn,
.hdr-set-actions .hdr-order-btn {
  min-height: var(--btn-sm);
  padding: 0 10px;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

/* ---- 组合对比表 ---- */
.hdr-compare-wrap {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hdr-compare-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.hdr-compare-head h5 {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-lg);
}

.hdr-compare-head p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.hdr-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
}

.hdr-compare th,
.hdr-compare td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.hdr-compare th {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.hdr-compare tr:last-child td {
  border-bottom: 0;
}

.hdr-compare tr.is-recommended td {
  background: #fdf9ef;
}

.hdr-compare-rank {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  color: var(--brand-strong);
  background: #eef5fb;
  border-radius: 50%;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-xs);
  font-weight: 800;
}

.hdr-compare-score {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.hdr-compare-score i {
  display: block;
  width: 52px;
  height: 5px;
  overflow: hidden;
  background: #eaf0f6;
  border-radius: var(--radius-full);
}

.hdr-compare-score i::before {
  content: "";
  display: block;
  width: var(--hdr-score, 0%);
  height: 100%;
  background: linear-gradient(90deg, #79b4e6, var(--brand));
  border-radius: inherit;
}

.hdr-compare-score b {
  color: #3f5970;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--fs-sm);
  font-weight: 800;
}

.hdr-compare-alt {
  color: var(--muted);
  font-size: var(--fs-sm);
}

@media (max-width: 900px) {
  .hdr-set-score {
    padding-left: 0;
    border-left: 0;
  }
}

/* ============================================================
   HDR 敲入场景 —「插入位点 / 序列替换」子模式切换
   Appended 2026-10-18.
   ============================================================ */
.hdr-submode {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  margin-bottom: var(--sp-3);
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
}

.hdr-submode-option {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1;
  padding: 7px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.hdr-submode-option:hover {
  color: var(--brand-strong);
}

.hdr-submode-option:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.25);
}

.hdr-submode-option.is-active {
  color: var(--brand-strong);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(70, 96, 128, 0.18);
}

.hdr-submode-panel {
  display: grid;
  gap: var(--sp-3);
}

.hdr-submode-panel > .hdr-coord-grid {
  margin-top: 0;
}

@media (max-width: 720px) {
  .hdr-submode {
    display: flex;
  }

  .hdr-submode-option {
    flex: 1 1 0;
    padding: 8px 12px;
    text-align: center;
  }
}

/* ============================================================
   基因合成在线下单 (2D) — blue accent + colored sequence viewer
   ============================================================ */
.gene-order-form {
  display: grid;
  gap: var(--sp-4);
}

.gene-channel-badge {
  align-self: center;
  padding: 6px 14px;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #1e40af;
  background: #e8effc;
  border: 1px solid #cfdcf7;
  border-radius: 999px;
  white-space: nowrap;
}

.gene-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: rgba(247, 250, 252, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.gene-meta-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: var(--fs-md);
}

.gene-meta-grid label span {
  font-weight: 700;
  color: var(--ink);
}

.gene-meta-grid input,
.gene-meta-grid select {
  width: 100%;
  min-height: var(--btn-lg);
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.gene-meta-grid input:focus,
.gene-meta-grid select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.16);
}

.gene-seq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.gene-seq-head h3 {
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--ink);
}

.gene-seq-sub {
  margin-left: 8px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
}

.gene-seq-tools {
  display: flex;
  gap: var(--sp-2);
}

.gene-seq-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: var(--sp-3);
  align-items: stretch;
}

.gene-seq-input textarea {
  width: 100%;
  min-height: 320px;
  padding: 14px 16px;
  font-family: "SFMono-Regular", "Consolas", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  resize: vertical;
}

.gene-seq-input textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.16);
}

.gene-seq-view {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f7f9ff;
  border: 1px solid #dbe4f7;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.gene-seq-stats {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 10px 14px;
  font-size: var(--fs-sm);
  color: #475569;
  background: #eef3fd;
  border-bottom: 1px solid #dbe4f7;
}

.gene-stat b {
  color: #1d4ed8;
  font-size: var(--fs-md);
}

.gene-stat-warn {
  color: #b45309;
  font-weight: 700;
}

.gene-seq-viewer {
  flex: 1 1 auto;
  max-height: 360px;
  overflow: auto;
  padding: 10px 12px;
  font-family: "SFMono-Regular", "Consolas", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.gene-seq-empty {
  padding: 28px 12px;
  color: #94a3b8;
  font-family: var(--font-sans, Arial, sans-serif);
  font-size: var(--fs-md);
  text-align: center;
}

.gene-seq-line {
  display: flex;
  align-items: flex-start;
  white-space: pre;
}

.gene-seq-gutter {
  flex: 0 0 3.6em;
  padding-right: 0.8em;
  color: #93a3bd;
  font-size: 12px;
  text-align: right;
  user-select: none;
}

.gene-seq-bases {
  flex: 1 1 auto;
  letter-spacing: 0;
}

.gene-seq-bases i {
  font-style: normal;
}

.gene-seq-line-ruler {
  height: 1.15em;
  margin-bottom: 2px;
}

.gene-seq-ruler {
  position: relative;
  flex: 1 1 auto;
  height: 1.15em;
}

.gene-seq-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  color: #94a3b8;
}

.gene-seq-tick-num {
  font-size: 11px;
}

.gene-seq-bases .b-a { color: #2e9e5b; }
.gene-seq-bases .b-t { color: #d64545; }
.gene-seq-bases .b-g { color: #d98324; }
.gene-seq-bases .b-c { color: #2f6fed; }
.gene-seq-bases .b-n { color: #94a3b8; }

.gene-seq-more {
  margin-top: 8px;
  padding: 6px 8px;
  color: #b45309;
  font-family: var(--font-sans, Arial, sans-serif);
  font-size: var(--fs-sm);
}

.gene-confirm-seq {
  margin-top: 8px;
}

.gene-confirm-seq pre {
  max-height: 160px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 10px 12px;
  font-family: "SFMono-Regular", "Consolas", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #1e3a8a;
  background: #f7f9ff;
  border: 1px solid #dbe4f7;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 1024px) {
  .gene-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .gene-meta-grid {
    grid-template-columns: 1fr;
  }
  .gene-seq-grid {
    grid-template-columns: 1fr;
  }
  .gene-seq-input textarea {
    min-height: 200px;
  }
}

/* ============================================================
   Group leader statistics (课题组测序 / 合成)
   ============================================================ */

.group-stats-range {
  min-height: var(--btn-md);
  padding: 0 var(--sp-3);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: #2f4a63;
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(74, 144, 217, 0.16);
}
.group-stats-range[data-range="1m"] { background: linear-gradient(135deg, #a9cdea, #c2e0f5); }
.group-stats-range[data-range="3m"] { background: linear-gradient(135deg, #93b8de, #aecfee); }
.group-stats-range[data-range="6m"] { background: linear-gradient(135deg, #c3b8ea, #d7cdf4); }
.group-stats-range[data-range="year"] { background: linear-gradient(135deg, #f2b8c8, #f8d3dd); }
.group-stats-range[data-range="month"] { background: linear-gradient(135deg, #a9d4f0, #b9e6e0); }
.group-stats-range.active {
  outline: 3px solid rgba(74, 144, 217, 0.32);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(74, 144, 217, 0.24);
}

.group-stats-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
}
.group-stats-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-4);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.group-stats-kpi span {
  color: var(--muted);
  font-size: var(--fs-sm);
}
.group-stats-kpi strong {
  color: #1f3b57;
  font-size: var(--fs-2xl);
  line-height: 1.15;
}
.group-stats-kpi em {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-style: normal;
}
.group-stats-card {
  margin-bottom: var(--sp-5);
  padding: var(--sp-5);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.group-stats-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.group-stats-card-head h3 {
  margin: 2px 0 0;
  color: #1f3b57;
  font-size: var(--fs-lg);
}
.group-stats-chart {
  overflow-x: auto;
  min-height: 230px;
}
.group-stats-chart svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}
.group-stats-grid-line {
  stroke: #e7eef6;
  stroke-width: 1;
}
.group-stats-axis-text {
  fill: #7a8ea3;
  font-size: 11px;
}
.group-stats-bar {
  fill: url(#groupStatsBarGradient);
  fill: #6aaee3;
  opacity: 0.9;
  transition: opacity 0.15s ease;
}
.group-stats-bar:hover {
  opacity: 1;
  fill: #4a90d9;
}
.group-stats-table-wrap {
  overflow-x: auto;
}
.group-stats-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
.group-stats-table th,
.group-stats-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eef2f7;
  white-space: nowrap;
}
.group-stats-table th {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 700;
  background: #f8fbfe;
}
.group-stats-table tbody tr:last-child td {
  border-bottom: 0;
}
.group-stats-table tbody tr:hover {
  background: #f9fcff;
}
.group-stats-clickable {
  cursor: pointer;
}
.group-stats-clickable.active {
  background: #eef7ff;
}
.group-stats-clickable.active td:first-child {
  box-shadow: inset 3px 0 0 var(--brand);
}
.group-stats-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-xs);
}
.group-stats-badge {
  display: inline-block;
  padding: 1px 8px;
  color: #1f6f5f;
  background: #e5f7f2;
  border: 1px solid #b9e5da;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.group-stats-empty {
  padding: var(--sp-8);
  color: var(--muted);
  text-align: center;
  background: #f9fbfd;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

@media (max-width: 900px) {
  .group-stats-card {
    padding: var(--sp-4);
  }
  .group-stats-card-head {
    flex-direction: column;
  }
}
