:root {
  --brand: #0f4c81;
  --brand-dark: #0a3a63;
  --accent: #18a36b;
  --accent-dark: #128357;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #5c6b7a;
  --line: #dde4ec;
  --error: #c62838;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.top {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  padding: 18px 20px 14px;
  text-align: center;
}
.brand { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.2px; }
.doc-title { font-size: 0.9rem; opacity: 0.85; margin-top: 2px; }

.steps {
  display: flex;
  justify-content: center;
  gap: 6px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.step .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
}
.step.active { color: var(--brand); font-weight: 600; }
.step.active .num { background: var(--brand); color: #fff; }
.step.done .num { background: var(--accent); color: #fff; }
/* מסך צר: רק השלב הפעיל מציג תווית, כדי שארבעת השלבים ייכנסו בשורה אחת בלי גלישה */
@media (max-width: 480px) {
  .steps { gap: 2px; padding: 8px 4px; }
  .step { padding: 4px 6px; font-size: 0.78rem; }
  .step:not(.active) .lbl { display: none; }
}

.screen { max-width: 640px; margin: 0 auto; padding: 18px 16px 40px; }
.hidden { display: none; }

.intro {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 14px;
  text-align: center;
}

.doc-viewer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  max-height: 62vh;
  overflow-y: auto;
  box-shadow: 0 1px 4px rgba(15, 40, 70, 0.06);
}
.doc-viewer img {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.doc-viewer img:last-child { margin-bottom: 0; }

.cta-bar { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }

.btn-primary {
  appearance: none;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 15px 20px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(24, 163, 107, 0.35);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

.btn-ghost {
  appearance: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
}

form { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px; box-shadow: 0 1px 4px rgba(15,40,70,0.06); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 5px; }
.req { color: var(--error); }
.field input {
  width: 100%;
  font-size: 1.05rem;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  transition: border-color 0.15s;
}
.field input:focus { outline: none; border-color: var(--brand); background: #fff; }
.field input.bad { border-color: var(--error); }

.err { display: block; color: var(--error); font-size: 0.8rem; min-height: 1em; margin-top: 3px; }
.field-hint { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

/* מצב בדיקה מקומי בלבד — לא קיים בגרסה שעולה לאוויר */
.dev-code {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff4d6; border: 1.5px dashed #c8901a; border-radius: 9px;
  padding: 9px 14px; margin: 8px 0 10px; color: #8a6d00; font-size: 0.85rem;
}
.dev-code b { font-family: ui-monospace, monospace; font-size: 1.5rem; letter-spacing: 4px; color: #6b5200; }

.phone-row { display: flex; gap: 8px; }
.phone-row input { flex: 1; }
.btn-otp {
  appearance: none;
  border: 0;
  background: var(--brand);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0 18px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-otp:disabled { background: var(--line); color: var(--muted); cursor: default; }
.otp-row {
  margin-top: 10px;
  padding: 12px;
  background: #f2f7fd;
  border: 1px solid #cfe0f2;
  border-radius: 10px;
}
.otp-msg { font-size: 0.85rem; color: var(--brand-dark); margin-bottom: 8px; }
#otpCode { letter-spacing: 6px; text-align: center; font-size: 1.2rem; font-family: ui-monospace, monospace; }
.btn-link {
  appearance: none; background: none; border: 0;
  color: var(--brand); font-size: 0.82rem; cursor: pointer;
  margin-top: 8px; padding: 0; text-decoration: underline;
}
.btn-link:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.verified-badge {
  margin-top: 8px;
  display: inline-block;
  background: #e6f7ef;
  color: var(--accent-dark);
  border: 1px solid #b8e6d0;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
}

.sig-wrap {
  position: relative;
  border: 1.5px dashed var(--brand);
  border-radius: 10px;
  background: #fbfdff;
  overflow: hidden;
}
#sigPad { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.sig-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9fb3c8;
  font-size: 0.95rem;
  pointer-events: none;
}
.sig-actions { margin-top: 8px; }

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.9rem;
  margin: 14px 0 4px;
  cursor: pointer;
}
.consent input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }

.success {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
  padding: 44px 24px;
  box-shadow: 0 1px 4px rgba(15,40,70,0.06);
}
.check {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 2.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(24,163,107,0.4);
}
.success h2 { margin-bottom: 10px; color: var(--accent-dark); }
.success p { color: var(--muted); font-size: 0.95rem; }
.doc-id { margin-top: 16px; font-size: 0.85rem; }
.doc-id span { font-family: ui-monospace, monospace; background: var(--bg); padding: 2px 8px; border-radius: 6px; }

.foot {
  text-align: center;
  color: #93a3b3;
  font-size: 0.75rem;
  padding: 12px 20px 26px;
}

@media (min-width: 700px) {
  .doc-viewer { max-height: 68vh; }
  .cta-bar { flex-direction: row-reverse; justify-content: center; }
  .btn-primary { min-width: 340px; }
}
