:root {
  --background: #f3f5f2;
  --surface: #ffffff;
  --surface-soft: #edf2ee;
  --text: #101411;
  --muted: #69736d;
  --line: #dbe2dc;
  --accent: #143f34;
  --accent-hover: #0d3027;
  --accent-soft: #dce9e4;
  --warning: #8b621f;
  --danger: #813f38;
  --shadow: 0 24px 80px rgba(28, 49, 40, 0.1);
  --radius-xl: 30px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --max-width: 1280px;
  --control-height: 56px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      rgba(216, 234, 227, 0.85),
      transparent 38%
    ),
    var(--background);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button,
select {
  cursor: pointer;
}

button {
  color: inherit;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.hidden {
  display: none !important;
}

.landing-screen {
  min-height: 100vh;
}

.landing-content {
  width: min(calc(100% - 48px), 1100px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 90px 0 60px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

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

.landing-content h1 {
  margin: 0;
  font-size: clamp(76px, 12vw, 155px);
  line-height: 0.82;
  letter-spacing: -0.09em;
}

.landing-content h1 span {
  display: block;
  margin-top: 34px;
  color: var(--accent);
  font-size: clamp(38px, 5.5vw, 76px);
  line-height: 0.95;
  letter-spacing: -0.065em;
}

.landing-copy {
  max-width: 730px;
  margin: 42px 0 32px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.65;
}

.landing-features {
  width: 100%;
  margin-top: 74px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.landing-features div {
  display: grid;
  gap: 7px;
}

.landing-features strong {
  font-size: 14px;
}

.landing-features span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.button {
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.button.compact {
  min-height: 44px;
  padding: 0 18px;
}

.button.large {
  min-height: 62px;
  padding: 0 30px;
  font-size: 17px;
}

.button.primary {
  color: #fff;
  background: var(--accent);
}

.button.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
}

.button.secondary:hover {
  border-color: #aeb8b1;
  transform: translateY(-1px);
}

.builder-screen {
  min-height: 100vh;
  padding-bottom: 80px;
}

.builder-header {
  width: min(calc(100% - 48px), var(--max-width));
  height: 86px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark,
.text-button {
  padding: 0;
  border: 0;
  background: transparent;
}

.wordmark {
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.text-button {
  color: var(--muted);
  font-weight: 750;
}

.profile-strip {
  width: min(calc(100% - 48px), var(--max-width));
  margin: 0 auto 20px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 45px rgba(28, 49, 40, 0.07);
}

.profile-strip button {
  min-width: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  text-align: left;
  background: transparent;
}

.profile-strip button:hover {
  background: var(--surface-soft);
}

.profile-strip span,
.profile-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-strip span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-strip strong {
  font-size: 13px;
}

.builder-layout {
  width: min(calc(100% - 48px), var(--max-width));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.progress-card,
.content-card {
  border: 1px solid rgba(219, 226, 220, 0.95);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.progress-card {
  position: sticky;
  top: 24px;
  padding: 28px;
  border-radius: var(--radius-xl);
}

.progress-card > p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.progress-card ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.progress-card li {
  padding: 14px;
  border-radius: 15px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: var(--muted);
}

.progress-card li > span {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  font-size: 13px;
  font-weight: 850;
}

.progress-card li div {
  display: grid;
  gap: 3px;
}

.progress-card li strong {
  font-size: 14px;
}

.progress-card li small {
  font-size: 12px;
}

.progress-card li.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.progress-card li.active > span,
.progress-card li.complete > span {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.progress-card li.complete {
  color: var(--text);
}

.content-card {
  min-height: 720px;
  padding: 46px;
  border-radius: var(--radius-xl);
}

.step {
  display: none;
}

.step.active {
  display: block;
}

.step-heading {
  max-width: 760px;
  margin-bottom: 38px;
}

.step-heading > p,
.report-toolbar > div > p {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.step-heading h2,
.report-toolbar h2 {
  margin: 0 0 12px;
  font-size: clamp(38px, 5vw, 58px);
  letter-spacing: -0.06em;
}

.step-heading > span {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

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

.form-grid.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
  align-content: start;
}

.field > span,
.field legend,
.tag-editor label > span {
  min-height: 20px;
  padding: 0;
  display: flex;
  align-items: flex-end;
  color: #303934;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: #fff;
}

input,
select {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 15px;
  line-height: normal;
}

select {
  appearance: auto;
  -webkit-appearance: menulist;
  border-radius: 12px;
}

textarea {
  padding: 15px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(20, 63, 52, 0.09);
}

.choice-grid {
  min-height: var(--control-height);
  display: grid;
  gap: 12px;
}

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

.choice {
  position: relative;
  height: var(--control-height);
  min-height: var(--control-height);
}

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #fff;
}

.choice input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.section-block {
  margin-top: 40px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.section-block:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

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

.section-heading h3 {
  margin: 0 0 5px;
  font-size: 22px;
  letter-spacing: -0.035em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.calculated-row {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.calculated-row div {
  padding: 18px;
  border-radius: 14px;
  background: var(--surface-soft);
  display: grid;
  gap: 7px;
}

.calculated-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calculated-row strong {
  font-size: 20px;
}

.record-list {
  display: grid;
  gap: 14px;
}

.record-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.record-card-header {
  display: grid;
  gap: 6px;
}

.record-card-header strong {
  font-size: 16px;
}

.record-card-header span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.chip-row {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.answer-chip {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.answer-chip:hover {
  border-color: #9eaaa2;
}

.answer-chip.selected {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.record-details {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 130px minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 14px;
}

.record-details label {
  display: grid;
  gap: 7px;
}

.record-details label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.record-details input,
.record-details select {
  min-height: 46px;
}

.tag-editor-grid {
  display: grid;
  gap: 20px;
}

.tag-editor {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.tag-editor label {
  display: grid;
  gap: 9px;
}

.tag-list {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.data-tag {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 800;
}

.data-tag button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.7);
  font-weight: 900;
}

.clarification-groups {
  display: grid;
  gap: 34px;
}

.clarification-group {
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line);
}

.clarification-group:last-child {
  border-bottom: 0;
}

.clarification-group h3 {
  margin: 0 0 18px;
  font-size: 22px;
  letter-spacing: -0.035em;
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.question-card-header strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}

.question-card-header span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.question-details {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.question-details label {
  display: grid;
  gap: 7px;
}

.question-details label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.step-actions {
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.step-actions .secondary {
  margin-right: auto;
}

.report-toolbar {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.appendix-toggle {
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.appendix-toggle input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
}

.report {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
}

.report-header {
  padding: 30px 34px;
  color: #fff;
  background: var(--accent);
  display: flex;
  justify-content: space-between;
  gap: 30px;
}

.report-header p {
  margin: 0 0 7px;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.72;
}

.report-header h2 {
  margin: 0 0 8px;
  font-size: 34px;
  letter-spacing: -0.055em;
}

.report-person {
  display: block;
  font-size: 14px;
  opacity: 0.82;
}

.report-generated {
  text-align: right;
  display: grid;
  gap: 5px;
}

.report-generated span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
}

.report-generated strong {
  font-size: 14px;
}

.report-profile {
  padding: 19px 34px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  background: var(--surface-soft);
}

.report-profile div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.report-profile span,
.position-grid span,
.summary-banner span,
.cost-snapshot span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-profile strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
}

.summary-banner {
  padding: 18px 34px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.summary-banner div {
  padding: 14px;
  border-radius: 12px;
  display: grid;
  gap: 5px;
  background: var(--surface-soft);
}

.summary-banner strong {
  font-size: 21px;
  letter-spacing: -0.04em;
}

.report-section {
  padding: 25px 34px;
  border-bottom: 1px solid var(--line);
}

.compact-report-section {
  padding-top: 21px;
  padding-bottom: 21px;
}

.report-section-heading {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
}

.report-section-heading > span,
.mini-heading > span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.report-section-heading h3,
.mini-heading h3 {
  margin: 0 0 3px;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.report-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.position-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.position-grid div {
  padding: 12px;
  border-radius: 10px;
  display: grid;
  gap: 5px;
  background: var(--surface-soft);
}

.position-grid strong {
  font-size: 12px;
}

.report-table {
  display: grid;
}

.report-row {
  min-height: 48px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 0.9fr 0.75fr 0.5fr;
  gap: 13px;
  align-items: center;
}

.report-row:first-child {
  border-top: 0;
}

.report-row strong {
  font-size: 11px;
}

.report-row span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.report-row .cost {
  color: var(--text);
  text-align: right;
  font-weight: 850;
}

.two-column-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.mini-heading {
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: baseline;
  gap: 7px;
}

.summary-list {
  display: grid;
  gap: 7px;
}

.summary-item {
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--surface-soft);
  font-size: 10px;
  line-height: 1.35;
}

.summary-count {
  padding: 11px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 850;
}

.cost-snapshot {
  display: grid;
  grid-template-columns: 0.75fr 0.75fr 1.5fr;
  gap: 20px;
  align-items: center;
  background: var(--surface-soft);
}

.cost-snapshot div {
  display: grid;
  gap: 6px;
}

.cost-snapshot strong {
  font-size: 25px;
  letter-spacing: -0.045em;
}

.cost-snapshot p,
.report-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.report-footer {
  padding: 17px 34px;
  display: flex;
  justify-content: space-between;
  gap: 28px;
}

.report-footer strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
}

.matrix-appendix {
  padding: 34px;
  border-top: 8px solid var(--background);
}

.appendix-heading {
  margin-bottom: 24px;
}

.appendix-heading p {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.appendix-heading h2 {
  margin: 0 0 5px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.appendix-heading span {
  color: var(--muted);
  font-size: 13px;
}

.matrix-table-wrapper {
  overflow-x: auto;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.matrix-table th,
.matrix-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.matrix-table th:nth-child(3),
.matrix-table th:nth-child(4),
.matrix-table td:nth-child(3),
.matrix-table td:nth-child(4) {
  text-align: right;
}

.matrix-table thead th {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.matrix-table tfoot th {
  border-bottom: 0;
  font-size: 13px;
}

.matrix-status {
  color: var(--accent);
  font-weight: 850;
}

.matrix-status.inactive {
  color: var(--muted);
  font-weight: 650;
}

/* ---------------------------------------------------------
   Step headings and information controls
   --------------------------------------------------------- */

.step-title-row {
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.step-title-row h2 {
  margin: 0;
}

.report-title-row {
  margin-bottom: 0;
}

.step-help-button {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--accent);
  background: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition:
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.step-help-button:hover {
  color: #fff;
  background: var(--accent);
  transform: translateY(-1px);
}

.step-help-button:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 6px rgba(20, 63, 52, 0.3);
}

/* ---------------------------------------------------------
   Shared help modal
   --------------------------------------------------------- */

body.modal-open {
  overflow: hidden;
}

.help-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 24px;
  display: grid;
  place-items: center;
}

.help-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 20, 16, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.help-modal {
  position: relative;
  z-index: 1;
  width: min(100%, 680px);
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid rgba(219, 226, 220, 0.95);
  border-radius: 24px;
  display: block;
  background: #fff;
  box-shadow: 0 34px 110px rgba(7, 24, 18, 0.3);
}

.help-modal:focus {
  outline: none;
}

.help-modal-header {
  height: auto;
  min-height: 0;
  padding: 25px 28px 20px;
  border-bottom: 1px solid var(--line);
  display: block;
  text-align: center;
}

.help-modal-header > div {
  width: 100%;
}

.help-modal-header p {
  width: 100%;
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-align: center;
  text-transform: uppercase;
}

.help-modal-header h2 {
  width: 100%;
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.045em;
  text-align: center;
}

.help-modal-close {
  display: none !important;
}

.help-modal-body {
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding: 24px 28px 28px;
  color: #313a34;
}

.help-modal-body > :first-child {
  margin-top: 0;
}

.help-modal-body > :last-child {
  margin-bottom: 0;
}

.help-modal-body h3 {
  margin: 25px 0 8px;
  font-size: 17px;
  letter-spacing: -0.025em;
}

.help-modal-body h3:first-child {
  margin-top: 0;
}

.help-modal-body p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.62;
}

.help-modal-body ul {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--muted);
}

.help-modal-body li {
  margin: 7px 0;
  font-size: 14px;
  line-height: 1.5;
}

.help-modal-body strong {
  color: var(--text);
}

.help-notice {
  margin-top: 18px;
  padding: 15px 17px;
  border: 1px solid #bfd1c8;
  border-radius: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.help-modal-footer {
  display: none !important;
}

@media (max-width: 1050px) {
  .profile-strip {
    grid-template-columns: repeat(3, 1fr);
  }

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

@media (max-width: 900px) {
  .builder-layout {
    grid-template-columns: 1fr;
  }

  .progress-card {
    position: static;
    padding: 16px;
  }

  .progress-card > p {
    display: none;
  }

  .progress-card ol {
    grid-template-columns: repeat(4, 1fr);
  }

  .progress-card li {
    padding: 10px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .progress-card li div {
    display: none;
  }

  .landing-features,
  .summary-banner,
  .position-grid,
  .cost-snapshot {
    grid-template-columns: 1fr;
  }

  .record-details,
  .question-details,
  .two-column-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .landing-content,
  .builder-header,
  .profile-strip,
  .builder-layout {
    width: min(calc(100% - 28px), var(--max-width));
  }

  .builder-header {
    height: 72px;
  }

  .landing-content {
    padding: 60px 0 40px;
  }

  .landing-content h1 {
    font-size: clamp(64px, 21vw, 96px);
  }

  .landing-content h1 span {
    margin-top: 26px;
    font-size: clamp(36px, 11vw, 52px);
  }

  .landing-copy {
    font-size: 17px;
  }

  .landing-features {
    margin-top: 54px;
  }

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

  .content-card {
    min-height: 0;
    padding: 27px 20px;
  }

  .form-grid,
  .form-grid.three-column,
  .choice-grid.two,
  .calculated-row {
    grid-template-columns: 1fr;
  }

  .tag-editor {
    grid-template-columns: 1fr;
  }

  .tag-list {
    grid-column: auto;
  }

  .report-toolbar,
  .report-header,
  .report-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions .button,
  .appendix-toggle {
    width: 100%;
  }

  .report-generated {
    text-align: left;
  }

  .report-profile {
    grid-template-columns: repeat(2, 1fr);
  }

  .report-section,
  .report-header,
  .report-profile,
  .summary-banner,
  .report-footer {
    padding-left: 21px;
    padding-right: 21px;
  }

  .report-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .report-row .cost {
    text-align: left;
  }

  .step-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-left: -20px;
    margin-right: -20px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.96);
  }

  .step-title-row {
    align-items: center;
  }

  .step-help-button {
    width: 34px;
    height: 34px;
  }

  .help-modal-layer {
    padding: 12px;
    place-items: center;
  }

  .help-modal {
    width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: 20px;
  }

  .help-modal-header {
    padding: 22px 20px 17px;
  }

  .help-modal-header h2 {
    font-size: 26px;
  }

  .help-modal-body {
    max-height: calc(100vh - 145px);
    padding: 20px;
  }
}

@page {
  size: Letter;
  margin: 0.25in;
}

@media print {
  body {
    background: #fff;
  }

  .builder-header,
  .profile-strip,
  .progress-card,
  .report-toolbar,
  .step-actions,
  .step-help-button,
  .help-modal-layer {
    display: none !important;
  }

  .builder-screen,
  .builder-layout,
  .content-card {
    width: 100%;
    margin: 0;
    padding: 0;
    display: block;
    border: 0;
    box-shadow: none;
  }

  .step {
    display: none !important;
  }

  .step[data-step="4"] {
    display: block !important;
  }

  .report {
    border: 0;
    border-radius: 0;
  }

  .print-summary {
    break-after: page;
  }

  .report-header {
    padding: 18px 22px;
  }

  .report-header h2 {
    font-size: 25px;
  }

  .report-profile {
    padding: 11px 22px;
  }

  .summary-banner {
    padding: 10px 22px;
  }

  .summary-banner div {
    padding: 8px;
  }

  .summary-banner strong {
    font-size: 15px;
  }

  .report-section {
    padding: 10px 22px;
  }

  .report-section-heading {
    margin-bottom: 8px;
  }

  .position-grid div {
    padding: 7px;
  }

  .report-row {
    min-height: 0;
    padding: 4px 0;
  }

  .report-row strong,
  .position-grid strong {
    font-size: 8.5px;
  }

  .report-row span,
  .summary-item,
  .report-section-heading p {
    font-size: 7.5px;
  }

  .report-section-heading h3,
  .mini-heading h3 {
    font-size: 12px;
  }

  .summary-item {
    padding: 5px 7px;
  }

  .cost-snapshot {
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .cost-snapshot strong {
    font-size: 17px;
  }

  .report-footer {
    padding: 8px 22px;
  }

  .matrix-appendix {
    break-before: page;
  }

  .matrix-appendix.hidden {
    display: none !important;
  }

  .matrix-table {
    font-size: 9px;
  }

  .matrix-table th,
  .matrix-table td {
    padding: 6px;
  }
}

/* =========================================================
   FINAL HELP MODAL SIZE + POSITION CORRECTION
   ========================================================= */

.help-modal-layer {
  padding: 24px !important;
  display: grid !important;
  place-items: center !important;
  overflow-y: auto !important;
}

.help-modal {
  width: min(680px, calc(100vw - 48px)) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: min(720px, calc(100vh - 48px)) !important;
  margin: auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.help-modal-header {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 0 !important;
}

.help-modal-body {
  flex: 0 1 auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100vh - 220px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
}

.help-modal-body > :first-child {
  margin-top: 0 !important;
}

.help-modal-body > :last-child {
  margin-bottom: 0 !important;
}

@media (max-width: 720px) {
  .help-modal-layer {
    padding: 14px !important;
  }

  .help-modal {
    width: min(100%, 620px) !important;
    max-height: calc(100vh - 28px) !important;
    border-radius: 18px !important;
  }

  .help-modal-body {
    max-height: calc(100vh - 175px) !important;
  }
}


/* =========================================================
   FINAL LIFETIME MATRIX COLUMN ALIGNMENT
   ========================================================= */

.matrix-table {
  table-layout: fixed;
}

.matrix-table th:nth-child(1),
.matrix-table td:nth-child(1) {
  width: 31%;
  text-align: left;
  white-space: normal;
}

.matrix-table th:nth-child(2),
.matrix-table td:nth-child(2) {
  width: 23%;
  text-align: left;
  white-space: normal;
}

.matrix-table th:nth-child(3),
.matrix-table td:nth-child(3) {
  width: 20%;
  text-align: left;
  white-space: normal;
}

.matrix-table th:nth-child(4),
.matrix-table td:nth-child(4) {
  width: 13%;
  text-align: right;
  white-space: nowrap;
}

.matrix-table th:nth-child(5),
.matrix-table td:nth-child(5) {
  width: 13%;
  text-align: right;
  white-space: nowrap;
}


/* =========================================================
   FINAL TWO-PAGE PRINT LAYOUT
   ========================================================= */

@media print {
  .print-summary {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  .report-header {
    padding: 14px 20px !important;
  }

  .report-header h2 {
    margin-bottom: 4px !important;
    font-size: 22px !important;
  }

  .report-profile {
    padding: 8px 20px !important;
    gap: 10px !important;
  }

  .summary-banner {
    padding: 7px 20px !important;
    gap: 8px !important;
  }

  .summary-banner div {
    padding: 6px 8px !important;
  }

  .summary-banner strong {
    font-size: 14px !important;
  }

  .report-section,
  .compact-report-section {
    padding: 7px 20px !important;
  }

  .report-section-heading {
    margin-bottom: 5px !important;
  }

  .report-row {
    padding: 2px 0 !important;
  }

  .position-grid div {
    padding: 5px 7px !important;
  }

  .summary-item {
    padding: 3px 6px !important;
  }

  .cost-snapshot {
    padding: 6px 20px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .cost-snapshot strong {
    font-size: 15px !important;
  }

  .cost-snapshot p {
    margin: 0 !important;
    font-size: 6.8px !important;
    line-height: 1.25 !important;
  }

  .report-footer {
    padding: 5px 20px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .report-footer p,
  .report-footer strong {
    margin: 0 !important;
    font-size: 6.5px !important;
    line-height: 1.25 !important;
  }

  .matrix-appendix {
    break-before: page !important;
    page-break-before: always !important;
    padding: 22px 24px !important;
    border-top: 0 !important;
  }

  .appendix-heading {
    margin-bottom: 15px !important;
  }

  .appendix-heading h2 {
    font-size: 24px !important;
  }

  .matrix-table {
    table-layout: fixed !important;
    font-size: 8px !important;
  }

  .matrix-table th,
  .matrix-table td {
    padding: 4px 5px !important;
  }

  .matrix-table thead th {
    font-size: 7px !important;
  }

  .matrix-table tfoot th {
    font-size: 8.5px !important;
  }
}


/* =========================================================
   HARD MODAL CONTENT-HEIGHT FALLBACK
   ========================================================= */

html body .help-modal-layer {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

html body .help-modal-layer .help-modal {
  height: fit-content !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 48px) !important;
}

html body .help-modal-layer .help-modal-header,
html body .help-modal-layer .help-modal-body,
html body .help-modal-layer .help-modal-body > * {
  height: auto !important;
  min-height: 0 !important;
}

html body .help-modal-layer .help-modal-body {
  flex: 0 1 auto !important;
  max-height: calc(100dvh - 210px) !important;
  overflow-y: auto !important;
}

@media (max-width: 720px) {
  html body .help-modal-layer {
    padding: 14px !important;
  }

  html body .help-modal-layer .help-modal {
    width: calc(100vw - 28px) !important;
    max-height: calc(100dvh - 28px) !important;
  }

  html body .help-modal-layer .help-modal-body {
    max-height: calc(100dvh - 175px) !important;
  }
}



/* =========================================================
   REPORT COVERAGE + COST CLARITY
   ========================================================= */

.report-profile {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.summary-banner strong {
  line-height: 1.08;
}

.cost-snapshot p[data-cost-coverage-note] {
  line-height: 1.5;
}

@media (max-width: 1050px) {
  .report-profile {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .report-profile {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  .report-profile {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: 5px !important;
  }

  .report-profile span {
    font-size: 6.5px !important;
  }

  .report-profile strong {
    font-size: 8px !important;
    line-height: 1.15 !important;
  }

  .summary-banner strong {
    font-size: 12px !important;
    line-height: 1.08 !important;
  }

  .cost-snapshot p[data-cost-coverage-note] {
    font-size: 6.4px !important;
    line-height: 1.25 !important;
  }
}



/* =========================================================
   PRICING ENGINE OUTPUT
   ========================================================= */

.cost-snapshot small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.report-row .cost small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

@media print {
  .cost-snapshot small {
    margin-top: 2px !important;
    font-size: 6.2px !important;
    line-height: 1.15 !important;
  }

  .report-row .cost small {
    margin-top: 1px !important;
    font-size: 5.8px !important;
    line-height: 1.1 !important;
  }
}
