:root {
  color-scheme: dark;
  --bg: #08151f;
  --bg-deep: #06111a;
  --surface: #0d1d28;
  --surface-raised: #122532;
  --surface-strong: #172d3c;
  --line: #2e4859;
  --line-strong: #426274;
  --text: #edf5f9;
  --text-soft: #cbd8e0;
  --muted: #94a9b6;
  --accent: #83c9e8;
  --accent-strong: #a7ddf2;
  --high: #73d7ad;
  --medium: #8ecbe8;
  --low: #e7bd78;
  --danger: #ef8c8c;
  --shadow: 0 18px 45px rgb(0 0 0 / 22%);
  --shell: 1180px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

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

button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgb(131 201 232 / 45%);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.shell { width: min(calc(100% - 48px), var(--shell)); margin-inline: auto; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 500;
  top: 8px;
  left: 8px;
  padding: 9px 13px;
  transform: translateY(-150%);
  border: 1px solid var(--accent);
  background: var(--surface-strong);
  color: var(--text);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgb(9 23 34 / 94%);
  backdrop-filter: blur(14px);
}

.site-header__inner {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.skyline-mark { width: 64px; color: var(--accent); }
.skyline-mark svg { display: block; width: 100%; }
.brand__copy { display: flex; align-items: baseline; }
.brand__copy strong { font-size: 24px; letter-spacing: -.025em; }

main { min-height: calc(100vh - 180px); }

.loading-screen, .profile-loading {
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: var(--muted);
}

.loading-mark {
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.home-hero {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 78% 12%, rgb(69 132 165 / 18%), transparent 34%),
    linear-gradient(150deg, #0c1d29, #08151f 58%);
}

.home-hero__inner { padding-block: 74px 56px; }
.home-hero h1, .page-heading h1, .profile-heading h1, .error-page h1 {
  margin: 0;
  max-width: 920px;
  color: var(--text);
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.04;
  letter-spacing: -.04em;
}
.home-hero__lede {
  max-width: 720px;
  margin: 20px 0 30px;
  color: var(--text-soft);
  font-size: 20px;
}

.home-search {
  max-width: 760px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 42px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
}

input, select { min-height: 46px; padding: 10px 13px; }
textarea { min-height: 310px; padding: 14px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #6f8795; }
select option { background: var(--surface); color: var(--text); }

.button, .home-search button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #07131c;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.button:hover, .home-search button:hover { background: var(--accent-strong); }
.button:disabled { cursor: wait; opacity: .55; }
.button--secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
.button--secondary:hover { background: var(--surface-strong); }

.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  background: rgb(13 29 40 / 78%);
}
.home-stats article { padding: 22px; border-right: 1px solid var(--line); }
.home-stats article:last-child { border-right: 0; }
.home-stats span, .summary-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.home-stats strong { display: block; font-size: 29px; letter-spacing: -.025em; }

.home-sections { padding-block: 54px 76px; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.section-heading h2 { margin: 0; font-size: 29px; letter-spacing: -.025em; }
.section-heading p:not(.eyebrow) { margin: 5px 0 0; color: var(--muted); }
.section-heading > a { color: var(--accent); text-decoration: none; }
.section-heading > a:hover { text-decoration: underline; }
.section-heading--spaced { margin-top: 52px; }

.query-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.query-grid a, .priority-card {
  display: block;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.query-grid a { min-height: 188px; padding: 24px; }
.query-grid a:hover, .priority-card:hover { border-color: var(--accent); background: var(--surface-raised); transform: translateY(-2px); }
.query-grid span { color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.query-grid strong { display: block; margin-top: 18px; font-size: 22px; }
.query-grid p { margin: 9px 0 0; color: var(--muted); }

.priority-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.priority-card { min-height: 134px; padding: 18px 20px; }
.priority-card > div { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.priority-card > strong { display: block; margin: 20px 0 5px; font-size: 17px; }
.priority-card > span { color: var(--muted); font-size: 13px; }

.page-heading, .profile-heading { padding-block: 48px 42px; }
.page-heading { display: flex; justify-content: space-between; gap: 30px; }
.page-heading h1, .profile-heading h1 { font-size: clamp(33px, 4.4vw, 50px); }
.page-heading > div > p:last-child, .profile-heading__row > div > p:last-child {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.workspace { padding-bottom: 72px; }
.filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 520px);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.filter-bar--opportunities, .filter-bar--entity { grid-template-columns: minmax(260px, 1fr) 220px; }
.filter-bar label > span {
  display: block;
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}
.result-count { margin: 13px 0 20px; color: var(--muted); font-size: 13px; }

.data-surface, .profile-surface {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.data-surface > header, .profile-surface > header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-deep);
}
.data-surface > header h2, .profile-surface > header h3 { margin: 0; font-size: 17px; }
.data-surface > header span, .profile-surface > header span { color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
}
.data-table td {
  padding: 15px 17px;
  border-bottom: 1px solid rgb(46 72 89 / 72%);
  color: var(--text-soft);
  vertical-align: top;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: rgb(131 201 232 / 4%); }
.data-table a { color: var(--text); font-weight: 650; text-decoration: none; }
.data-table a:hover { color: var(--accent); text-decoration: underline; }
.entity-table th:nth-child(2), .entity-table td:nth-child(2) { text-align: center; }
.opportunity-table th:last-child, .opportunity-table td:last-child { text-align: right; }
.candidate-row--high td:first-child { box-shadow: inset 3px 0 var(--high); }
.candidate-row--medium td:first-child { box-shadow: inset 3px 0 var(--medium); }
.candidate-row--low td:first-child { box-shadow: inset 3px 0 var(--low); }
.row-action { white-space: nowrap; }
.empty-cell { padding: 38px !important; color: var(--muted) !important; text-align: center !important; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.badge--high { border-color: rgb(115 215 173 / 55%); background: rgb(115 215 173 / 10%); color: var(--high); }
.badge--medium { border-color: rgb(142 203 232 / 52%); background: rgb(142 203 232 / 9%); color: var(--medium); }
.badge--low { border-color: rgb(231 189 120 / 55%); background: rgb(231 189 120 / 9%); color: var(--low); }
.tier-counts { display: flex; flex-wrap: wrap; gap: 7px 11px; }
.tier-count { font-size: 12px; white-space: nowrap; }
.tier-count--high { color: var(--high); }
.tier-count--medium { color: var(--medium); }
.tier-count--low { color: var(--low); }

.pagination {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.pagination button {
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); }
.pagination button:disabled { cursor: default; opacity: .35; }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 14px; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.profile-heading__row { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.profile-heading__row h1 span { color: var(--accent); }

.profile-tabs { margin-bottom: 40px; border-block: 1px solid var(--line); background: var(--bg-deep); }
.profile-tabs .shell { display: flex; }
.profile-tabs button {
  min-width: 148px;
  padding: 18px 24px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.profile-tabs button:first-child { border-left: 1px solid var(--line); }
.profile-tabs button.is-active { border-bottom-color: var(--accent); color: var(--text); background: rgb(131 201 232 / 4%); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.summary-grid article {
  min-height: 155px;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
}
.summary-grid strong { display: block; color: var(--text); font-size: 19px; line-height: 1.45; }
.summary-grid small { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.summary-grid--entity { margin-bottom: 22px; }
.summary-grid--entity article { min-height: auto; }
.summary-grid--entity strong { font-size: 28px; }

.profile-surface { margin: 0 0 24px; box-shadow: none; }
.profile-surface__body { padding: 22px 24px; }
.profile-surface__body p { margin: 0; color: var(--text-soft); font-size: 16px; line-height: 1.7; }
.profile-surface__body .lead-copy { color: var(--text); font-size: 19px; line-height: 1.65; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-column .profile-surface { height: calc(100% - 24px); }
.detail-table { min-width: 780px; }
.detail-table th, .detail-table td { width: 33.333%; }
.evidence-table th:first-child, .evidence-table td:first-child { width: 180px; }
.evidence-table td { line-height: 1.68; }
.caveat-list { margin: 0; padding: 0; list-style: none; counter-reset: caveat; }
.caveat-list li { position: relative; padding: 15px 0 15px 48px; border-bottom: 1px solid var(--line); counter-increment: caveat; }
.caveat-list li:last-child { border-bottom: 0; }
.caveat-list li::before {
  content: counter(caveat);
  position: absolute;
  top: 14px;
  left: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
}
.record-id { margin: 34px 0 0; color: var(--muted); font-size: 12px; }

.dialog-backdrop {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(2 9 14 / 82%);
}
.dialog {
  width: min(850px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 30px 90px rgb(0 0 0 / 55%);
}
.dialog > header { display: flex; justify-content: space-between; gap: 22px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.dialog h2 { margin: 0; font-size: 20px; }
.dialog header p { margin: 5px 0 0; color: var(--muted); }
.dialog__body { padding: 22px; }
.dialog__body label { display: block; margin-bottom: 8px; color: var(--text-soft); font-weight: 700; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface-raised); color: var(--text); font-size: 23px; cursor: pointer; }

.toast {
  position: fixed;
  z-index: 400;
  right: 18px;
  bottom: 18px;
  max-width: 390px;
  padding: 12px 16px;
  border: 1px solid var(--accent);
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow);
}

.error-page { padding-block: 90px; }
.error-page h1 { max-width: 760px; font-size: 48px; }
.error-page p:not(.eyebrow), .error-surface p { max-width: 700px; margin: 18px 0 28px; color: var(--muted); font-size: 17px; }
.error-surface { padding: 34px; border: 1px solid var(--danger); background: var(--surface); }
.error-surface h2 { margin: 0; }

.site-footer { border-top: 1px solid var(--line); background: var(--bg-deep); }
.site-footer .shell { min-height: 90px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.site-footer p { margin: 0; color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .site-header { position: static; }
  .site-header__inner { min-height: 76px; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .home-stats article:nth-child(2) { border-right: 0; }
  .home-stats article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .query-grid { grid-template-columns: 1fr; }
  .query-grid a { min-height: auto; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-grid article { min-height: auto; }
  .two-column { grid-template-columns: 1fr; gap: 0; }
  .filter-bar--opportunities, .filter-bar--entity { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .shell { width: min(calc(100% - 28px), var(--shell)); }
  .brand__copy { display: block; }
  .brand__copy strong, .brand__copy span { display: block; }
  .brand__copy strong { font-size: 20px; }
  .skyline-mark { width: 54px; }
  .home-hero__inner { padding-block: 48px 40px; }
  .home-search { grid-template-columns: 1fr; }
  .home-stats { grid-template-columns: 1fr; }
  .home-stats article { border-right: 0; border-bottom: 1px solid var(--line); }
  .home-stats article:last-child { border-bottom: 0; }
  .priority-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
  .page-heading, .profile-heading { padding-block: 36px 30px; }
  .profile-heading__row { align-items: flex-start; flex-direction: column; }
  .profile-heading__row .button { width: 100%; }
  .profile-tabs { margin-bottom: 28px; }
  .profile-tabs .shell { width: 100%; }
  .profile-tabs button { flex: 1; min-width: 0; }
  .profile-surface__body { padding: 18px; }
  .profile-surface__body .lead-copy { font-size: 17px; }
  .data-surface > header, .profile-surface > header { align-items: flex-start; flex-direction: column; gap: 3px; }
  .pagination { justify-content: center; }
  .site-footer .shell { align-items: flex-start; flex-direction: column; justify-content: center; gap: 6px; padding-block: 20px; }
  .dialog-backdrop { padding: 10px; }
  .dialog__actions { flex-direction: column-reverse; }
  .dialog__actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
