:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0d12;
  color: #f3f4f6;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 360px;
  background:
    radial-gradient(ellipse at 10% -15%, rgb(73 87 132 / 16%), transparent 36rem),
    #0b0d12;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  color: #f3f4f6;
}

.page {
  width: min(100% - 48px, 1720px);
  margin: 0 auto;
  padding: 38px 0 28px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.eyebrow,
.summary-label {
  color: #8992a4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.eyebrow {
  margin: 0 0 8px;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.045em;
}

.subtitle {
  margin: 8px 0 0;
  color: #a4abba;
  font-size: 14px;
}

.topbar-note {
  padding: 9px 12px;
  border: 1px solid #293041;
  border-radius: 999px;
  color: #c9d1df;
  font-size: 12px;
  white-space: nowrap;
}

.topbar-note span {
  color: #a5b4fc;
  font-size: 15px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card,
.growth-section,
.filters,
.table-section {
  border: 1px solid #252b38;
  border-radius: 12px;
  background: #11141b;
}

.summary-card {
  min-height: 82px;
  padding: 15px 17px;
}

.summary-label {
  display: block;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-card strong {
  font-size: 21px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.growth-section {
  margin-bottom: 18px;
  padding: 16px;
}

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

.growth-header h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.growth-header p {
  margin: 5px 0 0;
  color: #8d96a7;
  font-size: 11px;
}

.snapshot-selectors {
  display: flex;
  min-width: min(100%, 400px);
  gap: 10px;
}

.snapshot-selectors .filter {
  flex: 1;
}

.growth-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
}

.growth-card {
  display: flex;
  min-width: 0;
  min-height: 91px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid #252b38;
  border-radius: 9px;
  background: #0c0f15;
  padding: 11px 12px;
}

.growth-card .summary-label {
  overflow: hidden;
  margin-bottom: 4px;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.growth-card strong {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.growth-delta {
  min-height: 14px;
  margin-top: 4px;
  color: #8992a4;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.growth-delta.positive {
  color: #91d4ae;
}

.growth-delta.negative {
  color: #f0a0a8;
}

.snapshot-status {
  margin: 11px 1px 0;
  color: #8992a4;
  font-size: 10px;
}

.leaders-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.leaders-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #252b38;
  border-radius: 12px;
  background: #11141b;
}

.leaders-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px 11px;
}

.leaders-heading h2 {
  margin: 0;
  font-size: 14px;
}

.leaders-heading p {
  margin: 5px 0 0;
  color: #8d96a7;
  font-size: 10px;
}

.period-label {
  color: #9da6b6;
  font-size: 9px;
  white-space: nowrap;
}

.leaders-scroll {
  max-height: 430px;
  overflow: auto;
  border-top: 1px solid #252b38;
}

.leaders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.leaders-table th,
.leaders-table td {
  padding: 7px 10px;
}

.leaders-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #171b24;
}

.leader-rank {
  width: 36px;
  color: #8d96a7;
}

.leader-app {
  max-width: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-link {
  color: #dce2ef;
  text-decoration: none;
}

.leader-link:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

.leader-change {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.leader-change.positive {
  color: #91d4ae;
}

.leader-change.negative {
  color: #f0a0a8;
}

.app-growth {
  display: flex;
  max-width: 210px;
  flex-wrap: wrap;
  gap: 3px;
}

.growth-chip,
.new-app-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border: 1px solid #343b4b;
  border-radius: 5px;
  background: #1a1f2a;
  padding: 2px 5px;
  color: #aeb7c7;
  font-size: 9px;
  white-space: nowrap;
}

.growth-chip.up {
  border-color: #265c46;
  background: #13291f;
  color: #91d4ae;
}

.growth-chip.down {
  border-color: #653b42;
  background: #2b191d;
  color: #f0a0a8;
}

.growth-chip.flat,
.growth-chip.unavailable {
  color: #9da6b6;
}

.new-app-badge {
  border-color: #51467c;
  background: #211b36;
  color: #c9b9ff;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) minmax(160px, 1fr) repeat(3, minmax(135px, 0.8fr)) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
}

.filter {
  display: grid;
  gap: 7px;
  color: #a7afbf;
  font-size: 11px;
  font-weight: 650;
}

.filter input,
.filter select,
.pagination select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #303747;
  border-radius: 7px;
  outline: none;
  background: #0c0f15;
  padding: 0 10px;
  font-size: 12px;
}

.filter input:focus,
.filter select:focus,
.pagination select:focus {
  border-color: #7c8ce8;
  box-shadow: 0 0 0 2px rgb(124 140 232 / 18%);
}

.filter input::placeholder {
  color: #646d7e;
}

.clear-button,
.pagination button {
  min-height: 38px;
  border: 1px solid #303747;
  border-radius: 7px;
  background: #191e29;
  padding: 0 12px;
  color: #d7dce5;
  font-size: 12px;
  cursor: pointer;
}

.clear-button:hover,
.pagination button:hover:not(:disabled) {
  border-color: #58627a;
  background: #202737;
}

.data-note,
.footnote {
  color: #8d96a7;
  font-size: 11px;
  line-height: 1.5;
}

.data-note {
  margin: 12px 2px;
}

code {
  color: #c6ccda;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95em;
}

.table-section {
  overflow: hidden;
}

.table-scroll {
  max-height: calc(100vh - 410px);
  min-height: 360px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

th,
td {
  border-bottom: 1px solid #222734;
  padding: 10px 12px;
  vertical-align: middle;
}

th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #171b24;
  color: #9ea7b8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

th:last-child,
td:last-child {
  position: sticky;
  right: 0;
}

th:last-child {
  z-index: 3;
  background: #171b24;
}

tbody tr {
  background: #11141b;
}

tbody tr:hover {
  background: #171c27;
}

tbody tr td:last-child {
  z-index: 1;
  background: #11141b;
  box-shadow: -8px 0 12px rgb(0 0 0 / 16%);
}

tbody tr:hover td:last-child {
  background: #171c27;
}

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

.rank-col {
  width: 70px;
}

.rank {
  color: #9ba5b7;
  font-variant-numeric: tabular-nums;
}

.app-col {
  min-width: 255px;
}

.app-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 310px;
  white-space: normal;
}

.app-logo,
.logo-fallback {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid #343b4a;
  border-radius: 8px;
  background: #202532;
  object-fit: cover;
}

.logo-fallback {
  display: grid;
  place-items: center;
  color: #bec7dc;
  font-size: 12px;
  font-weight: 700;
}

.app-name {
  color: #f2f4f8;
  font-weight: 650;
  line-height: 1.35;
}

.app-link {
  text-decoration: none;
}

.app-link:hover {
  color: #a5b4fc;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.numeric {
  color: #e0e4eb;
}

.primary-install {
  color: #fff !important;
  font-weight: 700;
}

.age,
.muted {
  color: #919aab;
}

.age {
  display: block;
  margin-top: 3px;
  font-size: 10px;
}

.tagline-col {
  min-width: 240px;
  max-width: 350px;
  white-space: normal;
}

.tagline {
  display: -webkit-box;
  overflow: hidden;
  color: #b6bdca;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.company-cell {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.details-cell {
  min-width: 112px;
}

.detail-source {
  display: block;
  margin-bottom: 5px;
  font-size: 9px;
}

.detail-live {
  color: #91d4ae;
}

.detail-cached {
  color: #f0c979;
}

.detail-unloaded {
  color: #8992a4;
}

.refresh-details {
  min-height: 27px;
  border: 1px solid #343b4b;
  border-radius: 6px;
  background: #191e29;
  padding: 3px 8px;
  color: #d7dce5;
  font-size: 10px;
  cursor: pointer;
}

.refresh-details:hover:not(:disabled) {
  border-color: #58627a;
  background: #202737;
}

.refresh-details:disabled {
  cursor: wait;
  opacity: 0.6;
}

.rating {
  color: #f3c969;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #343b4b;
  border-radius: 999px;
  background: #1a1f2a;
  padding: 2px 8px;
  color: #d4d9e3;
  font-size: 10px;
}

.badge.price-free {
  border-color: #265c46;
  background: #13291f;
  color: #91d4ae;
}

.badge.price-paid,
.badge.price-paid-freemium {
  border-color: #51467c;
  background: #211b36;
  color: #c9b9ff;
}

.badge.price-freemium {
  border-color: #315370;
  background: #162738;
  color: #9ed5ff;
}

.badge.white-label-yes {
  border-color: #265c46;
  background: #13291f;
  color: #91d4ae;
}

.badge.white-label-no {
  border-color: #653b42;
  background: #2b191d;
  color: #f0a0a8;
}

.badge.white-label-unknown {
  color: #9da6b6;
}

.user-type-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge.user-type {
  border-color: #315370;
  background: #162738;
  color: #9ed5ff;
}

.badge.user-type-unknown {
  color: #9da6b6;
}

.subcategory-list {
  display: flex;
  max-width: 260px;
  flex-wrap: wrap;
  gap: 4px;
  white-space: normal;
}

.subcategory-list .badge {
  min-height: 19px;
  border-radius: 5px;
  padding: 2px 6px;
}

.loading-cell,
.empty-cell {
  height: 120px;
  color: #8992a4;
  text-align: center;
}

.table-footer {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid #252b38;
  padding: 9px 13px;
  color: #9da6b6;
  font-size: 11px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination select {
  width: 68px;
  min-height: 32px;
  padding: 0 7px;
  font-size: 11px;
}

.pagination button {
  min-height: 32px;
  font-size: 11px;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.footnote {
  margin: 12px 2px 0;
}

@media (max-width: 1100px) {
  .leaders-section {
    grid-template-columns: 1fr;
  }

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

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

  .search-filter {
    grid-column: span 2;
  }

  .clear-button {
    grid-column: 3;
  }
}

@media (max-width: 650px) {
  .page {
    width: min(100% - 24px, 1720px);
    padding-top: 24px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 18px;
  }

  .summary {
    gap: 7px;
  }

  .summary-card {
    min-height: 74px;
    padding: 11px;
  }

  .summary-card strong {
    font-size: 17px;
  }

  .summary-label {
    font-size: 9px;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .growth-header {
    flex-direction: column;
  }

  .snapshot-selectors {
    width: 100%;
    min-width: 0;
  }

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

  .search-filter {
    grid-column: span 2;
  }

  .clear-button {
    grid-column: span 2;
  }

  .table-scroll {
    max-height: 65vh;
  }

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

  .pagination {
    width: 100%;
    justify-content: flex-end;
  }
}
