:root {
  --ground: #f6f8fa; --card: #ffffff; --text: #1a1c1e; --muted: #6c7278;
  --brand: #2567e8; --brand2: #1d4fd0; --line: #edf1f3; --danger: #db3645;
  --ok: #1a7f4b; --warnbg: #fff7e6; --warnln: #f4e3c1; --warntx: #7a4e00;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px;
}
.card {
  width: 100%; max-width: 480px; background: var(--card); border-radius: 18px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.08); padding: 24px; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.mark {
  width: 28px; height: 28px; border-radius: 8px; color: #fff; display: grid; place-items: center;
  font-weight: 700; background: linear-gradient(135deg, var(--brand), var(--brand2));
}
.brand-name { font-weight: 600; letter-spacing: -0.2px; }
h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: -0.3px; }
h2 { font-size: 15px; margin: 18px 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.sender { font-weight: 600; }
.btn {
  appearance: none; border: 0; border-radius: 12px; padding: 13px 16px; font: inherit; font-weight: 600;
  width: 100%; cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 6px 16px rgba(37, 103, 232, 0.28);
}
.btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f3c9ce; box-shadow: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=email] {
  width: 100%; padding: 12px; border: 1px solid #dfe4ea; border-radius: 10px; font: inherit; background: #fff;
}
input:focus { outline: 2px solid rgba(37, 103, 232, 0.35); border-color: var(--brand); }
.otp { letter-spacing: 8px; text-align: center; font-size: 22px; font-weight: 700; }
.doc {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-height: 46vh; overflow: auto;
  white-space: pre-wrap; background: #fbfcfe; font-size: 14px;
}
.doc h3 { margin: 0 0 8px; font-size: 16px; }
.party { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; font-size: 13px; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: var(--brand2); }
.err { background: #fdecee; border: 1px solid #f3c9ce; color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.notice { background: var(--warnbg); border: 1px solid var(--warnln); color: var(--warntx); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.center { text-align: center; }
.big-ok { width: 64px; height: 64px; border-radius: 50%; background: #e8f6ee; color: var(--ok); display: grid; place-items: center; font-size: 30px; margin: 6px auto 10px; }
.foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.version { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }

/* signature step */
.seg-group { display: flex; gap: 6px; background: #f1f4f7; border-radius: 10px; padding: 4px; }
.seg { flex: 1; appearance: none; border: 0; background: transparent; padding: 9px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12); }
.sig-typed { font-size: 26px; font-family: "Segoe Script", "Snell Roundhand", cursive; padding: 10px 12px; }
.sig-canvas { width: 100%; height: 140px; border: 1px dashed #cfd6dd; border-radius: 10px; background: #fff; touch-action: none; display: block; }
.btn.small { width: auto; padding: 7px 12px; font-size: 13px; margin-top: 8px; }
.chk { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 14px 0 4px; line-height: 1.4; cursor: pointer; }
.chk input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--brand); }
.receipt { margin-top: 14px; padding: 12px 14px; background: #f6f8fa; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; text-align: center; }
.receipt code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #fff; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); }
