:root {
  color-scheme: light;
  --bg: #f7f4ed;
  --panel: #ffffff;
  --ink: #22252a;
  --muted: #68707a;
  --line: #ddd8ce;
  --green: #1f8a4c;
  --green-bg: #e4f5ea;
  --yellow: #a56b00;
  --yellow-bg: #fff1c7;
  --red: #b42318;
  --red-bg: #ffe2df;
  --blue: #1f5f99;
  --blue-bg: #e6f1fa;
  --lav: #6e4fa3;
  --shadow: 0 18px 40px rgba(42, 35, 24, 0.12);
}

* {
  box-sizing: border-box;
}

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

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(16px, 4vw, 44px) 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  font-size: 1.1rem;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--lav);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary {
  min-width: 160px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  text-align: right;
  font-weight: 700;
}

main {
  display: grid;
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 44px) 36px;
}

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

.filters {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.filter-row,
.check-groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.filter-row.compact {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

label,
fieldset {
  min-width: 0;
}

label span,
legend {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

input[type="search"],
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

output {
  display: inline-block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px 12px;
}

.check-groups {
  grid-template-columns: 2fr 1fr;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfaf7;
  color: #35393f;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

th button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0;
  text-align: left;
  text-transform: inherit;
}

tbody tr.listing-row {
  cursor: pointer;
}

tbody tr.listing-row:hover {
  background: #fcf7e9;
}

tbody tr.is-expanded {
  background: #fff8e8;
}

.address {
  max-width: 230px;
  font-weight: 850;
}

.muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-weight: 850;
  white-space: nowrap;
}

.good {
  background: var(--green-bg);
  color: var(--green);
}

.ok {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.bad {
  background: var(--red-bg);
  color: var(--red);
}

.neutral {
  background: #eef0f2;
  color: #4d5661;
}

.info {
  background: var(--blue-bg);
  color: var(--blue);
}

.big {
  background: #eee8fa;
  color: var(--lav);
}

.score-cell {
  min-width: 130px;
}

.score-number {
  font-weight: 900;
}

.score-plot {
  position: relative;
  width: 96px;
  height: 18px;
  margin-top: 5px;
}

.score-plot::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 2px;
  background: #d6d9dd;
}

.score-dot {
  position: absolute;
  top: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa2ad;
  transform: translateX(-50%);
}

.score-dot.current {
  top: 3px;
  width: 12px;
  height: 12px;
  background: var(--lav);
  box-shadow: 0 0 0 3px rgba(110, 79, 163, 0.16);
}

.open-house-list {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 4px;
  min-width: 128px;
}

.open-house-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #b8d7c3;
  border-radius: 999px;
  background: #edf8f0;
  color: #17663d;
  font-size: 0.78rem;
  font-weight: 850;
  padding: 3px 8px;
  white-space: nowrap;
}

.star-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #a9adb4;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.star-button.is-favorite {
  border-color: #d2971c;
  background: #fff5cf;
  color: #bf7a00;
}

.candice-score {
  display: grid;
  grid-template-columns: minmax(82px, 1fr) 56px;
  align-items: center;
  gap: 7px;
  min-width: 150px;
}

.candice-range {
  accent-color: var(--lav);
}

.candice-number {
  width: 56px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  padding: 4px 6px;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid #164d7a;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  padding: 6px 10px;
  text-decoration: none;
}

.button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--blue);
}

.details-row td {
  padding: 0;
  background: #fff8e8;
}

.details {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 2fr);
  gap: 18px;
  padding: 14px 16px 18px;
}

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

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

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.detail-item strong {
  display: block;
  margin-top: 2px;
}

.notes h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

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

.notes li {
  margin: 5px 0;
  line-height: 1.35;
}

@media (max-width: 880px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .summary {
    text-align: left;
  }

  .filter-row,
  .filter-row.compact,
  .check-groups,
  .details {
    grid-template-columns: 1fr;
  }

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