:root {
  --bg: #f4f6f4;
  --panel: #ffffff;
  --ink: #17201a;
  --muted: #69756e;
  --line: #dfe5df;
  --green: #237a57;
  --green-dark: #12553c;
  --gold: #b7812d;
  --red: #ba3a36;
  --blue: #315b96;
  --shadow: 0 18px 45px rgba(29, 42, 33, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background: #18231d;
  color: white;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e7f0df;
  color: #17351f;
  font-weight: 800;
}

.brand span,
.agent-card span,
.results-meta span,
.empty-state span {
  display: block;
  color: #aeb9b1;
  font-size: 13px;
  margin-top: 3px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  color: #dbe4dc;
  text-align: left;
  padding: 11px 12px;
  border-radius: 8px;
  background: transparent;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.11);
  color: white;
}

.agent-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: #70d88c;
}

.app {
  margin-left: 248px;
  padding: 28px;
}

.topbar,
.panel-head,
.sort-row,
.results-meta,
.property-top,
.detail-agent,
.duplicate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 30px;
}

.eyebrow {
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  margin: 0 0 5px;
}

.primary-btn,
.ghost-btn,
.sort-btn,
.contact-btn {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: white;
  color: var(--ink);
}

.primary-btn {
  border-color: var(--green);
  background: var(--green);
  color: white;
  font-weight: 700;
}

.primary-btn:hover,
.contact-btn:hover {
  background: var(--green-dark);
}

.ghost-btn:hover,
.sort-btn.active {
  border-color: var(--green);
  color: var(--green);
  background: #eef7f1;
}

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

.stats article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stats article {
  padding: 16px;
}

.stats span {
  color: var(--muted);
  font-size: 13px;
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(340px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.upload-panel {
  grid-column: 1 / -1;
  display: none;
}

.upload-panel.open {
  display: block;
}

.filters,
.upload-grid,
.parsed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fbfcfb;
}

textarea {
  resize: vertical;
}

.analysis-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 14px 0;
  background: #f9fbf9;
}

.analysis-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.analysis-head h3 {
  margin: 0;
}

.parsed-grid {
  margin-bottom: 8px;
}

.parsed-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.parsed-item span {
  color: var(--muted);
  font-size: 12px;
}

.parsed-item strong {
  display: block;
  margin-top: 4px;
}

.photo-preview {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.photo-chip {
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: white;
  color: var(--muted);
  font-size: 12px;
}

.sort-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf9;
}

.sort-row span {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.results-meta {
  margin: 18px 0 10px;
}

.results-meta span {
  color: var(--muted);
}

.property-list {
  display: grid;
  gap: 12px;
}

.property-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 12px;
  text-align: left;
  width: 100%;
}

.property-card.active,
.property-card:hover {
  border-color: var(--green);
  box-shadow: 0 10px 30px rgba(35, 122, 87, 0.13);
}

.property-card img,
.detail-hero {
  width: 100%;
  object-fit: cover;
  border-radius: 8px;
  background: #dce4de;
}

.property-card img {
  height: 96px;
}

.property-info h3 {
  margin: 0 0 7px;
  font-size: 17px;
}

.price {
  font-size: 20px;
  font-weight: 800;
  color: var(--green-dark);
}

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

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef2ef;
  color: #3f4d45;
  font-size: 12px;
  font-weight: 700;
}

.badge.rent {
  background: #eaf1fb;
  color: var(--blue);
}

.badge.sale {
  background: #fff3df;
  color: var(--gold);
}

.badge.duplicate {
  background: #fdeceb;
  color: var(--red);
}

.detail-hero {
  height: 220px;
  margin-bottom: 16px;
}

.detail-panel h2 {
  margin: 0 0 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
}

.detail-grid span {
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong {
  display: block;
  margin-top: 4px;
}

.detail-agent {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 16px 0;
}

.contact-btn {
  background: var(--green);
  color: white;
  border-color: var(--green);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  font-weight: 700;
}

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

.duplicate-item {
  border: 1px solid #f0cecc;
  background: #fff8f7;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
}

.empty-state {
  min-height: 420px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
}

.empty-state span {
  color: var(--muted);
  max-width: 280px;
}

.full {
  width: 100%;
  margin-top: 12px;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .agent-card {
    margin-left: auto;
    margin-top: 0;
  }

  .app {
    margin-left: 0;
    padding: 18px;
  }

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

@media (max-width: 620px) {
  .topbar,
  .panel-head,
  .results-meta,
  .detail-agent {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .stats,
  .filters,
  .upload-grid,
  .parsed-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .property-card {
    grid-template-columns: 92px 1fr;
  }

  .property-card img {
    height: 90px;
  }

  .sidebar {
    padding: 16px;
  }
}
