:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-soft: #0b1728;
  --card: rgba(14, 28, 47, 0.9);
  --card-strong: #10223a;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(94, 234, 212, 0.4);
  --text: #f8fafc;
  --muted: #9fb0c7;
  --accent: #5eead4;
  --accent-strong: #2dd4bf;
  --accent-ink: #042f2e;
  --blue: #60a5fa;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(45, 212, 191, 0.14), transparent 30rem),
    radial-gradient(circle at 86% 18%, rgba(96, 165, 250, 0.12), transparent 28rem),
    linear-gradient(180deg, #081423 0%, #07111f 58%, #050c16 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 78px 0 34px;
}

.hero {
  max-width: 760px;
  margin: 0 auto 38px;
  text-align: center;
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.06);
}

.eyebrow span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(94, 234, 212, 0.12);
}

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

h1 {
  margin: 18px 0 10px;
  font-size: clamp(3rem, 9vw, 6.3rem);
  line-height: 0.95;
  letter-spacing: -0.065em;
}

.hero > p {
  max-width: 660px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.7;
}

.search-card,
.results {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(17, 35, 59, 0.94), rgba(10, 23, 40, 0.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.search-card {
  position: relative;
  z-index: 5;
  padding: 28px;
  border-radius: var(--radius);
}

.card-heading,
.results-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.card-heading {
  margin-bottom: 24px;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.database-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(82px, auto));
  gap: 7px;
  margin: 0;
}

.database-stats > div {
  display: flex;
  min-height: 48px;
  flex-direction: column-reverse;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid rgba(94, 234, 212, 0.18);
  border-radius: 11px;
  background: rgba(45, 212, 191, 0.045);
  text-align: right;
}

.database-stats dt {
  color: #7890aa;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.database-stats dd {
  margin: 0 0 1px;
  color: #d8fffa;
  font-size: 0.94rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

h2 {
  margin: 4px 0 0;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: -0.025em;
}

.reset-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  color: #dbeafe;
  cursor: pointer;
  transition: 160ms ease;
}

.reset-button:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.5);
  background: rgba(94, 234, 212, 0.08);
}

.reset-button:disabled {
  opacity: 0.36;
  cursor: default;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.filter {
  position: relative;
  min-width: 0;
}

.filter.is-open {
  z-index: 10;
}

.filter label {
  display: block;
  margin: 0 0 8px 2px;
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 700;
}

.combobox-wrap {
  position: relative;
}

.combobox-input {
  width: 100%;
  height: 50px;
  padding: 0 68px 0 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 13px;
  outline: none;
  background: rgba(3, 12, 23, 0.56);
  color: var(--text);
  text-overflow: ellipsis;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.combobox-input::placeholder {
  color: #6f839e;
}

.combobox-input:hover {
  border-color: rgba(148, 163, 184, 0.45);
}

.combobox-input:focus,
.filter.is-open .combobox-input {
  border-color: var(--accent-strong);
  background: rgba(4, 17, 31, 0.92);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.11);
}

.field-clear {
  position: absolute;
  top: 50%;
  right: 34px;
  display: none;
  width: 26px;
  height: 26px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #8ea1ba;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.filter.has-value .field-clear {
  display: grid;
  place-items: center;
}

.field-clear:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.chevron {
  position: absolute;
  top: calc(50% - 3px);
  right: 16px;
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  border-right: 2px solid #7e91aa;
  border-bottom: 2px solid #7e91aa;
  pointer-events: none;
  transition: transform 160ms ease;
}

.filter.is-open .chevron {
  top: calc(50% - 1px);
  transform: rotate(225deg);
}

.option-panel {
  position: absolute;
  top: 82px;
  left: 0;
  right: 0;
  display: none;
  max-height: 330px;
  overflow-y: auto;
  padding: 7px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 14px;
  background: #0b1829;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.48);
  scrollbar-width: thin;
  scrollbar-color: #38506d transparent;
}

.filter.is-open .option-panel {
  display: block;
}

.option {
  display: flex;
  width: 100%;
  min-height: 39px;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #dbe7f5;
  text-align: left;
  cursor: pointer;
}

.option:hover,
.option.is-active {
  background: rgba(94, 234, 212, 0.11);
  color: #fff;
}

.option.is-selected {
  color: var(--accent);
  font-weight: 700;
}

.option-empty,
.option-limit {
  margin: 0;
  padding: 13px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.option-limit {
  border-top: 1px solid var(--line);
}

.option-count {
  display: block;
  min-height: 17px;
  margin: 7px 0 0 2px;
  color: #71859f;
  font-size: 0.72rem;
}

.active-filters {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 17px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.active-filters.has-items {
  display: flex;
}

.database-link-row {
  display: flex;
  justify-content: center;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.database-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid rgba(94, 234, 212, 0.46);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.15), rgba(96, 165, 250, 0.1));
  color: #d8fffa;
  font-size: 0.86rem;
  font-weight: 760;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.database-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.22), rgba(96, 165, 250, 0.14));
}

.database-button span {
  color: var(--accent);
  font-size: 1rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.07);
  color: #d8fffa;
  font-size: 0.78rem;
}

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

.filter-chip button {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  color: inherit;
  cursor: pointer;
}

.results {
  margin-top: 22px;
  padding: 26px;
  border-radius: var(--radius);
}

.results-heading {
  margin-bottom: 20px;
}

.result-count {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.07);
  color: #b8fff6;
  font-size: 0.84rem;
  font-weight: 700;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(3, 11, 21, 0.38);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 14px 15px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #10223a;
  color: #aebfd4;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: rgba(96, 165, 250, 0.055);
}

td:first-child {
  color: #7f93ac;
  font-variant-numeric: tabular-nums;
}

td:nth-child(3) {
  color: var(--accent);
  font-weight: 700;
}

td:nth-child(5) {
  color: #bed0e4;
}

.empty-state {
  padding: 48px 20px;
  text-align: center;
}

.empty-state span {
  display: inline-grid;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-weight: 800;
}

.empty-state h3 {
  margin-bottom: 5px;
}

.empty-state p,
.result-note {
  color: var(--muted);
}

.empty-state p {
  margin-bottom: 0;
}

.result-note {
  min-height: 20px;
  margin: 12px 2px 0;
  font-size: 0.78rem;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 4px 0;
  color: #62758e;
  font-size: 0.76rem;
}

footer span:first-child {
  color: #91a5be;
  font-weight: 750;
}

.database-page .page-shell {
  width: min(1380px, calc(100% - 40px));
  padding-top: 46px;
}

.database-page .hero {
  max-width: 900px;
  margin-bottom: 28px;
}

.database-page h1 {
  font-size: clamp(2.6rem, 7vw, 5rem);
}

.database-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.database-search {
  position: relative;
  flex: 1 1 520px;
}

.database-search input {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  outline: none;
  background: rgba(3, 12, 23, 0.56);
  color: var(--text);
}

.database-search input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.11);
}

.database-total {
  flex: 0 0 auto;
  color: #b8fff6;
  font-size: 0.84rem;
  font-weight: 760;
}

.database-table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(3, 11, 21, 0.38);
}

.database-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.database-table th,
.database-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.11);
  text-align: left;
  vertical-align: top;
}

.database-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #10223a;
  color: #aebfd4;
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.database-table tbody tr:hover {
  background: rgba(96, 165, 250, 0.055);
}

.database-table td:first-child {
  width: 86px;
  color: #71859f;
  font-variant-numeric: tabular-nums;
}

.database-table td:nth-child(3) {
  color: var(--accent);
  font-weight: 720;
}

.database-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin-top: 18px;
}

.database-pagination button {
  min-width: 92px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: #dbeafe;
  cursor: pointer;
}

.database-pagination button:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.5);
  background: rgba(94, 234, 212, 0.08);
}

.database-pagination button:disabled {
  opacity: 0.34;
  cursor: default;
}

.database-page-number {
  min-width: 150px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.back-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 0 16px;
  border: 1px solid rgba(94, 234, 212, 0.42);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.13), rgba(96, 165, 250, 0.08));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  color: #d8fffa;
  font-size: 0.84rem;
  font-weight: 780;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.back-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.21), rgba(96, 165, 250, 0.13));
  color: #fff;
}

.back-link span {
  color: var(--accent);
  font-size: 1.08rem;
}

.database-empty {
  padding: 42px 20px !important;
  color: var(--muted);
  text-align: center !important;
}

noscript {
  position: fixed;
  inset: auto 20px 20px;
  z-index: 100;
  padding: 14px;
  border-radius: 12px;
  background: #7f1d1d;
  color: #fff;
  text-align: center;
}

@media (max-width: 940px) {
  .card-heading {
    align-items: flex-start;
  }

  .card-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
  }

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

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 46px;
  }

  .hero {
    margin-bottom: 28px;
  }

  .search-card,
  .results {
    padding: 19px;
    border-radius: 19px;
  }

  .search-card {
    /* A backdrop filter creates a containing block for fixed descendants.
       On phones that pushed the suggestion sheet to the bottom of the full
       card instead of the bottom of the visible screen. */
    backdrop-filter: none;
  }

  .card-heading,
  .results-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .card-actions {
    align-items: stretch;
    flex-direction: column-reverse;
    gap: 10px;
  }

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

  .database-stats > div {
    text-align: left;
  }

  .reset-button {
    align-self: flex-end;
  }

  .database-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .database-search {
    flex-basis: auto;
  }

  .database-total {
    padding-left: 2px;
  }

  .database-pagination {
    gap: 8px;
  }

  .database-page-number {
    min-width: 100px;
  }

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

  .option-panel {
    position: absolute;
    inset: 82px 0 auto;
    z-index: 202;
    max-height: min(42vh, 320px);
    margin-top: 0;
    border-radius: 14px;
  }

  .filter.is-open::after {
    display: none;
    content: none;
  }

  .filter.is-open .option-panel {
    z-index: 202;
  }

  .filter.is-open .combobox-wrap {
    z-index: auto;
  }

  .filter.is-open label {
    position: static;
    z-index: auto;
  }

  th,
  td {
    min-width: 145px;
  }

  th:first-child,
  td:first-child {
    min-width: 78px;
  }

  footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
