* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

header {
  padding: 2rem 1.5rem 1rem;
  background: #111827;
  color: #ffffff;
}

header h1 {
  margin: 0;
  font-size: clamp(1.75rem, 2.5vw, 2.75rem);
}

header p {
  margin: 0.75rem 0 0;
  max-width: 42rem;
  line-height: 1.7;
  opacity: 0.85;
}

main {
  padding: 1.5rem;
  max-width: 1280px;
  margin: 0 auto;
}

.summary {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  margin-bottom: 1.5rem;
}

.summary-card {
  padding: 1rem 1.25rem;
  border-radius: 0.85rem;
  background: #ffffff;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.summary-card h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #475569;
}

.summary-card p {
  margin: 0.9rem 0 0;
  font-size: 2rem;
  font-weight: 700;
}

.map-section,
.table-section,
.watchlist-grid,
.changes-section {
  margin-bottom: 1.75rem;
}

#listingsMap {
  width: 100%;
  min-height: 420px;
  border-radius: 1rem;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
}

.table-section h2,
.changes-section h2 {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

#avgPriceChart {
  width: 100%;
  display: block;
  border-radius: 1rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.watchlist-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(280px, 360px) 1fr;
  align-items: start;
}

.avg-price-section,
.watchlist-section {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
  padding: 1rem;
}

.avg-price-section h2,
.watchlist-section h2 {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.chart-description {
  margin: 0 0 1rem;
  color: #64748b;
  line-height: 1.6;
}

.table-wrapper {
  overflow: auto;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.sparkline-cell {
  width: 12rem;
  min-width: 12rem;
}

.sparkline-svg {
  width: 100%;
  height: 40px;
  overflow: visible;
}

.sparkline-svg polyline {
  fill: none;
  stroke-width: 2;
}

.sparkline-down polyline {
  stroke: #ef4444;
}

.sparkline-up polyline {
  stroke: #16a34a;
}

.sparkline-empty {
  display: inline-block;
  color: #64748b;
  font-size: 0.85rem;
}

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

.watchlist-section {
  margin-bottom: 1.75rem;
}

.watchlist-wrapper {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
  padding: 1rem;
}

.watchlist-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.watchlist-item:last-child {
  border-bottom: none;
}

.watchlist-title {
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem;
}

.watchlist-meta {
  color: #475569;
  font-size: 0.95rem;
  margin: 0;
}

.watchlist-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.watchlist-clear {
  border: none;
  background: #ef4444;
  color: white;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  cursor: pointer;
}

.filters-section {
  margin-bottom: 1.75rem;
}

.filters-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  align-items: end;
  background: #ffffff;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.filters-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: #475569;
}

.filters-grid input,
.filters-grid select {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  background: #f8fafc;
  color: #0f172a;
}

.filter-actions {
  display: flex;
  gap: 0.75rem;
  grid-column: span 2;
  flex-wrap: wrap;
}

.filter-actions button {
  border: none;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-actions button[type="submit"] {
  background: #2563eb;
  color: white;
}

.filter-actions button#resetFilters {
  background: #e2e8f0;
  color: #1f2937;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #475569;
}

.filter-toggle input {
  width: auto;
  margin: 0;
}

.favorite-button {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  color: #94a3b8;
  transition: color 0.2s ease;
}

.favorite-button.favorite-active {
  color: #f59e0b;
}

.favorite-button:hover {
  color: #2563eb;
}

thead {
  background: #0f172a;
  color: white;
}

th,
td {
  padding: 0.95rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

th {
  cursor: pointer;
  white-space: nowrap;
}

th:hover {
  color: #2563eb;
}

tbody tr:hover {
  background: #f8fafc;
}

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.85rem;
  font-weight: 600;
}

.change-card {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.05);
  margin-bottom: 1rem;
}

.change-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.change-card p {
  margin: 0.3rem 0;
  color: #475569;
}

code {
  background: #f8fafc;
  padding: 0.2rem 0.35rem;
  border-radius: 0.35rem;
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  th,
  td {
    padding: 0.8rem 0.75rem;
  }
}
