@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("assets/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #202d27;
  --muted: #4e5d53;
  --forest: #243d33;
  --forest-light: #375745;
  --paper: #fffefa;
  --canvas: #f5f5ef;
  --line: #dce2d8;
  --sage: #edf2e8;
  --cream: #f4ead4;
  --red: #79372e;
  --radius: 20px;
  --shadow: 0 6px 22px rgb(24 51 34 / .045);
  font-family: "DM Sans", system-ui, sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; }
a { color: var(--forest); text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .67; }
:focus-visible { outline: 3px solid #735926; outline-offset: 3px; }
main:focus, .step-heading h2:focus, #successTitle:focus { outline: none; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.14; }
h1 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: clamp(2.7rem, 5.1vw, 4.5rem); }
h2, h3, h4 { color: var(--forest); }
img { display: block; max-width: 100%; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 10;
  padding: 10px 14px;
  transform: translateY(-150%);
  border: 0;
  border-radius: 8px;
  background: var(--paper);
  color: var(--forest);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  color: var(--forest);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1160px;
  min-height: 66px;
  padding: 0 24px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  white-space: nowrap;
  font-size: 1.125rem;
  font-weight: 680;
  letter-spacing: -.04em;
}
.brand-lockup img { flex: none; border-radius: 50%; width: 42px; height: 42px; object-fit: cover; }
.brand-lockup strong { color: var(--forest-light); font-weight: 760; }
.portal-nav { display: flex; align-items: center; gap: 22px; font-size: .875rem; font-weight: 660; }
.portal-nav a { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; }
.portal-nav a:hover { text-decoration: underline; }
.provider-link { padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--sage); }

.shell { flex: 1; width: min(calc(100% - 48px), 1112px); margin: 34px auto 64px; }
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: clamp(25px, 5.2vw, 47px);
  margin-bottom: 24px;
  border-radius: 24px;
  color: #fffcf0;
  background: linear-gradient(110deg, #21392f, #345644);
}
.page-heading h1 { margin: 4px 0 10px; }
.eyebrow { color: var(--forest-light); font-size: .78rem; font-weight: 770; letter-spacing: .09em; text-transform: uppercase; }
.page-heading .eyebrow { color: #f2e5bf; }
.page-lead { max-width: 56ch; color: #f0f1e4; }
.page-heading .secondary-btn { flex-shrink: 0; border-color: var(--paper); }

.primary-btn, .secondary-btn, .text-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 730;
  line-height: 1.25;
}
.primary-btn { background: var(--forest); color: #fffefa; }
.primary-btn:hover:not(:disabled) { background: var(--forest-light); }
.secondary-btn { background: var(--paper); border-color: #c4d0c1; color: var(--forest); }
.secondary-btn:hover:not(:disabled) { background: var(--sage); }
.text-button { padding-inline: 0; background: transparent; color: var(--forest); text-decoration: underline; text-underline-offset: .19em; }
.text-button:hover:not(:disabled) { color: #4f6a49; }
.text-link { display: inline-block; font-weight: 730; line-height: 1.4; }
.portal-actions { display: flex; flex-wrap: wrap; gap: 9px 12px; align-items: center; }
.status-banner {
  display: none;
  padding: 13px 17px;
  margin-bottom: 18px;
  border: 1px solid #cbd8c6;
  border-radius: 12px;
  background: var(--sage);
  color: var(--forest);
  scroll-margin-top: 83px;
}
.status-banner.show { display: block; }
.status-banner.error, .validation-note { border-color: #e0bdb1; background: #f9eeea; color: var(--red); }
.portal-panel, .sign-in-panel, .success-panel {
  max-width: 100%;
  padding: clamp(22px, 4vw, 35px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.portal-panel h1, .sign-in-panel h1, .success-panel h1 { color: var(--forest); font-size: clamp(2.65rem, 5vw, 3.7rem); }
.portal-panel p, .sign-in-panel p:not(.eyebrow), .success-panel p { color: var(--muted); }
.portal-panel-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; }
.portal-panel-header p { margin-top: 8px; }
.draft-panel { margin: 0 0 23px; }
.draft-panel #backToList { margin-top: -10px; }
.staff-list { margin-top: 24px; border-top: 1px solid var(--line); }
.staff-list:only-child { border-top: 0; }
.agreement-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-block: 13px; }
.agreement-row + .agreement-row { border-top: 1px solid var(--line); }
.agreement-row strong { overflow-wrap: anywhere; }
.agreement-row p { margin: 3px 0 0; font-size: .86rem; }
.share-panel {
  margin-top: 19px;
  padding: 17px 18px 11px;
  border: 1px solid #cbd8c6;
  border-radius: 14px;
  background: var(--sage);
}
.share-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.share-heading h2 { font-size: 1.23rem; }
.share-heading p { font-size: .88rem; margin: 4px 0 0; }
#shareLink { margin: 12px 0 0; min-width: 0; }
.link-controls { gap: 18px; }
.link-controls .text-button { font-size: .81rem; }
.sign-in-panel { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 22px; padding: 12px; }
.sign-in-main { padding: clamp(14px, 4vw, 36px); }
.sign-in-main h1 { margin-top: 3px; }
.sign-in-main > p:not(.eyebrow) { margin-block: 12px 19px; max-width: 42ch; overflow-wrap: anywhere; }
.sign-in-aside { display: flex; align-items: flex-start; justify-content: center; flex-direction: column; padding: clamp(20px, 3vw, 32px); border-radius: 13px; background: var(--sage); }
.sign-in-aside h2 { font-size: 1.32rem; }
.sign-in-aside p { margin-block: 9px 13px; }
.code-form { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.code-controls { display: flex; align-items: flex-end; gap: 8px; }
.code-controls input { max-width: 190px; font-variant-numeric: tabular-nums; letter-spacing: .16em; }
.code-controls button { flex: none; }
.success-panel { max-width: 675px; margin: 0 auto; }
.success-panel p { margin-block: 12px 21px; }
.success-icon { display: grid; place-items: center; margin-bottom: 10px; width: 47px; height: 47px; border-radius: 50%; background: var(--sage); color: var(--forest); font-size: 1.3rem; }

.agreement-workspace { display: grid; grid-template-columns: 226px minmax(0, 1fr); gap: 24px; align-items: start; scroll-margin-top: 84px; }
.workflow-rail { position: sticky; top: 88px; display: grid; gap: 12px; }
.workflow-nav { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 15px; box-shadow: var(--shadow); }
.step-progress { display: grid; gap: 6px; color: var(--muted); font-size: .81rem; font-weight: 680; padding: 0 4px 11px; }
#stepMeter { appearance: none; display: block; width: 100%; height: 5px; overflow: hidden; border: 0; border-radius: 4px; background: #e1e6dc; color: var(--forest-light); }
#stepMeter::-webkit-progress-bar { background: #e1e6dc; }
#stepMeter::-webkit-progress-value { background: var(--forest-light); border-radius: 4px; }
#stepMeter::-moz-progress-bar { background: var(--forest-light); border-radius: 4px; }
.step-list { display: grid; gap: 3px; }
.step-list button {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  text-align: left;
  font-size: .87rem;
  font-weight: 650;
  line-height: 1.2;
}
.step-list button:hover { background: #f1f4ed; }
.step-list button[aria-current="step"] { background: var(--sage); border-color: #d9e4d5; color: var(--forest); font-weight: 760; }
.step-dot { flex: none; width: 11px; height: 11px; border: 1.5px solid #869687; border-radius: 50%; }
[aria-current="step"] .step-dot { border-color: var(--forest-light); box-shadow: inset 0 0 0 2px var(--sage); background: var(--forest-light); }
.rail-help { display: grid; gap: 3px; padding: 11px 16px; color: var(--muted); font-size: .84rem; }
.rail-help strong { color: var(--ink); }
.rail-help a { width: fit-content; min-height: 26px; }
.workflow-main, .step-panel, .field-grid, .review-card { min-width: 0; }
.step-panel { display: grid; gap: 16px; }
.step-heading { padding: 3px 1px 0; }
.step-heading h2 { font-size: clamp(1.55rem, 3.5vw, 2rem); letter-spacing: -.043em; scroll-margin-top: 86px; }
.step-heading p { margin-top: 7px; color: var(--muted); font-size: .925rem; }
.validation-note { padding: 10px 13px; border: 1px solid #e0bdb1; border-radius: 10px; font-weight: 660; }
.doc-section, .review-card {
  padding: clamp(17px, 3.2vw, 27px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.doc-section h3 { font-size: 1.22rem; letter-spacing: -.03em; }
.doc-section h4 { margin: 19px 0 10px; font-size: .96rem; }
.doc-section p, .doc-section ul { margin-block: 10px; color: var(--muted); }
.doc-section ul { padding-left: 22px; }
.doc-section li + li { margin-top: 4px; }
.doc-section > :last-child { margin-bottom: 0; }
.parties-note { color: var(--forest); background: #f0f3ec; border-radius: 8px; padding: 8px 11px; }
.parties-note summary { font-size: .88rem; font-weight: 710; cursor: pointer; }
.parties-note p { margin-bottom: 2px; }

.field-grid { display: grid; gap: 13px 16px; margin-block: 12px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
label, legend { color: var(--ink); font-size: .9rem; font-weight: 660; }
label { display: block; min-width: 0; }
label > span { color: #8b542c; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  min-width: 0;
  margin-top: 5px;
  padding: 9px 11px;
  border: 1px solid #bfcbbd;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-size: 1rem;
}
textarea { min-height: 82px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--forest-light); }
input:read-only { background-color: #f7f9f5; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; flex: none; margin: 0; accent-color: var(--forest-light); }
.invalid, input.invalid { border-color: var(--red) !important; outline: 2px solid #9e5346; outline-offset: 1px; }
.choice-row, .choice-list, .scope-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 9px;
  margin-block: 8px 13px;
}
.choice-list, .scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-row label, .choice-list label, .scope-grid label, .consent-group label, .inline-check, .declaration {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f9f4;
  line-height: 1.4;
  cursor: pointer;
}
.inline-check { margin-top: 13px; }
.choice-row label:has(:checked), .choice-list label:has(:checked), .scope-grid label:has(:checked),
.consent-group label:has(:checked), .inline-check:has(:checked), .declaration:has(:checked) { background: var(--sage); border-color: #bccdb7; }
.info-table, .schedule-table { margin: 10px 0 15px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.info-table > div { display: grid; grid-template-columns: minmax(92px, .37fr) minmax(0, 1fr); }
.info-table > div + div { border-top: 1px solid var(--line); }
.info-table > div > *, .schedule-table > div { padding: 7px 9px; font-size: .875rem; overflow-wrap: anywhere; }
.info-table b, .schedule-table > div:nth-child(odd) { background: #f0f3ec; }
.schedule-table { display: grid; grid-template-columns: minmax(100px, .56fr) minmax(0, 1fr); }
.schedule-table > div:nth-child(n+3) { border-top: 1px solid var(--line); }
.schedule-head { font-weight: 730; background: #f0f3ec; }
.live-value:empty::after { content: "—"; color: var(--muted); }

.terms-library { display: grid; gap: 7px; border: 1px solid var(--line); padding: 15px; border-radius: 16px; background: var(--paper); }
.terms-intro { padding: 3px 4px 11px; color: var(--muted); }
.support-code { color: var(--forest); font-weight: 730; font-size: .87rem; }
.purpose-box { margin-top: 8px; }
.purpose-box p { margin-top: 2px; }
.terms-item { border: 1px solid var(--line); border-radius: 10px; background: #f7f8f2; }
.terms-item summary { display: flex; justify-content: space-between; gap: 8px; padding: 12px; color: var(--forest); font-weight: 720; cursor: pointer; list-style: none; }
.terms-item summary::-webkit-details-marker { display: none; }
.terms-item summary::after { content: '+'; flex: none; font-size: 1.15rem; line-height: 1.1; }
.terms-item[open] summary::after { content: '−'; }
.terms-body { padding: 0 13px 2px; }
.terms-body .doc-section { padding: 12px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
.terms-body .doc-section h3 { font-size: 1rem; letter-spacing: -.01em; }
.highlight-box, .warning-box { padding: 10px 12px; margin: 9px 0; border-radius: 8px; background: var(--sage); color: var(--forest); }
.warning-box { background: var(--cream); color: #643f1e; }
.highlight-box > p, .warning-box > p { margin: 4px 0 0; color: inherit; }
.consent-group { display: grid; gap: 12px; }
.consent-group fieldset { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 11px 11px; margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 10px; }
.consent-group legend { padding-inline: 3px; }
.consent-group label { min-width: 72px; }
.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.review-heading { display: flex; justify-content: space-between; align-items: center; gap: 5px 12px; flex-wrap: wrap; }
.review-heading h3 { font-size: 1.12rem; }
.review-heading button { min-height: 34px; }
.review-card dl { margin: 1px 0 0; }
.review-card dl > div { border-top: 1px solid var(--line); padding: 6px 0; }
.review-card dt { color: var(--muted); font-size: .79rem; }
.review-card dd { margin: 0; overflow-wrap: anywhere; font-weight: 690; }
.review-card .missing-value { color: #78532e; font-weight: 580; }
.review-tools { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; }
.declaration-card { display: grid; gap: 8px; margin: 14px 0; }
.declaration { align-items: flex-start; }
.declaration input { margin-top: 2px; }
.signature-card { margin: 12px 0; padding: 13px; background: var(--sage); border: 1px solid var(--line); border-radius: 12px; }
.signature-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.signature-heading span { display: block; color: var(--muted); font-size: .85rem; }
#signatureCanvas {
  display: block;
  width: 100%;
  height: 135px;
  border: 1px dashed #879687;
  border-radius: 8px;
  background: linear-gradient(to bottom, #fff 78%, #dfebe0 79%, #fff 80%);
  touch-action: none;
  cursor: crosshair;
}
.provider-signoff h4 { margin-bottom: 5px; }
.provider-signoff p { margin: 3px 0; font-size: .875rem; }

.workflow-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding-top: 12px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.workflow-primary { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px 12px; margin-left: auto; }
.progress-note { margin-top: 7px; text-align: right; color: var(--forest); font-size: .9rem; }
.staff-mode [data-client-only], .staff-mode .client-only-note { display: none !important; }
.bot-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.site-footer {
  width: min(calc(100% - 48px), 1112px);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 15px 0 22px;
  border-top: 1px solid var(--line);
  margin: auto auto 0;
  color: var(--muted);
  font-size: .85rem;
}
.site-footer div { display: flex; gap: 16px; }

@media (max-width: 770px) {
  .topbar-inner { min-height: 58px; padding-inline: 15px; }
  .brand-lockup img { width: 36px; height: 36px; }
  .portal-nav { gap: 11px; }
  .home-link { display: none !important; }
  .shell { width: calc(100% - 30px); margin-top: 16px; }
  .page-heading { margin-bottom: 13px; border-radius: 17px; }
  .agreement-workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; scroll-margin-top: 67px; }
  .workflow-rail { position: static; }
  .workflow-nav { padding: 10px 9px; }
  .step-progress { grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 7px 10px; padding: 0 2px 8px; }
  .step-list { display: flex; }
  .step-list button { flex: 1 1 0; width: auto; padding: 6px 3px; gap: 3px; justify-content: center; text-align: center; }
  .step-dot, .rail-help { display: none; }
  .step-heading h2 { scroll-margin-top: 72px; }
  .site-footer { width: calc(100% - 30px); }
}

@media (max-width: 530px) {
  .page-heading { align-items: flex-start; flex-direction: column; gap: 13px; padding: 21px 18px; }
  .page-heading h1 { margin-top: 4px; font-size: clamp(2.13rem, 9vw, 2.9rem); letter-spacing: -.026em; }
  .page-heading p { font-size: .88rem; }
  .page-heading .eyebrow { font-size: .7rem; }
  .portal-nav { font-size: .77rem; }
  .provider-link { min-height: 36px !important; padding-inline: 8px; }
  .brand-lockup { font-size: 1.02rem; }
  .step-list button { font-size: .74rem; min-height: 42px; }
  .step-panel { gap: 11px; }
  .step-heading p { font-size: .86rem; }
  .sign-in-panel, .two-col, .three-col, .review-grid, .choice-list, .scope-grid { grid-template-columns: minmax(0, 1fr); }
  .sign-in-panel { gap: 8px; }
  .sign-in-aside { padding: 16px; }
  .portal-panel-header .portal-actions { width: 100%; }
  .share-panel { padding-inline: 12px; }
  .doc-section h3 { font-size: 1.13rem; }
  .workflow-actions { align-items: flex-start; }
  .workflow-primary { gap: 6px 9px; }
  .primary-btn, .secondary-btn { padding-inline: 12px; }
}
