:root {
  color-scheme: light;
  --bg: #eff4fb;
  --bg-strong: #eef6fc;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --card-border: rgba(35, 47, 66, 0.08);
  --text: #102a43;
  --muted: #52606d;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 28px 50px rgba(15, 23, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dark-mode {
  color-scheme: dark;
  --bg: #07131f;
  --bg-strong: #0f1724;
  --surface: #111827;
  --surface-soft: #111f33;
  --card-border: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --success: #34d399;
  --danger: #f87171;
  --shadow: 0 28px 50px rgba(0, 0, 0, 0.35);
}

.theme-toggle {
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: inherit;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: rgba(37, 99, 235, 0.1);
  outline: none;
}

.theme-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.dark-mode .theme-toggle {
  background: rgba(15, 23, 42, 0.82);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg), var(--bg-strong));
  color: var(--text);
}

.backdrop {
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
  filter: blur(70px);
  opacity: 0.28;
}

.backdrop-a {
  top: -80px;
  left: -80px;
  width: 260px;
  height: 260px;
  background: rgba(37, 99, 235, 0.18);
}

.backdrop-b {
  right: -100px;
  bottom: -100px;
  width: 320px;
  height: 320px;
  background: rgba(22, 163, 74, 0.14);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

.dark-mode .background,
.dark-mode .card {
  border-color: rgba(255, 255, 255, 0.08);
}

.dark-mode .change-item,
.dark-mode .meta-pill,
.dark-mode .meta-pill-soft,
.dark-mode .listing-table th,
.dark-mode .listing-table td,
.dark-mode .panel {
  background: var(--surface);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.3fr auto;
  gap: 24px;
  padding: 34px 34px 32px;
  margin-bottom: 24px;
}

.hero-copy {
  display: grid;
  gap: 16px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.lede {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

.hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 10px;
  padding-top: 18px;
}

.meta-pill,
.meta-pill-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  min-height: 48px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid rgba(37, 99, 235, 0.15);
  color: var(--text);
  font-size: 0.95rem;
  min-width: 190px;
  text-align: center;
}

.meta-pill-soft {
  color: var(--muted);
  background: rgba(86, 124, 174, 0.06);
  border-color: rgba(86, 124, 174, 0.12);
}

.stat-card {
  padding: 16px;
  border-radius: 20px;
  background: var(--surface-soft);
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 10px;
}

.stat-card .stat-label {
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: clamp(1.4rem, 2vw, 1.9rem);
}

.stats-panel {
  display: flex;
  flex-direction: column;
}

.top-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 0.9fr;
  gap: 18px;
  margin-bottom: 24px;
}

.activity-panel {
  display: flex;
  flex-direction: column;
}

.change-feed {
  display: grid;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.change-feed::-webkit-scrollbar {
  width: 10px;
}

.change-feed::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.25);
  border-radius: 999px;
}

.change-item {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--surface-soft);
}

.stat-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.stat-value {
  margin: 0;
  font-size: clamp(1.75rem, 2.7vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-caption {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  padding: 22px;
  margin-bottom: 24px;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 0.8fr;
  gap: 24px;
  margin-bottom: 24px;
}

.top-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 0.9fr;
  gap: 24px;
  margin-bottom: 24px;
}

.stats-panel {
  display: flex;
  flex-direction: column;
}

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

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.panel-header p,
.inline-note {
  margin: 0;
  color: var(--muted);
}

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

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

.listing-table th,
.listing-table td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding: 16px 14px;
  text-align: left;
  vertical-align: top;
}

.listing-table th {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  font-weight: 600;
}

.listing-table th:nth-child(1) {
  width: 45%;
}

.listing-table th:nth-child(2) {
  width: 12%;
}

.listing-table th:nth-child(3) {
  width: 15%;
}

.listing-table th:nth-child(4),
.listing-table th:nth-child(5) {
  width: 12%;
}

.listing-table th:nth-child(6) {
  width: 4%;
}

.listing-table th button {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.listing-table tbody tr {
  transition: background 180ms ease;
}

.listing-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.05);
}

.dark-mode .listing-table tbody tr:hover {
  background: rgba(96, 165, 250, 0.12);
}

.listing-table td {
  font-size: 0.95rem;
  color: var(--text);
}

.listing-table td.location-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.listing-title {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.listing-title:hover {
  color: var(--accent);
}

.listing-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.pagination-btn {
  padding: 8px 16px;
  border: 1px solid var(--card-border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 150ms;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--surface-soft);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.9rem;
  color: var(--muted);
}

.dark-mode .pagination-controls {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

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

.change-title {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}

.change-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

.change-badge.is-new {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.change-badge.is-removed {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.change-diffs {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.change-diff strong {
  color: var(--text);
}

.histogram {
  display: grid;
  gap: 12px;
}

.histogram-summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.histogram-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.histogram-row:last-child {
  border-bottom: none;
}

.histogram-label {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.histogram-count {
  min-width: 44px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
  font-weight: 700;
  text-align: center;
  font-size: 0.82rem;
}

.histogram-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  overflow: hidden;
}

.histogram-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.95), rgba(96, 165, 250, 0.85));
  box-shadow: inset 0 1px 5px rgba(15, 23, 42, 0.08);
  transition: width 220ms ease;
}

.empty-state,
.error-state {
  padding: 24px;
  border-radius: 20px;
  border: 1px dashed rgba(15, 23, 42, 0.16);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
}

.error-state {
  color: var(--danger);
}

@media (max-width: 1060px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .top-panel-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1240px);
    padding-top: 10px;
  }

  .hero,
  .panel,
  .stat-card {
    border-radius: 20px;
  }

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

  .hero-meta {
    justify-content: start;
  }

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

  .listing-table {
    min-width: 0;
  }

  .histogram-row {
    grid-template-columns: 1fr;
  }
}