*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

header h1 { font-size: 1.5rem; }

.tabs { display: flex; gap: 0.5rem; }

.tab {
  padding: 0.4rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  color: #475569;
}

.tab.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: #64748b;
}

.filters select,
.filters input {
  padding: 0.4rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.9rem;
}

.filters button {
  padding: 0.45rem 1.1rem;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.filters button:hover { background: #2563eb; }

.hidden { display: none !important; }

/* Charts tab */
#tab-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 700px) {
  #tab-charts { grid-template-columns: 1fr; }
}

.chart-container {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
}

.chart-container h2 {
  font-size: 0.95rem;
  color: #475569;
  margin-bottom: 1rem;
}

/* Listings tab */
#tab-listings { display: flex; flex-direction: column; gap: 1.5rem; }

#listings-wrapper {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow-x: auto;
}

#listings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

#listings-table th {
  background: #f1f5f9;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

#listings-table td {
  padding: 0.55rem 0.75rem;
  border-top: 1px solid #e2e8f0;
  white-space: nowrap;
}

#listings-table tr:hover td { background: #f8fafc; }

#listings-table a { color: #3b82f6; text-decoration: none; }
#listings-table a:hover { text-decoration: underline; }

.btn-history {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
}

.btn-history:hover { background: #e2e8f0; }

#listings-empty { padding: 2rem; text-align: center; color: #94a3b8; }

/* Price history panel */
#history-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.history-header h2 { font-size: 0.95rem; color: #475569; }

#history-close {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: #94a3b8;
  padding: 0.25rem;
}

#history-close:hover { color: #475569; }
