:root {
  --ink: #1f2933;
  --ink-soft: #52606d;
  --line: #d9dee3;
  --line-soft: #e8ecef;
  --bg: #eef1f4;
  --card: #ffffff;
  --accent: #2f5d50;
  --accent-strong: #244a40;
  --danger: #b3261e;
  --ok: #2f5d50;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
}

.card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04), 0 12px 32px rgba(31, 41, 51, 0.07);
  overflow: hidden;
}

.card-head {
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 8px;
}

.card-head h1 {
  font-size: 22px;
  line-height: 1.25;
  margin: 0;
  font-weight: 650;
}

.card-body { padding: 24px 28px 28px; }

.intro {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.intro strong { color: var(--ink); font-weight: 650; }

.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 14px;
  margin-bottom: 26px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.doc-link:hover { border-color: var(--accent); background: #f5f8f6; }
.doc-link svg { flex: 0 0 auto; }

.field { margin-bottom: 18px; }

label.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--ink);
}

input[type="text"] {
  width: 100%;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 93, 80, 0.14);
}

.sign-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
}

.clear-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.clear-btn:hover { color: var(--ink); }

.pad-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 9px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(transparent, transparent 39px, var(--line-soft) 39px, var(--line-soft) 40px);
  overflow: hidden;
}

#signaturePad {
  display: block;
  width: 100%;
  height: 180px;
  touch-action: none;
  cursor: crosshair;
}

.pad-baseline {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 36px;
  border-bottom: 1px dashed var(--line);
  pointer-events: none;
}
.pad-hint {
  position: absolute;
  left: 16px;
  bottom: 12px;
  font-size: 12px;
  color: #9aa5b1;
  pointer-events: none;
}

.meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 20px 0 6px;
}

.error {
  display: none;
  font-size: 14px;
  color: var(--danger);
  background: #fcebea;
  border: 1px solid #f3c6c3;
  border-radius: 9px;
  padding: 10px 13px;
  margin-bottom: 16px;
}
.error.show { display: block; }

.submit-btn {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  margin-top: 18px;
  transition: background 0.15s ease;
}
.submit-btn:hover { background: var(--accent-strong); }
.submit-btn:disabled { opacity: 0.6; cursor: default; }

.confirm {
  display: none;
  text-align: center;
  padding: 44px 28px 48px;
}
.confirm.show { display: block; }
.confirm .check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e7f1ee;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.confirm .check.check-neutral { background: #eef1f4; }
.confirm h2 { margin: 0 0 8px; font-size: 20px; }
.confirm p { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.6; }

.state-msg {
  padding: 44px 28px 48px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
}
.state-msg.hidden { display: none; }