:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-strong: #f0f4f8;
  --text: #111827;
  --muted: #667085;
  --line: #d7dde5;
  --accent: #0b65c2;
  --accent-weak: #e7f1fc;
  --ok: #087443;
  --warning: #8a5a00;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

main {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 18px 20px 32px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}

select:focus,
button:focus-visible {
  outline: 3px solid rgba(11, 101, 194, 0.18);
  outline-offset: 2px;
}

.status-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  margin-bottom: 14px;
}

.status-band > div {
  background: var(--surface);
  padding: 12px 14px;
}

.status-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.status-band strong {
  display: block;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.range-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.range-button {
  min-width: 86px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.range-button:hover {
  border-color: var(--accent);
}

.range-button.is-active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 800;
}

.table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-header h2 {
  font-size: 18px;
}

.source-url {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.loading {
  align-self: start;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--accent);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.message {
  border-bottom: 1px solid var(--line);
  color: var(--warning);
  background: #fff7e6;
  padding: 12px 18px;
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
}

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

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

th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr:hover {
  background: #f8fbff;
}

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

.rank-col {
  width: 76px;
}

.link-col {
  width: 82px;
}

.rank {
  font-weight: 900;
}

.app-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
}

.app-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  object-fit: cover;
}

.app-name {
  display: block;
  font-weight: 800;
  line-height: 1.3;
}

.app-summary {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-link {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.store-link:hover {
  text-decoration: underline;
}

.empty-row td {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding: 36px 16px;
}

@media (max-width: 760px) {
  .topbar {
    padding: 16px;
  }

  main {
    padding: 14px 12px 24px;
  }

  .filters,
  .status-band {
    grid-template-columns: 1fr;
  }

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

  .range-button {
    width: 100%;
  }

  .table-header {
    display: grid;
  }
}
