:root {
  --ink: #172033;
  --muted: #5f6979;
  --line: #d7dbe2;
  --background: #f2f0eb;
  --paper: #ffffff;
  --brand: #173b70;
  --brand-strong: #102d65;
  --gold: #b78632;
  --cream: #f7f0d9;
  --ok: #166a42;
  --danger: #9c2f28;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --space-element: 24px;
  --space-group: 64px;
  --space-section: 112px;
}

* { box-sizing: border-box; }

html { background: var(--background); }

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  min-height: 64px;
  padding: 0 max(20px, calc((100vw - 1040px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-weight: 850;
  letter-spacing: .14em;
  color: var(--brand);
  font-size: 13px;
}

.client-code,
.topbar-note,
.lawyer-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.shell {
  width: min(1040px, calc(100% - 28px));
  margin: 0 auto;
  padding: 36px 0 var(--space-group);
}

.intake-shell { max-width: 760px; }

.hero {
  max-width: 820px;
  padding: 24px 4px 38px;
}

.intake-hero { padding-top: 54px; }

.eyebrow {
  text-transform: uppercase;
  color: var(--brand);
  font-size: 12px;
  letter-spacing: .12em;
  font-weight: 850;
}

.hero h1 {
  max-width: 900px;
  margin: 12px 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -.035em;
}

.hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
}

.paper-card {
  margin-bottom: 24px;
  padding: clamp(22px, 4vw, 38px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 3px 14px rgba(23, 32, 51, .045);
}

.step-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 28px;
}

.step-title > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--brand);
  border-radius: var(--radius-full);
  color: white;
  font-weight: 850;
}

.step-title h2 {
  margin: 2px 0 3px;
  font-size: 23px;
  line-height: 1.2;
}

.step-title p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

label {
  color: #344054;
  font-size: 13px;
  font-weight: 750;
}

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

input {
  width: 100%;
  height: 48px;
  display: block;
  margin-top: 7px;
  padding: 0 13px;
  border: 1px solid #c6ccd5;
  border-radius: var(--radius-md);
  background: white;
  color: var(--ink);
  font: inherit;
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(23, 59, 112, .22);
  outline-offset: 2px;
}

input:focus { border-color: var(--brand); }

.official-preview {
  position: relative;
  overflow: hidden;
  background: var(--cream);
  border: 1px solid #d0c8ad;
  border-radius: var(--radius-sm);
}

.official-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.preview-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 8px 11px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid #c9c1a7;
  border-radius: var(--radius-sm);
  color: #4e401f;
  font-size: 12px;
  font-weight: 800;
}

.legal-details {
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.legal-details summary {
  padding: 18px 0 0;
  color: var(--brand);
  cursor: pointer;
  font-weight: 800;
}

.document {
  max-height: 360px;
  overflow: auto;
  margin-top: 14px;
  padding: 20px;
  white-space: pre-wrap;
  background: #faf9f6;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
}

.warning {
  margin-top: 16px;
  padding: 14px;
  background: #fff3dc;
  border: 1px solid #e3c688;
  border-radius: var(--radius-sm);
  color: #684700;
  font-weight: 750;
}

.signature-wrap {
  height: 210px;
  overflow: hidden;
  background: #fff;
  border: 2px dashed #7c8798;
  border-radius: var(--radius-md);
}

.signature-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.link-button {
  padding: 13px 0;
  border: 0;
  background: none;
  color: var(--brand);
  cursor: pointer;
  font-weight: 800;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 18px 0 22px;
  font-size: 14px;
  line-height: 1.45;
}

.consent input {
  width: 22px;
  height: 22px;
  margin: 0;
  flex: 0 0 auto;
}

.primary {
  width: 100%;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-size: 16px;
  font-weight: 850;
  text-decoration: none;
}

.primary:hover { background: var(--brand-strong); }

.primary:disabled {
  background: #7d8797;
  color: white;
  cursor: not-allowed;
}

.anchor-button { margin-top: 20px; }

.status {
  min-height: 24px;
  margin-bottom: 0;
  color: var(--danger);
  font-weight: 750;
}

.center {
  padding-block: 54px;
  text-align: center;
}

.center h1 {
  margin: 16px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 500;
  line-height: 1.08;
}

.center p { color: var(--muted); }

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: var(--radius-full);
  animation: spin .8s linear infinite;
}

.success-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: var(--radius-full);
  background: #e4f2ea;
  color: var(--ok);
  font-size: 34px;
  font-weight: 900;
}

.result-code {
  display: inline-block;
  margin: 12px 0;
  padding: 8px 12px;
  border: 1px solid #bfc7d2;
  border-radius: var(--radius-sm);
  background: #f8f9fb;
  color: var(--brand);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
}

.center code {
  display: block;
  margin-top: 20px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(320px, .82fr) minmax(300px, 1.18fr);
  gap: 40px;
  align-items: start;
}

.review-document { position: sticky; top: 88px; }

.review-data h2 {
  margin: 8px 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 500;
}

.field-list {
  display: grid;
  grid-template-columns: minmax(110px, .7fr) 1.3fr;
  margin: 0;
  border-top: 1px solid var(--line);
}

.field-list dt,
.field-list dd {
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.field-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.field-list dd {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.client-signature-block {
  margin-top: 28px;
  padding: 16px;
  background: #faf9f6;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.client-signature-block > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.client-signature-block img {
  width: 100%;
  height: 110px;
  display: block;
  object-fit: contain;
}

.client-signature-block small { color: var(--muted); }

.lawyer-signature { margin-top: 22px; }

.hidden { display: none !important; }

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

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1040px);
    padding-top: 20px;
  }

  .intake-hero { padding-top: 28px; }

  .hero h1 { font-size: 40px; }

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

  .wide { grid-column: auto; }

  .paper-card {
    padding: 21px;
    border-radius: var(--radius-md);
  }

  .topbar { padding: 0 14px; }

  .signature-wrap { height: 190px; }

  .review-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .review-document { position: static; }

  .field-list { grid-template-columns: 105px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .spinner { animation-duration: 1.8s; }
}
