:root {
  color-scheme: light;
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --line: #d8e1ea;
  --text: #16212b;
  --muted: #687888;
  --primary: #0f766e;
  --blue: #0b63ce;
  --green: #15803d;
  --amber: #b7791f;
  --gray: #64748b;
  --page-max: 1560px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(238, 243, 247, 0) 240px),
    var(--bg);
  color: var(--text);
}

html,
body {
  height: 100%;
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.header {
  background: linear-gradient(90deg, #10202c 0%, #143040 100%);
  color: #fff;
  padding: 18px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.brand {
  min-width: 0;
  font-weight: 850;
  font-size: 22px;
  line-height: 1.06;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: #b9cad8;
  font-size: 13px;
  font-weight: 500;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.nav button {
  max-width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  color: #dce8f0;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav button.active,
.nav button:hover {
  background: #1e394b;
  color: #fff;
}

.nav button:focus-visible,
.card:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
}

.content {
  min-width: 0;
  width: min(var(--page-max), 100%);
  margin: 0 auto;
  padding: 34px 36px;
  display: grid;
  gap: 26px;
  align-content: start;
  overflow-y: auto;
}

#view {
  display: grid;
  gap: 26px;
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.78fr);
  gap: 24px;
  align-items: stretch;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  padding: 24px;
  box-shadow: 0 10px 28px rgba(20, 39, 56, 0.055);
}

.hero-panel {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(11, 99, 206, 0.05)),
    #fff;
}

.panel h1,
.panel h2,
.panel h3 {
  margin: 0 0 12px;
}

.panel h1 {
  font-size: 34px;
  line-height: 1.12;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.cards {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  padding: 0;
  background: #fff;
  display: grid;
  gap: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.card:hover,
.card.active {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.12);
}

.card:hover {
  transform: translateY(-2px);
}

.card h3 {
  margin: 0;
  line-height: 1.18;
}

.card-body {
  display: grid;
  gap: 9px;
  padding: 14px;
}

.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.latin {
  min-height: 42px;
  color: #334155;
  overflow-wrap: anywhere;
}

.phage-image {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(16, 32, 44, 0.18)),
    #dce7ef;
}

.phage-image.thumb {
  aspect-ratio: 16 / 9;
}

.phage-image.detail-photo {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  margin-bottom: 16px;
}

.phage-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(0.95) contrast(1.04);
}

.phage-image::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 46%;
  background: linear-gradient(180deg, rgba(16, 32, 44, 0), rgba(16, 32, 44, 0.62));
  pointer-events: none;
}

.phage-image span {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  z-index: 1;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.34);
}

.phage-image.missing {
  display: grid;
  place-items: end start;
  min-height: 150px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.1fr) minmax(170px, 0.7fr) minmax(170px, 0.7fr);
  gap: 14px;
  align-items: end;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: #405165;
  font-weight: 750;
}

.field.compact span {
  font-size: 12px;
  letter-spacing: 0;
  color: var(--muted);
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

select {
  appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, #5b6b7a 50%),
    linear-gradient(135deg, #5b6b7a 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 12px) 19px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

input:hover,
select:hover {
  border-color: #b8c7d5;
  background-color: #fbfdff;
}

input:focus,
select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(15, 118, 110, 0.13);
}

.status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #edf2f7;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.status.active {
  background: #dcfce7;
  color: var(--green);
}

.status.research {
  background: #dbeafe;
  color: var(--blue);
}

.status.archive {
  background: #f1f5f9;
  color: var(--gray);
}

.status.candidate,
.status.historical {
  background: #fef3c7;
  color: var(--amber);
}

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

.metric {
  display: grid;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.metric strong {
  font-size: 30px;
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(460px, 0.86fr);
  gap: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.section-title > div {
  min-width: 0;
}

.section-title h2 {
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.phage-profile {
  display: grid;
  gap: 0;
}

.photo-credit {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef6f5;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.list {
  display: grid;
  gap: 14px;
}

.target,
.study {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 16px;
  display: grid;
  gap: 10px;
  background: var(--surface-soft);
}

.target:hover,
.study:hover {
  border-color: #c5d4e2;
  background: #fff;
}

.target-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  max-width: 360px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  background: var(--surface-soft);
  color: #354453;
  font-size: 13px;
}

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

.empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1120px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .hero,
  .detail,
  .cards,
  .metrics {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .content {
    overflow: visible;
    padding: 24px;
  }
}

@media (max-width: 1320px) {
  .header {
    align-items: flex-start;
    gap: 14px;
  }

  .brand {
    flex: 1 1 360px;
  }

  .nav {
    flex: 1 1 420px;
  }
}

@media (max-width: 720px) {
  .header {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .content {
    padding: 16px;
  }

  #view {
    gap: 18px;
  }

  .panel {
    padding: 18px;
  }

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

  table {
    min-width: 760px;
  }
}
