:root {
  --ink: #17201d;
  --muted: #66706b;
  --paper: #f6f2e8;
  --paper-deep: #ebe4d3;
  --white: #fffdf7;
  --green: #164b3b;
  --green-dark: #0d3026;
  --mint: #9fd5b6;
  --amber: #e8ad45;
  --rust: #a64f35;
  --line: rgba(23, 32, 29, 0.16);
  --shadow: 0 24px 65px rgba(34, 46, 40, 0.12);
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --sans: "Avenir Next", Avenir, "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  color: var(--ink);
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--sans);
  background:
    radial-gradient(circle at 82% 2%, rgba(232, 173, 69, 0.2), transparent 29rem),
    radial-gradient(circle at 4% 28%, rgba(22, 75, 59, 0.12), transparent 31rem),
    repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), rgba(23, 32, 29, 0.035) 25%);
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.46; }

.masthead {
  width: min(1480px, calc(100% - 56px));
  margin: 0 auto;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--paper);
  background: var(--green);
  font: 700 20px var(--serif);
}

.wordmark strong, .wordmark small { display: block; }
.wordmark strong { font: 700 18px var(--serif); letter-spacing: 0.08em; }
.wordmark small { margin-top: 3px; color: var(--muted); font-size: 8px; letter-spacing: 0.18em; }

.connection-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 253, 247, 0.7);
  font-weight: 700;
}

.connection::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  content: "";
}

.connection.online::before { background: #2e9d69; box-shadow: 0 0 0 4px rgba(46, 157, 105, 0.12); }
.connection.offline::before { background: var(--rust); }

main {
  width: min(1480px, calc(100% - 56px));
  margin: 0 auto;
  padding-bottom: 120px;
}

.hero {
  min-height: 485px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 7vw;
  align-items: center;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 970px;
  margin: 0;
  font: 500 clamp(48px, 6.6vw, 96px)/0.96 var(--serif);
  letter-spacing: -0.055em;
}

.hero h1 em { color: var(--green); font-weight: 500; }

.hero-intro {
  max-width: 760px;
  margin: 34px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
}

.trust-card {
  position: relative;
  overflow: hidden;
  padding: 30px;
  color: var(--paper);
  background: var(--green-dark);
  border-radius: 3px 50px 3px 3px;
  box-shadow: var(--shadow);
}

.trust-card::after {
  position: absolute;
  right: -30px;
  top: -30px;
  width: 120px;
  height: 120px;
  border: 1px solid rgba(159, 213, 182, 0.38);
  border-radius: 50%;
  content: "";
}

.trust-kicker {
  color: var(--mint);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.trust-card > strong {
  display: block;
  margin: 20px 0 5px;
  color: var(--amber);
  font: 500 70px/1 var(--serif);
}

.trust-card p { color: rgba(246, 242, 232, 0.76); font-size: 13px; line-height: 1.7; }
.trust-card ul { margin: 22px 0 0; padding: 18px 0 0; border-top: 1px solid rgba(255, 255, 255, 0.15); list-style: none; }
.trust-card li { margin: 8px 0; font-size: 12px; }
.trust-card li::before { margin-right: 8px; color: var(--mint); content: "✓"; }

.stage-rail {
  position: sticky;
  z-index: 30;
  top: 0;
  margin-bottom: 42px;
  padding: 12px 0;
  background: rgba(246, 242, 232, 0.91);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.stage-rail ol {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage-rail li {
  position: relative;
  min-width: 0;
  padding: 10px 12px 10px 36px;
  color: var(--muted);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  transition: background 180ms ease, color 180ms ease;
}

.stage-rail li::before {
  position: absolute;
  left: 10px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: attr(data-number);
  font-size: 7px;
  transform: translateY(-50%);
}

.stage-rail li.active { color: var(--white); background: var(--green); }
.stage-rail li.complete { color: var(--green); background: rgba(159, 213, 182, 0.24); }
.stage-rail li.complete::before { color: var(--white); border-color: var(--green); background: var(--green); content: "✓"; }

.notice {
  margin: -18px 0 28px;
  padding: 15px 18px;
  color: var(--green-dark);
  background: rgba(159, 213, 182, 0.32);
  border-left: 4px solid var(--green);
  font-size: 13px;
  line-height: 1.6;
}

.notice.error { color: #6b2819; background: #f4ddd3; border-color: var(--rust); }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 345px;
  gap: 32px;
  align-items: start;
}

.journey-column { display: grid; gap: 22px; }

.stage-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 280px;
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 12px 35px rgba(34, 46, 40, 0.055);
  transition: border-color 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.stage-card.locked { border-color: rgba(23, 32, 29, 0.09); }
.stage-card.locked .stage-heading { background: #f1ecdf; }
.stage-card.locked .stage-body { background: rgba(246, 242, 232, 0.46); }
.stage-card.current { border-color: rgba(22, 75, 59, 0.55); box-shadow: 0 20px 55px rgba(22, 75, 59, 0.1); }
.stage-card.complete::after {
  position: absolute;
  right: 18px;
  top: 16px;
  color: var(--green);
  content: "SAVED ✓";
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.stage-heading {
  padding: 31px 26px;
  background: var(--paper-deep);
  border-right: 1px solid var(--line);
}

.stage-number {
  display: inline-block;
  margin-bottom: 82px;
  color: var(--green);
  font: 500 30px/1 var(--serif);
}

.stage-heading p { margin: 0 0 7px; color: #46514c; font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.stage-heading h2 { margin: 0; font: 500 25px/1.15 var(--serif); }
.stage-body, .project-card form { padding: 31px; }
.project-card { grid-template-columns: 260px minmax(0, 1fr); }
.project-card .record-summary { margin: 31px; }
.project-delete { align-self: end; margin: 0 31px 31px; }

.stage-explainer { max-width: 720px; margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.75; }

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

label, fieldset { min-width: 0; }

label {
  display: grid;
  gap: 7px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.025em;
}

.full { grid-column: 1 / -1; }

input, textarea {
  width: 100%;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input { min-height: 46px; padding: 10px 12px; }
textarea { padding: 12px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 75, 59, 0.1); }
input[type="file"] { padding: 8px; }
.file-field small { color: var(--muted); font-weight: 500; line-height: 1.5; }

.consent-panel {
  margin: 2px 0;
  padding: 18px;
  background: rgba(232, 173, 69, 0.09);
  border: 1px solid rgba(166, 79, 53, 0.25);
}

.consent-panel legend { padding: 0 8px; color: var(--rust); font-size: 11px; font-weight: 800; }
.consent-panel p { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.check { display: flex; align-items: flex-start; gap: 9px; color: var(--ink); font-size: 12px; line-height: 1.55; }
.check input { flex: 0 0 auto; width: 17px; min-height: 17px; margin-top: 1px; accent-color: var(--green); }

.button {
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.035em;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.button:not(:disabled):hover { transform: translateY(-2px); }
.button.primary { color: var(--white); background: var(--green); box-shadow: 0 10px 24px rgba(22, 75, 59, 0.18); }
.button.secondary { color: var(--green); background: transparent; border-color: var(--green); }
.button.danger { color: var(--rust); background: transparent; border-color: rgba(166, 79, 53, 0.36); }
.form-actions, .review-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.record-summary, .stage-output {
  margin-top: 25px;
  padding: 20px;
  background: #eff1e9;
  border-left: 3px solid var(--green);
}

.record-summary h3, .stage-output h3 { margin: 0 0 10px; font: 600 19px/1.3 var(--serif); }
.record-summary p, .stage-output p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.record-id { display: inline-block; max-width: 100%; overflow: hidden; color: var(--green); font: 700 9px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }

.pill-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; padding: 0; list-style: none; }
.pill-list li { padding: 6px 9px; color: var(--green-dark); background: rgba(159, 213, 182, 0.35); border-radius: 999px; font-size: 10px; font-weight: 800; }

.question-form { margin-top: 24px; }
.question-item { margin: 0 0 18px; padding: 18px; background: var(--paper); border: 1px solid var(--line); }
.question-item header { display: flex; gap: 12px; align-items: flex-start; }
.question-item b { display: grid; flex: 0 0 auto; place-items: center; width: 25px; height: 25px; color: var(--white); background: var(--green); border-radius: 50%; font-size: 9px; }
.question-item h3 { margin: 2px 0 7px; font: 600 16px/1.35 var(--serif); }
.question-item p { margin: 0 0 13px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.question-item textarea { min-height: 110px; background: var(--white); }

.metric-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 15px 0; }
.metric { min-width: 105px; padding: 11px; background: var(--white); border: 1px solid var(--line); }
.metric strong, .metric span { display: block; }
.metric strong { color: var(--green); font: 600 22px var(--serif); }
.metric span { margin-top: 3px; color: var(--muted); font-size: 9px; text-transform: uppercase; }

.graph-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.skill-node { padding: 15px; background: var(--white); border: 1px solid var(--line); }
.skill-node h4 { margin: 0 0 8px; font: 600 16px var(--serif); }
.skill-node .confidence { color: var(--green); font-size: 10px; font-weight: 800; }
.evidence-tag { display: inline-block; margin: 6px 4px 0 0; padding: 4px 6px; color: var(--muted); border: 1px solid var(--line); font-size: 8px; text-transform: uppercase; }

.finding {
  margin: 10px 0;
  padding: 13px;
  color: #622616;
  background: #f7e6dd;
  border: 1px solid rgba(166, 79, 53, 0.26);
}

.finding label { display: flex; align-items: flex-start; gap: 9px; color: inherit; }
.finding input { width: 16px; min-height: 16px; accent-color: var(--rust); }
.finding code { display: block; margin-top: 6px; overflow-wrap: anywhere; color: #814532; font-size: 9px; }
.no-findings { padding: 13px; color: var(--green); background: rgba(159, 213, 182, 0.25); font-size: 12px; }
.review-form { display: grid; gap: 15px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

.evidence-sticky { position: sticky; top: 90px; padding: 26px; background: var(--green-dark); color: var(--paper); box-shadow: var(--shadow); }
.evidence-sticky h2 { margin: -7px 0 24px; font: 500 32px var(--serif); }
.evidence-sticky .eyebrow { color: var(--mint); }
.empty-state { color: rgba(246, 242, 232, 0.62); font-size: 12px; line-height: 1.7; }

.dossier-person { padding-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.15); }
.dossier-person strong { display: block; font: 500 24px var(--serif); }
.dossier-person span { color: var(--mint); font-size: 10px; }
.dossier-records { margin: 18px 0; padding: 0; list-style: none; }
.dossier-record { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.dossier-record > span { display: grid; place-items: center; width: 25px; height: 25px; color: var(--green-dark); background: var(--mint); border-radius: 50%; font-size: 8px; font-weight: 900; }
.dossier-record strong { display: block; margin-bottom: 3px; font-size: 11px; }
.dossier-record small { display: block; overflow: hidden; color: rgba(246, 242, 232, 0.55); font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.dossier-record.pending > span { background: var(--amber); }
.dossier-record.locked > span { color: rgba(246, 242, 232, 0.5); background: rgba(255, 255, 255, 0.08); }

.privacy-note { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.15); }
.privacy-note strong { color: var(--amber); font-size: 10px; letter-spacing: 0.12em; }
.privacy-note p { color: rgba(246, 242, 232, 0.55); font-size: 10px; line-height: 1.6; }

.busy {
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 18px;
  color: var(--white);
  background: var(--green-dark);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.busy[hidden] { display: none; }
.busy strong, .busy small { display: block; }
.busy strong { font-size: 11px; }
.busy small { margin-top: 4px; color: rgba(255, 255, 255, 0.6); font-size: 9px; }
.busy-orbit { width: 25px; height: 25px; border: 2px solid rgba(255, 255, 255, 0.18); border-top-color: var(--amber); border-radius: 50%; animation: spin 800ms linear infinite; }

.hub-return-link {
  position: fixed;
  z-index: 120;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 14px;
  color: #fffdf6;
  background: rgba(15, 43, 33, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
  text-decoration: none;
  font-family: var(--sans);
}
.hub-return-link span { font-size: 11px; font-weight: 800; }
.hub-return-link b { padding: 6px 9px; color: #12372a; background: #edb94f; border-radius: 999px; font-size: 9px; letter-spacing: 0.08em; }
.hub-return-link:hover { transform: translateY(-2px); }

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

@media (max-width: 1080px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .evidence-column { order: -1; }
  .evidence-sticky { position: static; }
  .dossier-records { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .dossier-record { min-width: 0; border: 0; }
}

@media (max-width: 780px) {
  .masthead, main { width: min(100% - 28px, 1480px); }
  .masthead { min-height: 74px; }
  .connection-wrap > span:last-child { display: none; }
  .hero { min-height: 0; grid-template-columns: 1fr; gap: 36px; padding: 70px 0 44px; }
  .hero h1 { font-size: clamp(42px, 13vw, 70px); }
  .trust-card { max-width: none; }
  .stage-rail { overflow-x: auto; margin-inline: -14px; padding-inline: 14px; }
  .stage-rail ol { grid-template-columns: repeat(5, minmax(128px, 1fr)); min-width: 680px; }
  .stage-card, .project-card { grid-template-columns: 1fr; }
  .stage-heading { padding: 21px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-number { margin: 0 18px 0 0; vertical-align: middle; }
  .stage-heading > div { display: inline-block; vertical-align: middle; }
  .stage-body, .project-card form { padding: 21px; }
  .project-card .record-summary { margin: 21px; }
  .project-delete { margin: 0 21px 21px; }
  .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .graph-grid { grid-template-columns: 1fr; }
  .dossier-records { grid-template-columns: 1fr 1fr; }
  .busy { left: 14px; right: 14px; bottom: 72px; }
  .hub-return-link { left: 10px; bottom: 10px; }
  .hub-return-link span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  .hub-return-link, .stage-rail, .button, .busy { display: none !important; }
  body { background: #fff; }
  .workspace-grid { grid-template-columns: 1fr; }
  .evidence-sticky { position: static; color: var(--ink); background: #fff; box-shadow: none; }
}
