:root {
  --ink: #17211c;
  --muted: #617168;
  --line: #dce4dd;
  --bg: #f7f8f4;
  --panel: #ffffff;
  --green: #286447;
  --blue: #275f8f;
  --amber: #a86921;
  --soft-green: #e8f2eb;
  --soft-blue: #e7f0f8;
  --soft-amber: #f7eee1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

a { color: inherit; }

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  padding: 36px clamp(20px, 5vw, 64px) 28px;
  background: #10211a;
  color: #eef5ef;
}

.label {
  margin: 0 0 10px;
  color: #b9cdbd;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  max-width: 780px;
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: .96;
  letter-spacing: 0;
}

.subtitle {
  max-width: 760px;
  margin-bottom: 0;
  color: #d7e6da;
  font-size: 17px;
  line-height: 1.45;
}

.header-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.button {
  border: 1px solid #d7e6da;
  border-radius: 8px;
  padding: 10px 14px;
  background: #eef5ef;
  color: #10211a;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  background: transparent;
  color: #eef5ef;
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 24px auto 56px;
}

.decision-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.decision-strip article,
.controls,
.listing-card,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.decision-strip article {
  padding: 18px;
}

.decision-strip span,
.card-scenario {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.decision-strip strong {
  display: block;
  margin: 7px 0;
  font-size: 18px;
}

.decision-strip p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.controls {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px;
  margin-bottom: 28px;
}

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

.segmented button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.segmented button.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.toggle {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin: 0 0 12px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.section-heading p {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.4;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 34px;
}

.listing-card {
  overflow: hidden;
  min-width: 0;
}

.listing-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--line);
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 13px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.tag {
  max-width: 130px;
  overflow: hidden;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--soft-green);
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag.two { background: var(--soft-blue); color: var(--blue); }
.tag.solo { background: var(--soft-amber); color: var(--amber); }

.listing-card h3 {
  display: -webkit-box;
  min-height: 44px;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.facts {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 850;
}

.facts span:last-child {
  color: var(--muted);
  font-weight: 700;
}

.area {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes,
.risk {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.4;
  -webkit-box-orient: vertical;
}

.notes {
  min-height: 58px;
  color: var(--ink);
  -webkit-line-clamp: 3;
}

.risk {
  min-height: 42px;
  border-radius: 8px;
  padding: 9px;
  background: var(--soft-amber);
  color: #45351f;
  font-size: 13px;
  -webkit-line-clamp: 2;
}

.source {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

td {
  line-height: 1.35;
}

@media (max-width: 760px) {
  .app-header,
  .section-heading,
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .decision-strip {
    grid-template-columns: 1fr;
  }
}

@media print {
  .controls,
  .header-actions {
    display: none;
  }

  body {
    background: #fff;
  }

  main {
    width: 100%;
    margin: 0;
    padding: 20px;
  }

  .listing-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .listing-card,
  .decision-strip article,
  .table-wrap {
    break-inside: avoid;
  }
}
