:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-2: #0d1728;
  --panel: rgba(13, 23, 40, 0.84);
  --panel-strong: rgba(17, 29, 50, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.03);
  --text: #e9f1ff;
  --muted: #9fb0ca;
  --border: rgba(180, 199, 230, 0.16);
  --accent: #7bdcff;
  --accent-strong: #4fb5ff;
  --warm: #ffbf69;
  --success: #7be0a4;
  --danger: #ff8fa3;
  --shadow: 0 28px 80px rgba(2, 8, 20, 0.45);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      rgba(123, 220, 255, 0.12),
      transparent 30%
    ),
    radial-gradient(
      circle at 85% 15%,
      rgba(255, 191, 105, 0.12),
      transparent 26%
    ),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.backdrop {
  position: fixed;
  inset: auto;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(16px);
  opacity: 0.8;
  z-index: 0;
}

.backdrop-a {
  top: -160px;
  left: -120px;
  width: 340px;
  height: 340px;
  background: rgba(123, 220, 255, 0.13);
}

.backdrop-b {
  right: -140px;
  top: 180px;
  width: 280px;
  height: 280px;
  background: rgba(255, 191, 105, 0.1);
}

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

.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px;
  border-radius: var(--radius-xl);
}

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

.section-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
}

.lede {
  margin: 14px 0 0;
  max-width: 65ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.status-stack {
  display: grid;
  justify-items: end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border: 1px solid rgba(180, 199, 230, 0.12);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill.error {
  background: rgba(255, 143, 163, 0.1);
  border-color: rgba(255, 143, 163, 0.22);
}

.toolbar {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 0.8fr 1fr auto;
  gap: 14px;
  padding: 18px;
  margin-top: 18px;
  border-radius: var(--radius-lg);
}

.toolbar label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.toolbar label span {
  padding-left: 2px;
}

.toolbar select,
.toolbar input,
.toolbar button {
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  padding: 0 14px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.toolbar select:hover,
.toolbar input:hover,
.toolbar button:hover {
  border-color: rgba(123, 220, 255, 0.28);
}

#min-price-filter,
#max-price-filter {
  -moz-appearance: textfield;
  appearance: textfield;
}

#min-price-filter::-webkit-outer-spin-button,
#min-price-filter::-webkit-inner-spin-button,
#max-price-filter::-webkit-outer-spin-button,
#max-price-filter::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.toolbar select:focus,
.toolbar input:focus,
.toolbar button:focus,
.sort-button:focus {
  outline: 2px solid rgba(123, 220, 255, 0.45);
  outline-offset: 2px;
}

.toolbar-actions {
  display: flex;
  align-items: end;
}

.toolbar-actions button {
  width: 100%;
  background: linear-gradient(
    135deg,
    rgba(123, 220, 255, 0.16),
    rgba(79, 181, 255, 0.14)
  );
}

.toolbar-actions button:hover {
  background: linear-gradient(
    135deg,
    rgba(123, 220, 255, 0.24),
    rgba(79, 181, 255, 0.2)
  );
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(2, 8, 20, 0.28);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.summary-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  border-color: rgba(123, 220, 255, 0.26);
  box-shadow: 0 16px 36px rgba(2, 8, 20, 0.3);
}

.summary-card .label {
  color: var(--muted);
  font-size: 0.86rem;
}

.summary-card .value {
  margin-top: 10px;
  font-size: clamp(1.55rem, 2.8vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.summary-card .delta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.summary-card.accent {
  background: linear-gradient(
    180deg,
    rgba(123, 220, 255, 0.12),
    rgba(13, 23, 40, 0.92)
  );
}

.summary-card.warm {
  background: linear-gradient(
    180deg,
    rgba(255, 191, 105, 0.12),
    rgba(13, 23, 40, 0.92)
  );
}

.summary-card.success {
  background: linear-gradient(
    180deg,
    rgba(123, 224, 164, 0.12),
    rgba(13, 23, 40, 0.92)
  );
}

.summary-card.danger {
  background: linear-gradient(
    180deg,
    rgba(255, 143, 163, 0.12),
    rgba(13, 23, 40, 0.92)
  );
}

.histogram-panel,
.content-grid {
  margin-top: 18px;
}

.histogram-panel {
  padding: 18px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.section-note {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.histogram-row {
  display: grid;
  gap: 8px;
}

.histogram-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.histogram-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.histogram-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--warm));
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr);
  gap: 16px;
}

.listings-panel,
.feed-panel {
  padding: 18px;
  border-radius: var(--radius-lg);
}

#listings-panel,
#changes-panel {
  scroll-margin-top: 14px;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--border);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

#listings-pagination-top,
#changes-pagination-top {
  margin-bottom: 12px;
}

.pagination button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease;
}

.pagination button:hover:not(:disabled) {
  border-color: rgba(123, 220, 255, 0.28);
  background: rgba(123, 220, 255, 0.12);
  transform: translateY(-1px);
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: default;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: rgba(7, 17, 31, 0.24);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(17, 29, 50, 0.96);
  color: var(--muted);
  text-align: left;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid rgba(180, 199, 230, 0.1);
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(123, 220, 255, 0.04);
}

tbody tr {
  transition: background-color 140ms ease;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-weight: 700;
  transition: color 140ms ease;
}

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

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

.sort-button::after {
  content: attr(data-direction);
  color: var(--accent);
  font-size: 0.78rem;
}

.listing-title {
  display: grid;
  gap: 4px;
}

.listing-title .title {
  font-weight: 700;
}

.listing-title .id,
.listing-subtle {
  color: var(--muted);
  font-size: 0.82rem;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(123, 220, 255, 0.2);
  background: rgba(123, 220, 255, 0.08);
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.link-button:hover {
  background: rgba(123, 220, 255, 0.18);
  border-color: rgba(123, 220, 255, 0.34);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(2, 8, 20, 0.24);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--text);
  background: rgba(123, 220, 255, 0.14);
  border: 1px solid rgba(123, 220, 255, 0.16);
}

.badge.new {
  background: rgba(123, 224, 164, 0.14);
  border-color: rgba(123, 224, 164, 0.22);
}

.badge.price_changed {
  background: rgba(255, 191, 105, 0.14);
  border-color: rgba(255, 191, 105, 0.22);
}

.badge.attributes_changed {
  background: rgba(123, 220, 255, 0.14);
}

.badge.removed {
  background: rgba(255, 143, 163, 0.14);
  border-color: rgba(255, 143, 163, 0.22);
}

.feed {
  display: grid;
  gap: 10px;
}

.feed-item {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.feed-item:hover {
  border-color: rgba(123, 220, 255, 0.24);
  background: rgba(255, 255, 255, 0.045);
  transform: translateY(-1px);
}

.feed-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.feed-item h3 {
  margin: 8px 0 0;
  font-size: 0.96rem;
}

.feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.feed-summary {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.diff-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.diff-row {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(180, 199, 230, 0.1);
}

.diff-row-field {
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.diff-row-values {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.diff-value {
  min-width: 0;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.diff-value.before {
  background: rgba(255, 143, 163, 0.12);
  border: 1px solid rgba(255, 143, 163, 0.18);
  color: #ffd9e0;
}

.diff-value.after {
  background: rgba(123, 224, 164, 0.12);
  border: 1px solid rgba(123, 224, 164, 0.18);
  color: #d8f5e5;
}

.diff-arrow {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
}

.diff-more {
  margin-top: 0;
  color: var(--muted);
  font-size: 0.78rem;
  padding-left: 2px;
}

.empty-state {
  margin-top: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(180, 199, 230, 0.2);
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 12px;
  }

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

  .status-stack {
    justify-items: start;
  }

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

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

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

  .feed-item header {
    flex-direction: column;
  }
}
