:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #1d1c1d;
  --muted: #696969;
  --line: #d9dee8;
  --accent: #1264a3;
  --accent-2: #2eb67d;
  --down: #d04437;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

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

a:hover {
  text-decoration: underline;
}

.notice {
  background: #e4f0f2;
  border-bottom: 1px solid #c9dde1;
  color: #163c43;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 36px auto 0;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand img {
  width: 79px;
  height: auto;
}

h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, auto));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.stats div {
  min-height: 68px;
  background: var(--panel);
  padding: 12px 14px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stats strong {
  display: block;
  max-width: 220px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.search input {
  width: min(320px, 60vw);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
}

.search-count {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.details-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.details-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 24px rgba(29, 28, 29, 0.06);
}

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

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafc;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #4c4945;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

th[data-sort] {
  cursor: pointer;
}

tbody tr:hover {
  background: #f9fafc;
}

tbody tr.is-hidden {
  display: none;
}

.rank {
  width: 72px;
  font-weight: 800;
}

.logo-cell {
  width: 70px;
}

.logo-cell img {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.name-cell {
  width: 240px;
  font-weight: 800;
}

.description-cell {
  min-width: 300px;
  color: #3d3b3b;
}

.description-copy {
  max-width: 620px;
}

.details-panel {
  display: none;
  max-width: 760px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef1f6;
}

.details-enabled .details-panel {
  display: grid;
  gap: 10px;
}

.details-badges,
.category-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge,
.category-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #d6dce6;
  border-radius: 999px;
  background: #f8fafc;
  color: #343434;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.badge:hover {
  background: #f1f5f9;
  text-decoration: none;
}

.badge-pricing {
  border-color: #b8dac7;
  background: #edf8f2;
  color: #11613c;
}

.badge-primary {
  border-color: #c5d8ef;
  background: #eef6ff;
  color: #155f99;
}

.change-cell {
  width: 96px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.up {
  color: var(--accent-2);
}

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

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

.empty {
  padding: 40px;
  text-align: center;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, calc(100vw - 32px));
  margin: 32px auto 0;
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 14px;
}

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

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

  .toolbar {
    align-items: stretch;
    flex-direction: column;
    justify-content: stretch;
  }

  .search {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .search input {
    width: 100%;
  }

  .search-count,
  .details-toggle {
    align-self: flex-start;
  }

  .footer {
    flex-direction: column;
  }
}
