:root {
  --navy-950: #101c2a;
  --navy-900: #182838;
  --navy-700: #42576b;
  --cream-100: #fbf6ec;
  --cream-200: #f4ecda;
  --sun-500: #f6a400;
  --orange: #e86808;
  --mint-200: #c9dddd;
  --gradient-sun: linear-gradient(90deg, #f8b818 0%, #f28a05 48%, #e86808 100%);
  color-scheme: light;
  font-family: Inter, Avenir Next, Helvetica Neue, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream-100);
  color: var(--navy-900);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  padding: 12px 16px;
  background: var(--gradient-sun);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  border: 1px solid rgba(24, 40, 56, 0.18);
  background: #fff;
  color: var(--navy-900);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.center-shell,
.sign-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.intro-panel,
.sign-panel {
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 22px 70px rgba(16, 28, 42, 0.12);
}

.intro-panel {
  padding: 42px;
}

.portal-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  padding: 26px 30px 24px;
  background:
    radial-gradient(circle at 12% 8%, rgba(248, 184, 24, 0.2), transparent 30%),
    linear-gradient(135deg, var(--navy-900), var(--navy-950));
  color: var(--cream-100);
  border-bottom: 7px solid var(--orange);
}

.brand-mark {
  color: var(--sun-500);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 8px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  line-height: 1;
}

.portal-header p {
  margin-top: 10px;
  color: var(--mint-200);
  font-weight: 650;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(232, 104, 8, 0.75);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--cream-100);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.document-frame {
  padding: 20px 20px 0;
  background: var(--cream-200);
  contain: layout paint style;
}

.document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--navy-700);
  font-size: 13px;
  font-weight: 750;
}

.document-toolbar a {
  flex: 0 0 auto;
  color: var(--orange);
  font-weight: 900;
  text-decoration: none;
}

.pdf-viewer {
  display: grid;
  gap: 14px;
  max-width: 920px;
  margin: 0 auto;
}

.pdf-page {
  display: grid;
  place-items: center;
  min-height: var(--page-height, 320px);
  border: 1px solid rgba(24, 40, 56, 0.13);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 28, 42, 0.08);
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: var(--page-height, 720px);
  contain: layout paint style;
}

.pdf-page[hidden] {
  display: none;
}

.pdf-page-cropped {
  align-items: start;
  border-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: none;
}

.pdf-page canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pdf-page span {
  color: var(--navy-700);
  font-size: 13px;
  font-weight: 750;
}

.document-frame iframe {
  display: block;
  width: 100%;
  height: min(72vh, 780px);
  border: 1px solid rgba(24, 40, 56, 0.16);
  border-radius: 6px;
  background: #fff;
  contain: strict;
}

.sign-card {
  display: grid;
  gap: 16px;
  padding: 24px 30px 30px;
}

.signer-copy {
  display: grid;
  gap: 6px;
}

.signer-copy p,
.status-text {
  color: var(--navy-700);
  font-weight: 600;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--navy-700);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  border: 1px solid rgba(24, 40, 56, 0.18);
  border-radius: 6px;
  padding: 12px;
  color: var(--navy-900);
  font-size: 18px;
  font-weight: 650;
  text-transform: none;
}

.consent-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--navy-700);
  font-size: 14px;
  font-weight: 650;
}

.signature-box {
  border: 1.5px solid rgba(232, 104, 8, 0.65);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.55)),
    var(--cream-100);
}

canvas {
  display: block;
  width: 100%;
  height: 210px;
  touch-action: none;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .portal-header {
    display: grid;
  }

  .document-frame {
    padding: 12px 12px 0;
  }

  .document-toolbar {
    align-items: start;
    display: grid;
  }

  .document-frame iframe {
    height: 62vh;
  }

  .sign-card {
    padding: 20px;
  }
}
