:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #ece8df;
  --text: #1e2320;
  --muted: #697069;
  --line: #d8d2c5;
  --accent: #0f766e;
  --accent-dark: #0d4f4a;
  --clay: #9a5b3f;
  --ink: #263244;
  --warning: #b26b00;
  --danger: #a13636;
  --ok: #28724b;
  --shadow: 0 18px 50px rgb(42 37 29 / 10%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
}

.app-header {
  min-height: 72vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
  padding: clamp(28px, 5vw, 72px);
  background:
    linear-gradient(90deg, rgb(9 30 29 / 86%), rgb(9 30 29 / 58%)),
    url("https://images.unsplash.com/photo-1551288049-bebda4e38f71?auto=format&fit=crop&w=2200&q=80")
      center / cover;
  color: white;
}

.header-copy {
  max-width: 980px;
}

.eyebrow {
  margin: 0 0 10px;
  color: currentColor;
  opacity: 0.72;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.04;
  letter-spacing: 0;
}

h1 {
  max-width: 860px;
  font-size: clamp(48px, 9vw, 112px);
}

h2 {
  font-size: clamp(28px, 4vw, 52px);
}

h3 {
  font-size: 20px;
}

.lede {
  max-width: 760px;
  margin: 20px 0 0;
  color: rgb(255 255 255 / 82%);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.45;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-self: end;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 8px;
  background: rgb(255 255 255 / 12%);
  color: inherit;
  text-decoration: none;
  font: inherit;
  font-weight: 750;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.button-primary {
  background: white;
  color: #0d2d2a;
  border-color: white;
}

.button-light {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  backdrop-filter: none;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.stats-strip article {
  min-height: 122px;
  padding: 28px clamp(18px, 3vw, 40px);
  border-right: 1px solid var(--line);
}

.stats-strip article:last-child {
  border-right: 0;
}

.stats-strip span {
  display: block;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  font-weight: 850;
  color: var(--accent-dark);
}

.stats-strip p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 650;
}

.section-band {
  padding: clamp(42px, 6vw, 84px) clamp(18px, 5vw, 72px);
}

.section-band-muted {
  background: var(--surface-soft);
}

.section-heading {
  max-width: 920px;
  margin-bottom: 28px;
}

.row-heading {
  max-width: none;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.insight-card,
.entity-card,
.source-item,
.contact-item,
.finding-item,
.caveat-item,
.phase-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.insight-card {
  padding: 22px;
  min-height: 230px;
}

.insight-card p,
.finding-item p,
.caveat-item p,
.source-item p,
.phase-card li {
  color: var(--muted);
  line-height: 1.55;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tab.is-active {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: white;
}

.search-box {
  display: grid;
  gap: 7px;
  min-width: min(360px, 100%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pipeline-board {
  max-width: 1180px;
}

.pipeline-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pipeline-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(110px, 220px) 44px;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 76px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pipeline-row:last-child {
  border-bottom: 0;
}

.pipeline-row:hover,
.card-action:hover {
  background: #f8faf9;
}

.pipeline-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #e7f2ef;
  color: var(--accent-dark);
  font-weight: 850;
}

.score,
.entity-score span,
.dialog-score span {
  display: block;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #e3dfd6;
}

.score i,
.entity-score i,
.dialog-score i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--clay));
}

.score-number {
  color: var(--accent-dark);
  font-weight: 900;
  text-align: right;
}

.entity-grid,
.phase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.entity-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  min-height: 250px;
}

.entity-card header {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 100%;
  padding: 0 9px;
  border-radius: 999px;
  background: #e7f2ef;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.badge-warning {
  background: #fff0d7;
  color: var(--warning);
}

.badge-danger {
  background: #f8dddd;
  color: var(--danger);
}

.entity-meta {
  display: grid;
  gap: 9px;
  margin: 0;
}

.entity-meta div {
  display: grid;
  gap: 3px;
}

.entity-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.entity-meta dd {
  margin: 0;
  line-height: 1.45;
}

.entity-score,
.dialog-score {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.entity-score strong,
.dialog-score strong {
  color: var(--accent-dark);
}

.fit-reason {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.card-action {
  align-self: end;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-dark);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.finding-list,
.caveat-list,
.source-list,
.contact-list {
  display: grid;
  gap: 12px;
}

.finding-item,
.caveat-item,
.source-item,
.contact-item,
.phase-card {
  padding: 18px;
}

.source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.source-item a {
  color: var(--accent-dark);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.contact-item header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.contact-item header a,
.contact-meta a {
  display: inline-block;
  color: var(--accent-dark);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.contact-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.source-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.source-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.source-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
}

.source-summary strong {
  display: block;
  color: var(--accent-dark);
  font-size: 34px;
  line-height: 1;
}

.source-summary span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 700;
}

.phase-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
}

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

.timeline .phase-card {
  display: grid;
  align-content: start;
  gap: 10px;
}

.entity-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(860px, calc(100vh - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.entity-dialog::backdrop {
  background: rgb(14 20 18 / 62%);
}

.dialog-shell {
  position: relative;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgb(0 0 0 / 28%);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.dialog-list {
  display: grid;
  gap: 12px;
  margin: 22px 0 0;
}

.dialog-list div {
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(0, 1fr);
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.dialog-list dt {
  color: var(--muted);
  font-weight: 850;
}

.dialog-list dd {
  margin: 0;
  line-height: 1.5;
}

.site-footer {
  padding: 28px clamp(18px, 5vw, 72px);
  border-top: 1px solid var(--line);
  background: var(--ink);
  color: rgb(255 255 255 / 78%);
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgb(255 255 255 / 12%);
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 55%);
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-header,
  .row-heading {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .stats-strip,
  .insight-grid,
  .entity-grid,
  .phase-grid,
  .timeline,
  .source-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-header {
    min-height: 68vh;
    padding: 28px 18px;
  }

  .stats-strip,
  .insight-grid,
  .entity-grid,
  .phase-grid,
  .timeline,
  .source-summary,
  .contact-meta,
  .source-item {
    grid-template-columns: 1fr;
  }

  .pipeline-row {
    grid-template-columns: 34px minmax(0, 1fr) 44px;
  }

  .pipeline-row .score {
    grid-column: 2 / 4;
  }

  .dialog-list div {
    grid-template-columns: 1fr;
  }

  .stats-strip article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .source-meta {
    justify-content: flex-start;
  }
}
