:root {
  --bg: #f6f6f1;
  --surface: #ffffff;
  --surface-soft: #efefe8;
  --ink: #111111;
  --muted: #6c6c69;
  --line: rgba(17, 17, 17, 0.1);
  --line-strong: rgba(17, 17, 17, 0.16);
  --green: #1b7447;
  --amber: #9f651a;
  --blue: #2259bb;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: "General Sans", sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
}

a {
  color: inherit;
}

code {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.topbar-mark,
.topbar-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-mark {
  align-items: baseline;
}

.topbar-links {
  align-items: center;
}

.topbar-links {
  margin-right: 10px;
}

.topbar-label {
  font-size: 1.72rem;
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.02em;
}

.topbar-meta,
.topbar-links a {
  color: var(--muted);
  font-size: 1rem;
  text-decoration: none;
}

.topbar-links a:hover {
  color: var(--ink);
}

.topbar-links a {
  border-bottom: 1px solid rgba(17, 17, 17, 0.24);
  line-height: 1.2;
}

.topbar-links a:hover {
  border-bottom-color: var(--ink);
}

.eyebrow,
.section-kicker,
.label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-header h2,
.controls-title {
  margin: 0;
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.055em;
}

.summary-strip {
  margin-top: 22px;
  padding: 14px 0 14px;
}

.disclaimer,
.meta,
.muted {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.summary-line {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-align: center;
}

.summary-segment {
  display: inline;
}

.summary-line strong {
  display: inline-block;
  margin: 0 0.58em 0 0.12em;
  color: var(--ink);
  font-size: 2.08rem;
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.05em;
  vertical-align: -0.08em;
}

.controls {
  padding: 16px 0 14px;
}

.controls-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.search-shell {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  min-width: 0;
}

.controls-panel {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  gap: 10px 14px;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: 0;
  justify-content: center;
}

.toggle-group > * {
  min-width: 0;
}

.inline-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  white-space: nowrap;
  font-size: 0.93rem;
  cursor: pointer;
}

.inline-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.inline-toggle span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.inline-toggle span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.16);
  transition: background-color 140ms ease, transform 140ms ease;
}

.inline-toggle:hover span {
  border-color: rgba(17, 17, 17, 0.34);
  background: rgba(255, 255, 255, 0.94);
}

.inline-toggle input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.inline-toggle input:checked + span::before {
  background: #fff;
  transform: scale(1.05);
}

.inline-toggle input:focus-visible + span {
  outline: 2px solid rgba(17, 17, 17, 0.18);
  outline-offset: 2px;
}

.search-shell input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  box-shadow: 0 1px 0 rgba(17, 17, 17, 0.03);
}

@media (max-width: 1080px) {
  .search-shell {
    max-width: none;
    min-width: 0;
  }

  .controls-panel {
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 10px 14px;
  }

  .toggle-group {
    justify-content: center;
    flex-wrap: wrap;
  }

  .active-filter-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px 14px 88px;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-mark {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .topbar-label {
    font-size: 1.32rem;
    line-height: 0.98;
  }

  .topbar-meta {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .summary-strip {
    display: block;
    margin-top: 18px;
    padding: 8px 0 14px;
  }

  .summary-line {
    white-space: normal;
    text-wrap: initial;
    font-size: 0.95rem;
    line-height: 1.36;
    text-align: center;
  }

  .summary-segment {
    display: block;
    margin-top: 0.16rem;
  }

  .summary-segment:first-child {
    margin-top: 0;
  }

  .summary-line strong {
    margin: 0 0.18em 0 0.08em;
    font-size: 1.52rem;
    line-height: 1;
    vertical-align: -0.04em;
  }

  .controls {
    padding: 14px 0 10px;
  }

  .controls-row {
    gap: 12px;
  }

  .search-shell input {
    min-height: 46px;
    padding: 0 14px;
    border-radius: 11px;
  }

  .controls-panel {
    min-height: 0;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 860px;
  }

  th,
  td {
    padding: 13px 8px;
  }

  thead th:nth-child(2),
  tbody td:nth-child(2) {
    width: 260px;
  }

  thead th:nth-child(5),
  tbody td:nth-child(5) {
    width: 120px;
  }

  .toggle-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 8px 14px;
    width: 100%;
  }

  .active-filter-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .inline-toggle,
  .tag-filter {
    width: 100%;
  }

  .inline-toggle span,
  .tag-filter-trigger {
    width: 100%;
    justify-content: center;
  }

  .filter-tools {
    display: block;
    width: 100%;
  }

  .tag-filter {
    width: 100%;
  }

  .tag-filter-panel {
    left: 0;
    right: 0;
    width: auto;
    min-width: 0;
  }

  .active-tag-filters {
    min-height: 0;
    justify-content: flex-start;
  }

  .inline-toggle {
    font-size: 0.87rem;
    line-height: 1.2;
  }

  .inline-toggle span {
    min-height: 34px;
    gap: 7px;
    padding: 0 12px;
  }

  .inline-toggle span::before {
    width: 7px;
    height: 7px;
  }
}

.search-shell input:focus {
  outline: none;
  border-color: var(--ink);
}

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

.tag-filter summary {
  list-style: none;
}

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

.tag-filter-trigger,
.active-tag-chip {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
}

.tag-filter-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  width: 100%;
  padding: 0 14px;
  cursor: pointer;
  font-size: 0.93rem;
  font-weight: 500;
}

.tag-filter-trigger::after {
  content: "▾";
  font-size: 0.76rem;
  color: var(--muted);
}

.tag-filter[open] .tag-filter-trigger::after {
  content: "▴";
}

.tag-filter-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: auto;
  z-index: 10;
  width: min(320px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(17, 17, 17, 0.12);
}

.tag-filter-panel-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag-filter-search {
  flex: 1 1 auto;
}

.tag-filter-search input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.active-tag-clear {
  padding: 0 12px;
  cursor: pointer;
}

.tag-filter-hint,
.tag-filter-empty {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
}

.tag-filter-options {
  display: grid;
  gap: 8px;
  max-height: 280px;
  margin-top: 12px;
  overflow: auto;
}

.tag-filter-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(17, 17, 17, 0.06);
  border-radius: 12px;
  background: rgba(17, 17, 17, 0.02);
}

.tag-filter-option input {
  accent-color: var(--ink);
}

.tag-filter-option-name {
  font-size: 0.9rem;
}

.tag-filter-option-count {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.active-filter-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding-top: 12px;
}

.filter-tools {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.active-tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  justify-content: flex-start;
}

.active-tag-chip {
  padding: 0 12px;
  cursor: pointer;
}

.table-section {
  padding-top: 10px;
}

.table-wrap {
  overflow: auto;
  margin-top: 0;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  border-radius: 14px;
}

.table-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-top: 18px;
}

.footer-page-size {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-page-size label {
  white-space: nowrap;
}

.footer-page-size select {
  min-height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
}

.pagination {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  justify-self: center;
}

.pagination[hidden] {
  display: none;
}

.pagination-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: rgba(17, 17, 17, 0.72);
  font: inherit;
  font-size: 1.08rem;
  font-weight: 500;
  cursor: pointer;
}

.pagination-button:hover,
.pagination-button.active {
  color: var(--ink);
}

.pagination-button.active {
  font-weight: 700;
}

.table-footer-spacer {
  min-height: 1px;
}

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

th,
td {
  padding: 16px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: center;
}

thead th:nth-child(1),
tbody td:nth-child(1) {
  width: 56px;
}

thead th:nth-child(2),
tbody td:nth-child(2) {
  width: 35%;
}

thead th:nth-child(3),
tbody td:nth-child(3) {
  width: 92px;
}

thead th:nth-child(4),
tbody td:nth-child(4) {
  width: 92px;
}

thead th:nth-child(5),
tbody td:nth-child(5) {
  width: 15%;
}

thead th:nth-child(6),
tbody td:nth-child(6) {
  width: 128px;
}

thead th:nth-child(7),
tbody td:nth-child(7) {
  width: 90px;
}

thead th:nth-child(8),
tbody td:nth-child(8) {
  width: 92px;
}

thead th {
  padding-top: 10px;
  padding-bottom: 10px;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.sort-button.active {
  color: var(--ink);
}

.sort-button::after {
  content: "";
}

.sort-button.active[data-direction="asc"]::after {
  content: "↑";
}

.sort-button.active[data-direction="desc"]::after {
  content: "↓";
}

tbody tr:hover {
  background: rgba(17, 17, 17, 0.02);
}

.status-badge,
.track-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-official {
  background: rgba(27, 116, 71, 0.1);
  color: var(--green);
}

.status-open {
  background: rgba(159, 101, 26, 0.1);
  color: var(--amber);
}

.status-merged {
  background: rgba(34, 89, 187, 0.1);
  color: var(--blue);
}

.status-closed {
  background: rgba(108, 108, 105, 0.11);
  color: var(--muted);
}

.track-badge {
  background: var(--surface-soft);
}

.run-name {
  display: block;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.title-cell {
  max-width: 0;
  overflow: hidden;
  text-align: left;
}

.title-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  white-space: normal;
}

.title-meta {
  margin: 7px 0 0;
  color: rgba(17, 17, 17, 0.5);
  font-size: 0.77rem;
  line-height: 1.35;
  white-space: normal;
}

.title-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.06);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.metric-cell,
.score-value,
.metric-value {
  white-space: nowrap;
}

.rank-value {
  color: var(--muted);
  font-weight: 500;
}

.author-cell,
.date-cell,
.status-cell,
.track-cell {
  max-width: 0;
}

.author-cell {
  overflow: hidden;
}

.author-link {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(17, 17, 17, 0.22);
}

.loss-value {
  font-weight: 500;
}

.author-link:hover {
  border-bottom-color: var(--ink);
}

.date-cell {
  white-space: nowrap;
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .run-name,
  .author-link,
  .date-cell {
    font-size: 0.88rem;
  }

  .title-summary {
    font-size: 0.8rem;
  }
}

.status-cell,
.track-cell {
  white-space: nowrap;
}

.title-link {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(17, 17, 17, 0.22);
}

.title-link:hover {
  color: var(--muted);
  border-bottom-color: rgba(108, 108, 105, 0.5);
}

.loading-row,
.empty-row {
  color: var(--muted);
  text-align: center;
}

.site-footer {
  padding-top: 40px;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ink);
}

.footer-name {
  border-bottom: 1px solid rgba(17, 17, 17, 0.18);
}

.site-footer a:hover .footer-name {
  border-bottom-color: rgba(17, 17, 17, 0.4);
}

@media (max-width: 720px) {
  .active-filter-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .filter-tools {
    display: block;
    width: 100%;
  }

  .tag-filter,
  .tag-filter-trigger {
    width: 100%;
  }

  .tag-filter-trigger {
    justify-content: space-between;
  }

  .tag-filter-panel {
    left: 0;
    right: 0;
    width: auto;
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 900px) {
  .summary-line {
    white-space: normal;
  }

  .topbar {
    flex-direction: column;
    align-items: start;
  }

  .controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-shell,
  .toggle-group,
  .inline-toggle {
    max-width: none;
    width: 100%;
  }

  .toggle-group {
    display: grid;
    gap: 10px;
    justify-content: stretch;
  }

  .table-footer {
    grid-template-columns: 1fr;
    gap: 12px;
    justify-items: center;
  }

  .footer-page-size,
  .pagination {
    justify-self: center;
  }
}
