:root {
  --bg: #f4f1ea;
  --bg-accent: rgba(34, 113, 176, 0.08);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --border: rgba(17, 33, 56, 0.12);
  --ink: #122237;
  --muted: #59667a;
  --accent: #0c7c90;
  --accent-strong: #1259b2;
  --shadow: 0 18px 48px rgba(18, 34, 55, 0.11);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 999px;
  --max-width: 1480px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(12, 124, 144, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(229, 119, 28, 0.12), transparent 22%),
    linear-gradient(180deg, #f8f5ef 0%, #eef2f5 100%);
}

img {
  display: block;
  max-width: 100%;
}

button,
a {
  font: inherit;
}

.page-shell {
  width: min(calc(100% - 32px), var(--max-width));
  margin: 0 auto;
  padding: 32px 0 48px;
}

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

.eyebrow,
.section-kicker,
.meta-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
}

h1 {
  font-size: clamp(2.4rem, 3vw, 3.6rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  max-width: 14ch;
}

.lede {
  max-width: 68ch;
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 1.02rem;
}

.masthead-card,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.masthead-card {
  padding: 22px 24px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.catalog-summary {
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.card {
  padding: 22px;
}

.sidebar {
  position: sticky;
  top: 24px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.protein-list,
.fluor-list,
.stat-grid {
  display: grid;
  gap: 12px;
}

.protein-button,
.fluor-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 18px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.protein-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
}

.protein-button:hover,
.protein-button:focus-visible,
.fluor-button:hover,
.fluor-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(18, 89, 178, 0.35);
  outline: none;
}

.protein-button.is-active {
  background: linear-gradient(135deg, rgba(18, 89, 178, 0.14), rgba(12, 124, 144, 0.1));
  border-color: rgba(18, 89, 178, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.protein-name {
  font-size: 1rem;
  font-weight: 700;
}

.protein-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18, 34, 55, 0.08);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
}

.content {
  display: grid;
  gap: 24px;
}

.controls-card {
  padding-bottom: 18px;
}

.fluor-list {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.fluor-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-align: left;
}

.fluor-button.is-active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--swatch) 22%, white), rgba(255, 255, 255, 0.92));
  border-color: color-mix(in srgb, var(--swatch) 55%, white);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.fluor-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--swatch) 18%, white);
}

.fluor-text {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.fluor-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.fluor-history-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18, 34, 55, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
}

.hero-card {
  display: grid;
  gap: 22px;
}

.series-subtitle,
.table-help,
.series-notes {
  color: var(--muted);
  line-height: 1.55;
}

.series-subtitle {
  margin-top: 10px;
  max-width: 72ch;
}

.series-notice {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(18, 89, 178, 0.11);
  border: 1px solid rgba(18, 89, 178, 0.25);
  color: #164d8c;
  font-weight: 700;
  line-height: 1.5;
}

.series-quality {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(180, 83, 9, 0.28);
  background: rgba(245, 158, 11, 0.12);
  color: #7c3e08;
}

.series-quality[data-level="invalid"] {
  border-color: rgba(185, 28, 28, 0.3);
  background: rgba(220, 38, 38, 0.1);
  color: #8f1d1d;
}

.series-quality[data-level="limited"] {
  border-color: rgba(71, 85, 105, 0.26);
  background: rgba(100, 116, 139, 0.1);
  color: #475569;
}

.series-quality-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.series-quality p {
  margin: 10px 0 0;
  font-weight: 650;
  line-height: 1.5;
}

.quality-badge,
.metric-quality-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(180, 83, 9, 0.13);
  color: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quality-date {
  color: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.8;
}

.quality-row-invalid {
  background: rgba(220, 38, 38, 0.075) !important;
}

.quality-row-caution {
  background: rgba(245, 158, 11, 0.075) !important;
}

.quality-row-limited {
  background: rgba(100, 116, 139, 0.065) !important;
}

.metric-quality {
  min-width: 180px;
}

.metric-quality-reason {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.series-info-status {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(229, 119, 28, 0.12);
  border: 1px solid rgba(229, 119, 28, 0.22);
  color: #7d4d13;
  font-weight: 600;
  line-height: 1.5;
}

.series-notes {
  margin-top: 12px;
}

.history-controls {
  margin-top: 16px;
}

.history-menu {
  border-radius: 18px;
  border: 1px solid rgba(17, 33, 56, 0.1);
  background: rgba(255, 255, 255, 0.64);
  overflow: hidden;
}

.history-menu[open] {
  background: rgba(255, 255, 255, 0.82);
}

.history-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.history-summary::-webkit-details-marker {
  display: none;
}

.history-summary-copy {
  display: grid;
  gap: 4px;
}

.history-summary-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.history-summary-value {
  font-weight: 700;
  color: var(--ink);
}

.history-summary-count {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.history-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.history-option {
  width: 100%;
  border: 1px solid rgba(17, 33, 56, 0.08);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.history-option:hover,
.history-option:focus-visible {
  border-color: rgba(18, 89, 178, 0.3);
  transform: translateY(-1px);
  outline: none;
}

.history-option.is-active {
  background: linear-gradient(135deg, rgba(18, 89, 178, 0.12), rgba(12, 124, 144, 0.08));
  border-color: rgba(18, 89, 178, 0.36);
}

.history-option-primary,
.history-option-secondary {
  display: block;
}

.history-option-primary {
  font-weight: 700;
}

.history-option-secondary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.stat-card {
  flex: 0 0 clamp(170px, 18vw, 240px);
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(17, 33, 56, 0.08);
}

.stat-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.stat-value {
  font-size: 1.25rem;
  line-height: 1.1;
  font-weight: 700;
}

.figure-stack {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.figure-card {
  padding: 18px;
}

.figure-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.figure-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
}

.figure-link:hover,
.figure-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.figure-image {
  width: 100%;
  border-radius: 20px;
  border: 1px solid rgba(17, 33, 56, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 249, 0.9));
}

.metrics-card {
  margin-top: 24px;
}

.metrics-heading {
  margin-bottom: 16px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 20px;
  border: 1px solid rgba(17, 33, 56, 0.08);
  background: rgba(255, 255, 255, 0.62);
}

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

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(17, 33, 56, 0.08);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: rgba(241, 245, 249, 0.96);
  font-size: 0.84rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

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

tbody tr:nth-child(even) {
  background: rgba(18, 34, 55, 0.025);
}

@media (max-width: 1120px) {
  .masthead,
  .layout,
  .hero-card {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(calc(100% - 20px), var(--max-width));
    padding-top: 20px;
  }

  .card,
  .masthead-card {
    padding: 18px;
    border-radius: 22px;
  }

  .fluor-list {
    grid-template-columns: 1fr;
  }

  .stat-card {
    flex-basis: min(240px, 72vw);
  }
}
