:root {
  --bg: #F7F8F5;
  --text: #101726;
  --lime: #cdff50;
  --green: #16a34a;
  --yellow: #facc15;
  --slate: #374151;
  --ochre: #D4A373;
  --soft: #F3F4F6;
  --line: #dce3dc;
  --muted: #667085;
  --white: #ffffff;
  --shadow: 0 22px 70px rgba(16, 23, 38, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1580px, calc(100% - 40px));
  margin: 0 auto;
  padding: 10px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(760px, 64vw);
  color: var(--slate);
  text-decoration: none;
  font-weight: 750;
  font-size: 14px;
  line-height: 1.3;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--text);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.nav-pill.active {
  background: var(--text);
  color: var(--white);
}

.hero-band {
  padding: 14px 20px;
  border: 1px solid #e0e5df;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 32px rgba(16, 23, 38, 0.055);
}

.eyebrow {
  margin: 0 0 6px;
  color: #667085;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(24px, 2.6vw, 36px);
  line-height: 1.12;
  letter-spacing: 0;
  font-weight: 800;
}

h1 span {
  display: inline;
}

h1 strong {
  display: inline;
  color: var(--text);
  font-weight: inherit;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.hero-text {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--slate);
  font-size: 14px;
  line-height: 1.4;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.hero-meta span {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  border: 1px solid #e0e5df;
  border-radius: 8px;
  background: #f9faf8;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  padding: 0 10px;
  text-transform: uppercase;
}

.hero-meta strong {
  color: var(--text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin: 14px 0;
}

.select-wrap,
.search-wrap {
  display: grid;
  gap: 8px;
}

.select-wrap span,
.search-wrap span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
input[type="search"] {
  width: 100%;
  min-height: 50px;
  border: 1px solid #d7ded7;
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  box-shadow: 0 6px 18px rgba(16, 23, 38, 0.04);
}

select:focus,
input[type="search"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14);
}

.segmented {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid #d7ded7;
  border-radius: var(--radius);
  background: var(--white);
}

.segment {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--slate);
  cursor: pointer;
  font-weight: 800;
  padding: 0 14px;
}

.segment.active {
  background: var(--lime);
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 18px;
  align-items: start;
}

.match-column,
.detail-panel,
.pipeline-band,
.dossier-shell {
  border: 1px solid #e0e5df;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 12px 36px rgba(16, 23, 38, 0.05);
}

.match-column {
  padding: 18px;
}

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

.count-pill,
.mini-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--slate);
  font-weight: 800;
  font-size: 12px;
  line-height: 1.25;
  padding: 0 10px;
}

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

.match-card {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 32px;
  gap: 14px;
  width: 100%;
  border: 1px solid #e1e7df;
  border-radius: var(--radius);
  background: #ffffff;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.match-card:hover,
.match-card:focus-visible,
.match-card.active {
  border-color: var(--green);
  box-shadow: 0 18px 38px rgba(16, 23, 38, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.score-tile {
  display: grid;
  place-items: center;
  align-self: start;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(250, 204, 21, 0.9);
  border-radius: var(--radius);
  background: #fffbea;
}

.score-tile strong {
  color: var(--ochre);
  font-size: 27px;
  line-height: 1;
}

.score-tile span {
  display: none;
}

.match-main h3 {
  margin-right: 4px;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.tag-row,
.meta-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tag-row {
  margin-bottom: 9px;
}

.status-pill.open,
.status-pill.upcoming {
  background: #e8f8ed;
  color: #087c38;
}

.status-pill.temporarily_closed,
.status-pill.closed {
  background: #fff7db;
  color: var(--ochre);
}

.status-pill.verified {
  background: #efffeb;
  color: #0f7c36;
}

.mini-pill {
  background: #eef0f2;
}

.mini-pill.good {
  background: #e8f8ed;
  color: #087c38;
}

.mini-pill.warning {
  background: #fff7db;
  color: var(--ochre);
}

.match-summary {
  margin: 0 0 10px;
  color: var(--slate);
  font-size: 14px;
  line-height: 1.45;
}

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

.meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.arrow-cell {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  align-self: start;
  border-radius: 50%;
  background: var(--soft);
  color: var(--text);
  font-size: 20px;
}

.detail-panel {
  position: sticky;
  top: 18px;
  min-height: 520px;
  padding: 20px;
}

.empty-state {
  min-height: 460px;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--lime);
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 14px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid #e1e7df;
}

.detail-hero h2 {
  margin-bottom: 10px;
  font-size: 26px;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.detail-score {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--white);
}

.detail-score strong {
  font-size: 31px;
  line-height: 1;
}

.detail-score span {
  display: none;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 44px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--text);
  color: var(--white);
  padding: 0 16px;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  color: var(--text);
  padding: 0 16px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  background: var(--lime);
  color: var(--text);
  font-size: 20px;
}

.detail-block {
  margin-top: 16px;
}

.detail-block h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.narrative {
  color: var(--slate);
  line-height: 1.55;
}

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

.fact {
  min-width: 0;
  padding: 11px;
  border-radius: var(--radius);
  background: var(--soft);
}

.fact span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fact strong {
  display: block;
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.reason-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reason-list li {
  position: relative;
  padding-left: 18px;
  color: var(--slate);
  line-height: 1.45;
}

.reason-list li::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.reason-list.watch li::before {
  background: var(--yellow);
}

.readiness-stack {
  display: grid;
  gap: 11px;
}

.readiness-item {
  display: grid;
  grid-template-columns: minmax(86px, 0.7fr) minmax(90px, 1fr) 34px;
  align-items: center;
  gap: 10px;
  color: var(--slate);
  font-size: 12px;
  font-weight: 800;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ece8;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.pipeline-band {
  margin-top: 24px;
  padding: 26px;
}

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

.pipeline-card {
  min-height: 160px;
  padding: 18px;
  border: 1px solid #e1e7df;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fbfcfa);
}

.pipeline-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 18px;
}

.pipeline-card p {
  margin-bottom: 0;
  color: var(--slate);
  line-height: 1.45;
}

.pipeline-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--text);
  font-weight: 900;
}

.dossier-page {
  padding-top: 10px;
}

.dossier-shell {
  padding: 28px;
}

.dossier-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 20px;
  margin-bottom: 24px;
}

.dossier-title {
  min-width: 0;
  max-width: 100%;
}

.dossier-title h1 {
  margin-bottom: 12px;
  max-width: 32ch;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.dossier-title .tag-row {
  max-width: 100%;
}

.dossier-title .mini-pill,
.dossier-title .status-pill {
  min-height: 24px;
  max-width: 100%;
  border-radius: 8px;
  padding: 4px 10px;
  white-space: normal;
}

.dossier-top > .secondary-button {
  min-width: 72px;
  white-space: nowrap;
}

.dossier-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 24px;
  align-items: start;
}

.dossier-section {
  min-width: 0;
  padding: 20px;
  border: 1px solid #e1e7df;
  border-radius: var(--radius);
  background: #ffffff;
}

.dossier-section h2 {
  margin-bottom: 16px;
  font-size: 26px;
  line-height: 1.15;
}

.dossier-section .reason-list + .secondary-button {
  display: flex;
  width: fit-content;
  margin-top: 18px;
}

.dossier-section + .dossier-section {
  margin-top: 14px;
}

.dossier-side {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.dossier-side .dossier-section {
  padding: 18px;
}

.dossier-side h2 {
  font-size: 23px;
}

.source-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.loading,
.error {
  padding: 24px;
  border: 1px solid #e1e7df;
  border-radius: var(--radius);
  background: var(--white);
  color: var(--slate);
}

@media (min-width: 1101px) {
  body {
    font-size: 15px;
  }

  .topbar {
    padding-bottom: 10px;
  }

  .hero-band {
    padding: 12px 18px;
  }

  h1 {
    font-size: clamp(22px, 2.1vw, 32px);
  }

  h2 {
    font-size: 24px;
  }

  h3 {
    font-size: 18px;
  }

  select,
  input[type="search"] {
    min-height: 44px;
  }

  .segment {
    min-height: 34px;
  }

  .section-heading {
    margin-bottom: 14px;
  }

  .match-list {
    gap: 10px;
  }

  .status-pill,
  .mini-pill {
    min-height: 24px;
    padding-inline: 9px;
  }

  .match-summary {
    font-size: 13px;
  }

  .meta-row {
    font-size: 12px;
  }

  .arrow-cell {
    width: 32px;
    height: 32px;
  }

  .fact-grid {
    gap: 8px;
  }

  .primary-button,
  .secondary-button,
  .icon-button {
    min-height: 40px;
  }

  .pipeline-band {
    margin-top: 18px;
    padding: 22px;
  }
}

@media (max-width: 1100px) {
  .workspace,
  .dossier-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

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

  .segmented {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .segment {
    flex: 1;
  }

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1520px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .brand {
    max-width: 100%;
  }

  .nav-pills {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .hero-band {
    padding: 14px 16px;
  }

  h1 {
    font-size: 28px;
  }

  .controls,
  .pipeline-grid,
  .fact-grid {
    grid-template-columns: 1fr;
  }

  .match-column,
  .detail-panel,
  .pipeline-band,
  .dossier-shell {
    padding: 14px;
  }

  .match-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .arrow-cell {
    display: none;
  }

  .score-tile {
    width: 46px;
    height: 46px;
  }

  .score-tile strong {
    font-size: 21px;
  }

  .tag-row,
  .meta-row,
  .chip-row {
    gap: 6px;
  }

  .status-pill,
  .mini-pill {
    max-width: 100%;
    min-height: 24px;
    white-space: normal;
  }

  .match-main h3 {
    font-size: 18px;
    line-height: 1.2;
  }

  .match-summary,
  .meta-row {
    font-size: 13px;
  }

  .detail-hero {
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 10px;
  }

  .detail-hero h2 {
    font-size: 23px;
    line-height: 1.12;
  }

  .detail-score {
    width: 58px;
    height: 58px;
  }

  .detail-score strong {
    font-size: 25px;
  }

  .readiness-item {
    grid-template-columns: minmax(74px, 0.8fr) minmax(70px, 1fr) 30px;
    gap: 8px;
  }

  .dossier-top {
    grid-template-columns: 1fr;
  }

  .dossier-top > .secondary-button {
    justify-self: start;
  }
}
