.tool-app-shell {
  width: min(1360px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.tool-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.tool-hero h1 {
  font-size: clamp(38px, 6vw, 68px);
}

.tool-hero p {
  max-width: 840px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.tool-hero-card {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(23, 23, 23, 0.07);
}

.tool-hero-card strong,
.tool-hero-card span {
  display: block;
}

.tool-hero-card strong {
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 20px;
}

.tool-hero-card span {
  color: var(--muted);
  font-size: 13px;
}

.qpcr-workspace {
  max-width: 1360px;
  margin: 0 auto;
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.84fr) minmax(520px, 1.16fr);
  gap: 22px;
  align-items: start;
}

.mode-tabs {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(31, 42, 55, 0.06);
}

.tab-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 750;
}

.tab-button.active {
  background: var(--accent);
  color: #fff;
}

.hidden {
  display: none !important;
}

.input-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 20px;
}

.results-panel {
  min-height: 600px;
  overflow: hidden;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

textarea {
  min-height: 300px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

input[type="file"] {
  height: auto;
  padding: 9px 12px;
}

.help-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

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

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 750;
}

.primary-button {
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
}

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

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

.ghost-button:hover {
  border-color: rgba(15, 118, 110, 0.42);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.summary-strip div {
  min-width: 0;
  padding: 13px 8px;
  background: var(--surface-soft);
  text-align: center;
}

.summary-strip strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}

.summary-strip span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-head h2 {
  font-size: 20px;
}

.panel-head select {
  max-width: 160px;
}

.panel-actions .ghost-button {
  min-height: 38px;
}

.message-box {
  margin: 18px 20px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.55;
}

.message-box.warning {
  border-color: rgba(183, 121, 31, 0.35);
  background: #fff8ed;
  color: var(--amber);
}

.results-list {
  display: grid;
  gap: 12px;
  padding: 18px 20px 22px;
}

.primer-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.primer-card.best {
  border-color: rgba(15, 118, 110, 0.45);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7faf9;
}

.rank,
.score {
  font-weight: 800;
}

.score {
  color: var(--accent-strong);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.metric {
  padding: 11px 12px;
  background: #fff;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.primer-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.primer-table th,
.primer-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.primer-table th {
  width: 86px;
  color: var(--muted);
  font-size: 12px;
}

.sequence {
  overflow-wrap: anywhere;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 14px 14px;
}

.badge {
  padding: 5px 8px;
  border-radius: 6px;
  background: #eef6f5;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
}

.badge.warn {
  background: #fff0f3;
  color: var(--rose);
}

.batch-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.batch-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  font-size: 13px;
}

.batch-table th,
.batch-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.batch-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7faf9;
  color: var(--muted);
  font-size: 12px;
}

.batch-table .sequence {
  max-width: 220px;
}

.error-row td {
  background: #fff8ed;
  color: var(--amber);
}

@media (max-width: 960px) {
  .tool-app-shell {
    width: min(100% - 28px, 1360px);
    padding-top: 34px;
  }

  .tool-hero,
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .tool-hero h1 {
    font-size: 36px;
  }

  .grid.three,
  .summary-strip,
  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .panel-head,
  .card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head select {
    max-width: none;
  }

  .panel-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
