:root { --brand: #4f46e5; --ink: #1f2330; --muted: #6b7080; --line: #e3e4ea; --bg: #f4f4f7; --ok: #15803d; --warn: #b45309; --bad: #b91c1c; }
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--brand); }
header.top { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
header.top img { height: 28px; display: block; }
header.top nav { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; }
header.top nav a { text-decoration: none; color: var(--ink); font-weight: 500; }
header.top nav a:hover { color: var(--brand); }
main { max-width: 1040px; margin: 0 auto; padding: 22px 16px 60px; }
main.narrow { max-width: 560px; }
h1 { font-size: 1.5rem; margin: 0 0 14px; } h2 { font-size: 1.1rem; margin: 22px 0 8px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
label { display: block; font-weight: 600; font-size: .88rem; margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea, input[type=file] { width: 100%; padding: 9px 10px; border: 1px solid #c9cbd6; border-radius: 6px; font: inherit; background: #fff; }
textarea { min-height: 140px; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 6px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid #c9cbd6; }
.btn.danger { background: var(--bad); }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 140px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: #e8e8ee; color: #444; }
.chip.sent, .chip.viewed { background: #fef3c7; color: var(--warn); } .chip.completed, .chip.signed { background: #dcfce7; color: var(--ok); }
.chip.voided, .chip.declined, .chip.expired { background: #fee2e2; color: var(--bad); }
.flash { background: #eef2ff; border: 1px solid #c7d2fe; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.error { background: #fee2e2; border: 1px solid #fecaca; color: #7f1d1d; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.muted { color: var(--muted); } .mono { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; word-break: break-all; }
.inline { display: inline; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stats a { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; text-decoration: none; color: var(--ink); }
.stats b { display: block; font-size: 1.3rem; }
/* signer page */
.pagewrap { position: relative; margin: 0 auto 14px; max-width: 820px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.pagewrap img { display: block; width: 100%; height: auto; }
.fbox { position: absolute; border: 2px dashed var(--brand); background: rgba(79,70,229,.12); font-size: 11px; color: var(--brand); font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.fbox.other { border-color: #aaa; background: rgba(0,0,0,.05); color: #777; }
.sigpanel { max-width: 820px; margin: 0 auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button { flex: 1; padding: 9px; border: 1px solid #c9cbd6; background: #fff; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
canvas#pad { width: 100%; height: 170px; border: 1px solid #c9cbd6; border-radius: 6px; background: #fff; touch-action: none; display: block; }
.typed-preview { font-family: "Dancing Script", cursive; font-size: 2.2rem; min-height: 60px; padding: 6px 10px; border: 1px solid #c9cbd6; border-radius: 6px; background: #fff; color: #1b2a78; overflow: hidden; }
.consent { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; max-width: 700px; margin: 0 auto; }
.consent p { font-size: .95rem; }
.checkrow { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.checkrow input { margin-top: 4px; width: 20px; height: 20px; }
.hidden { display: none !important; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 5; }
.toolbar select { width: auto; }
#placer .pagewrap { cursor: crosshair; max-width: 760px; user-select: none; }
#placer .fbox { cursor: pointer; }
@font-face { font-family: "Dancing Script"; src: url("/static/fonts/DancingScript.ttf") format("truetype"); font-weight: 400 700; }
@media (max-width: 600px) { main { padding: 12px 10px 40px; } table { font-size: .85rem; } .hide-sm { display: none; } }
/* ---- guided signer experience ---- */
@font-face { font-family: "Great Vibes"; src: url("/static/fonts/GreatVibes-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Allura"; src: url("/static/fonts/Allura-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Sacramento"; src: url("/static/fonts/Sacramento-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Kalam"; src: url("/static/fonts/Kalam-Regular.ttf") format("truetype"); font-display: swap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn.big { padding: 12px 22px; font-size: 1rem; min-height: 46px; }
.btn.finish { background: var(--ok); }
.btn:focus-visible, .ff:focus-visible, .tabs button:focus-visible, .fontopt:focus-within { outline: 3px solid #f59e0b; outline-offset: 2px; }
main.signing { max-width: 900px; padding-bottom: 120px; }
.signhead { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.signhead h1 { margin-bottom: 4px; }
.signhead-main { flex: 1 1 320px; } .signhead-main p { margin: 0; }
.signhead-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ff { position: absolute; padding: 0; margin: 0; border-radius: 4px; font: inherit; display: flex; align-items: center; justify-content: center; overflow: visible; }
button.ff { cursor: pointer; border: 2px solid #f59e0b; background: rgba(253, 224, 71, .38); color: #78350f; touch-action: manipulation; }
button.ff:not(.req) { border-style: dashed; background: rgba(253, 224, 71, .18); }
button.ff::after { content: ""; position: absolute; inset: -10px -6px; }  /* bigger tap target than the drawn box */
button.ff:hover { background: rgba(253, 224, 71, .6); }
.ff-tag { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 4px; color: #78350f; font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; overflow: hidden; pointer-events: none; }
.ff-tag::before { content: ""; width: 0; height: 0; border-left: 6px solid #f59e0b; border-top: 4px solid transparent; border-bottom: 4px solid transparent; flex: none; }
.ff-tag small { font-weight: 500; opacity: .9; }
button.ff.current { box-shadow: 0 0 0 4px rgba(245, 158, 11, .45); animation: nspulse 1.2s ease-in-out 2; z-index: 3; }
@keyframes nspulse { 50% { box-shadow: 0 0 0 9px rgba(245, 158, 11, .15); } }
button.ff.done { border: 1px solid rgba(21, 128, 61, .55); background: rgba(220, 252, 231, .35); color: #0b1a6b; }
button.ff.done .ff-tag { display: none; }
.ff-val { display: block; width: 100%; height: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; padding: 0 3px; line-height: 1; display: flex; align-items: center; color: #0b1a6b; }
.ff-val img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ff-sign .ff-val, .ff-initial .ff-val { justify-content: flex-start; }
.ff-auto { border: 1px dashed #9ca3af; background: rgba(243, 244, 246, .7); color: #374151; pointer-events: auto; }
.ff-auto .ff-val { color: #374151; }
.ff-other { border: 1px dashed #bbb; background: rgba(0,0,0,.04); }
.guide { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0,0,0,.08); z-index: 20; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.guide-in { max-width: 900px; margin: 0 auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.guide-progress { flex: 1 1 160px; font-weight: 600; font-size: .95rem; }
.bar { height: 6px; background: #e5e7eb; border-radius: 9px; margin-top: 5px; overflow: hidden; }
#prog-bar { height: 100%; width: 0; background: var(--ok); transition: width .3s; }
dialog { border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 20px)); max-height: calc(100vh - 20px); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15, 23, 42, .5); }
.dlg { padding: 18px 18px 14px; }
.dlg h2 { margin: 0 0 8px; }
.small-p { font-size: .88rem; margin: 0 0 6px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.fontpick { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.fontopt { display: flex; align-items: center; gap: 12px; border: 1px solid #c9cbd6; border-radius: 8px; padding: 8px 12px; margin: 0; cursor: pointer; font-weight: 400; min-height: 56px; }
.fontopt input { width: 20px; height: 20px; flex: none; }
.fontopt:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(79,70,229,.25); }
.fo-sig { font-size: 1.9rem; color: #0b1a6b; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.fo-init { font-size: 1.5rem; color: #0b1a6b; border-left: 1px solid var(--line); padding-left: 12px; min-width: 52px; }
canvas.pad { width: 100%; height: 150px; border: 1px solid #c9cbd6; border-radius: 6px; background: #fff; touch-action: none; display: block; }
canvas.pad-init { width: 50%; min-width: 160px; height: 100px; }
.padrow { margin: 6px 0; }
.upprev { min-height: 20px; margin-top: 8px; } .upprev img { max-width: 100%; max-height: 120px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.legal-small { font-size: .78rem; color: var(--muted); margin: 12px 0 0; }
@media (max-width: 600px) {
  button.ff::after { inset: -14px -8px; }
  .ff-tag::before { display: none; }
  .guide-in { gap: 8px; } .guide .btn.big { flex: 1 1 auto; padding: 12px 14px; }
  .guide-progress { flex-basis: 100%; }
  .fo-sig { font-size: 1.6rem; }
  .dlg { padding: 14px 12px 12px; }
}
[hidden] { display: none !important; }
