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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

header {
  background: #1a2340;
  color: #fff;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

#meta {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  opacity: 0.7;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

#filters {
  background: #fff;
  border-bottom: 1px solid #e2e6ea;
  padding: 0.75rem 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

#filters label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #555;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#filters select {
  padding: 0.35rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.875rem;
  background: #fff;
  cursor: pointer;
}

#filters select:focus {
  outline: 2px solid #4a90e2;
  outline-offset: 1px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

#units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.unit-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.04);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  transition: box-shadow 0.15s;
}

.unit-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.unit-card .badge-new {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #ff6b35;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.unit-card .plan-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a2340;
  padding-right: 3rem;
}

.unit-card .unit-id {
  font-size: 0.75rem;
  color: #888;
}

.unit-card .specs {
  font-size: 0.85rem;
  color: #555;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.unit-card .price {
  font-size: 1.4rem;
  font-weight: 700;
  color: #2ecc71;
  margin-top: 0.25rem;
}

.unit-card .price-sub {
  font-size: 0.8rem;
  color: #888;
  margin-top: -0.25rem;
}

.unit-card .lease-info {
  font-size: 0.8rem;
  color: #777;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
}

#empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: #888;
  font-size: 1rem;
}

#history-section {
  margin-top: 2.5rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding: 1.5rem;
}

#history-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #1a2340;
  margin-bottom: 1rem;
}

#history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#history-list li {
  font-size: 0.8rem;
  color: #555;
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

#history-list li .ts {
  color: #aaa;
  white-space: nowrap;
  flex-shrink: 0;
}

#history-list li .added { color: #27ae60; font-weight: 600; }
#history-list li .removed { color: #e74c3c; font-weight: 600; }

#loading {
  text-align: center;
  padding: 4rem;
  color: #888;
}

#error {
  text-align: center;
  padding: 4rem;
  color: #e74c3c;
  display: none;
}
