:root {
  --ink: #182238;
  --muted: #68758a;
  --navy: #172c4f;
  --teal: #147d78;
  --teal-dark: #0d625f;
  --cream: #f6f3ed;
  --paper: #ffffff;
  --line: #dfe5eb;
  --error: #b42318;
  --shadow: 0 18px 55px rgba(23, 44, 79, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 6%, rgba(20, 125, 120, .08), transparent 28rem),
    var(--cream);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { color: var(--navy); display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: white; background: var(--teal); }
.secure-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.secure-label span { width: 8px; height: 8px; border-radius: 50%; background: #26a269; box-shadow: 0 0 0 4px rgba(38, 162, 105, .12); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero { max-width: 820px; padding: 58px 0 42px; }
.eyebrow { color: var(--teal-dark); text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 700; margin-bottom: 12px; }
h1, h2 { font-family: "Playfair Display", Georgia, serif; color: var(--navy); margin-top: 0; }
.hero h1 { font-size: clamp(38px, 6vw, 66px); line-height: 1.04; letter-spacing: -.035em; margin-bottom: 18px; }
.hero > p { color: var(--muted); font-size: 18px; max-width: 670px; margin-bottom: 24px; }
.document-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.document-meta span, .pill { padding: 6px 11px; background: rgba(255,255,255,.75); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; font-size: 12px; font-weight: 600; }

.page-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr); align-items: start; gap: 26px; padding-bottom: 70px; }
.document-card, .form-card { background: var(--paper); border: 1px solid rgba(23,44,79,.08); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.document-card { padding: 34px; }
.form-card { padding: 34px; position: sticky; top: 20px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.card-heading > div { display: flex; align-items: center; gap: 13px; }
.card-heading h2 { font-size: 24px; margin-bottom: 0; }
.step { width: 36px; height: 36px; display: grid; place-items: center; flex: none; border-radius: 50%; background: #e8f5f3; color: var(--teal-dark); font-size: 12px; font-weight: 700; }
.pill { color: var(--teal-dark); background: #e8f5f3; border-color: transparent; }
.document-copy { padding: 28px 2px 14px; font-family: Georgia, serif; color: #2d394d; font-size: 16px; }
.document-copy p { margin: 0 0 18px; }
.review-note { display: flex; gap: 12px; padding: 15px 16px; border-radius: 12px; background: #f3f8f8; color: #46615f; font-size: 13px; }
.review-note > span { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: white; font-weight: 700; }
.review-note p { margin: 0; }

form { padding-top: 26px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field-wide { grid-column: 1 / -1; }
.field label, .signature-label-row label { display: block; color: #344054; font-size: 13px; font-weight: 700; margin: 0 0 7px; }
.field input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #cfd7e3; border-radius: 10px; background: #fbfcfd; color: var(--ink); font: inherit; outline: none; transition: .18s ease; }
.field input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20,125,120,.12); background: white; }
.field-error { display: block; margin-top: 6px; color: var(--error); font-size: 12px; font-weight: 600; }
.signature-section { margin-top: 22px; }
.signature-label-row { display: flex; align-items: center; justify-content: space-between; }
.clear-button { padding: 4px 2px; border: 0; color: var(--teal-dark); background: transparent; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.canvas-wrap { position: relative; height: 164px; background: #fbfcfd; border: 1px dashed #aeb9c8; border-radius: 12px; overflow: hidden; }
#signature-pad { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; outline: none; }
#signature-pad.invalid { border: 2px solid var(--error); }
.sign-line-label { position: absolute; left: 28px; right: 28px; bottom: 20px; padding-top: 4px; border-top: 1px solid #cbd3dd; color: #98a2b3; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; pointer-events: none; }
.consent-row { display: flex; align-items: flex-start; gap: 11px; margin-top: 21px; color: #465468; font-size: 13px; cursor: pointer; }
.consent-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--teal); flex: none; }
.submit-button { width: 100%; min-height: 52px; margin-top: 22px; border: 0; border-radius: 11px; padding: 0 18px; display: flex; justify-content: space-between; align-items: center; color: white; background: var(--teal); font: inherit; font-weight: 700; cursor: pointer; transition: .18s ease; box-shadow: 0 10px 24px rgba(20,125,120,.22); }
.submit-button:hover { background: var(--teal-dark); transform: translateY(-1px); }
.privacy-note { color: #8792a3; text-align: center; font-size: 11px; line-height: 1.5; margin: 13px 12px 0; }
.error-summary { margin-top: 20px; padding: 12px; border-radius: 8px; color: var(--error); background: #fef3f2; font-size: 13px; }
footer { padding: 24px 20px 40px; color: #8994a4; text-align: center; font-size: 12px; }

.success-body { min-height: 100vh; display: grid; place-items: center; }
.success-shell { width: min(660px, calc(100% - 32px)); margin: 40px auto; }
.success-card { padding: clamp(28px, 7vw, 58px); background: white; border-radius: 24px; box-shadow: var(--shadow); text-align: center; }
.success-icon { width: 64px; height: 64px; margin: 0 auto 24px; display: grid; place-items: center; border-radius: 50%; background: #e8f5f3; color: var(--teal); font-size: 28px; font-weight: 700; }
.success-card h1 { font-size: clamp(34px, 7vw, 48px); margin-bottom: 10px; }
.success-card > p { color: var(--muted); }
.receipt { margin: 30px 0 18px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-align: left; }
.receipt div { display: grid; grid-template-columns: 110px 1fr; gap: 15px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.receipt div:last-child { border-bottom: 0; }
.receipt span { color: var(--muted); font-size: 12px; }
.receipt strong { font-size: 13px; overflow-wrap: anywhere; }
.receipt-note { font-size: 13px; }
.secondary-button { display: inline-block; margin-top: 14px; padding: 11px 18px; border: 1px solid var(--line); border-radius: 9px; color: var(--navy); text-decoration: none; font-size: 13px; font-weight: 700; }

@media (max-width: 900px) {
  .hero { padding-top: 35px; }
  .page-grid { grid-template-columns: 1fr; }
  .form-card { position: static; }
}

@media (max-width: 560px) {
  .site-header, main { width: min(100% - 24px, 1180px); }
  .site-header { min-height: 68px; }
  .secure-label { font-size: 0; }
  .hero { padding: 30px 4px; }
  .hero h1 { font-size: 39px; }
  .document-card, .form-card { padding: 23px 18px; border-radius: 17px; }
  .card-heading h2 { font-size: 21px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .canvas-wrap { height: 150px; }
  .receipt div { grid-template-columns: 1fr; gap: 2px; }
}
