/* דף החתימה של הלקוח (חתימה מרחוק). מהטלפון קודם: טקסט גדול, כפתורים גדולים, עמודי המסמך ברוחב מלא. בלי גופנים ובלי משאבים חיצוניים. */
:root {
  --ink: #0e1b3a;
  --muted: #5b6b8a;
  --brand: #2f4fe0;
  --brand-dark: #2440c0;
  --bg: #f3f6fb;
  --card: #ffffff;
  --line: #d6dfef;
  --ok: #0b7a4b;
  --err: #b3261e;
  --field: #fff4c2;
  --field-line: #d99a00;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 "Segoe UI", "Heebo", "Noto Sans Hebrew", Arial, system-ui, sans-serif;
}
[hidden] { display: none !important; }
h1 { font-size: 1.55rem; line-height: 1.3; margin: .2rem 0 .4rem; font-weight: 800; }
h2 { font-size: 1.25rem; margin: 0 0 .25rem; }
p { margin: .35rem 0; }
.muted { color: var(--muted); font-size: .92rem; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.center { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 22px; max-width: 520px; width: 100%; box-shadow: 0 6px 24px rgba(14, 27, 58, .07); }
.card p { color: var(--muted); }
.check { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; background: #e3f6ec; color: var(--ok); font-size: 2.1rem; line-height: 64px; font-weight: 800; }

.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--brand); animation: spin 1s linear infinite; margin-bottom: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.btn { font: inherit; font-weight: 700; border: 2px solid transparent; border-radius: 14px; padding: 14px 20px; min-height: 52px; cursor: pointer; width: 100%; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary[aria-disabled="true"] { background: #b9c4e8; color: #fff; cursor: not-allowed; }
.btn-quiet { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }

/* המסמך */
.head { max-width: 820px; margin: 0 auto; padding: 18px 16px 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.from { color: var(--muted); margin: 0; }
.to { color: var(--ink); font-weight: 600; margin: 0 0 6px; }
.how { background: #e8eefc; border-radius: 12px; padding: 10px 14px; color: var(--ink); }

.pages { max-width: 820px; margin: 12px auto 0; padding: 0 12px 24px; }
.page { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 14px; box-shadow: 0 3px 14px rgba(14, 27, 58, .08); overflow: hidden; direction: ltr; }
.page img { display: block; width: 100%; height: auto; }

.field { position: absolute; display: flex; align-items: center; justify-content: center; padding: 0; margin: 0; background: var(--field); border: 2px dashed var(--field-line); border-radius: 8px;
         color: #7a5600; font: 700 clamp(12px, 3.4vw, 17px)/1.2 "Segoe UI", "Heebo", Arial, sans-serif; cursor: pointer; direction: rtl; animation: pulse 1.8s ease-in-out infinite; }
.field:hover { background: #ffed9c; }
.field.done { background: rgba(255, 255, 255, .55); border: 2px solid var(--ok); animation: none; }
.field .ink { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(217, 154, 0, .28); } }
@media (prefers-reduced-motion: reduce) { .field { animation: none; } }

.bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(14, 27, 58, .08);
       padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); }
.bar > * { max-width: 820px; margin-inline: auto; }
.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status { font-weight: 700; font-size: .98rem; margin: 0; }
.status.err { color: var(--err); }
.btn-link { font: inherit; font-weight: 700; font-size: .95rem; color: var(--brand); background: none; border: 0; padding: 8px 4px; min-height: 40px; cursor: pointer; text-decoration: underline; white-space: nowrap; }
.notice { color: var(--muted); font-size: .8rem; line-height: 1.4; margin: 2px auto 6px; }
.bar .btn { display: block; font-size: 1rem; padding: 12px 16px; min-height: 50px; }
.privacy { color: var(--muted); font-size: .8rem; max-width: 820px; margin: 4px auto 14px; padding: 0 16px; }

/* חלון החתימה */
dialog#pad { border: 0; border-radius: 18px; padding: 18px 16px 16px; width: min(94vw, 620px); max-height: 94vh; color: var(--ink); background: #fff; box-shadow: 0 12px 48px rgba(14, 27, 58, .35); }
dialog#pad::backdrop { background: rgba(14, 27, 58, .55); }
.canvas-wrap { position: relative; margin: 10px 0 8px; border: 2px solid var(--line); border-radius: 12px; background: #fcfdff; overflow: hidden;
               background-image: linear-gradient(to bottom, transparent calc(100% - 46px), var(--line) calc(100% - 46px), var(--line) calc(100% - 44px), transparent calc(100% - 44px)); }
#pad-canvas { display: block; width: 100%; height: 240px; touch-action: none; cursor: crosshair; }
.pad-error { color: var(--err); font-weight: 700; margin: 4px 0; }
.pad-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pad-actions .btn-primary { grid-column: 1 / -1; }
@media (min-width: 560px) { .pad-actions { grid-template-columns: 2fr 1fr 1fr; } .pad-actions .btn-primary { grid-column: auto; } }
