* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #f3f5f9;
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 14px 30px;
}

h1 {
  margin: 8px 0 14px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.card {
  background: #fff;
  border: 1px solid #e6e8ee;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
  margin-bottom: 14px;
  overflow: hidden; /* fixes “input extends past background” issues on iOS */
}

label {
  display: block;
  font-weight: 800;
  margin: 12px 0 8px;
  font-size: 18px;
}

input, select, textarea, button { font: inherit; }

/* Prevent iOS zoom on focus */
input, select, textarea { font-size: 16px; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid #d6d9e3;
  background: #fff;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
  margin-bottom: 12px; /* adds space above Next: Services button */
}

input::placeholder, textarea::placeholder { color: #9aa4b2; }

input:focus, select:focus, textarea:focus {
  border-color: #2f6df6;
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
}

button, .btn {
  width: 100%;
  display: inline-block;
  border: none;
  border-radius: 12px;
  padding: 14px 14px;
  background: #1b5cff;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

button.secondary, .btn.secondary {
  background: #eef2ff;
  color: #1b2a52;
  border: 1px solid #d8def3;
}

.muted { color: #667085; font-size: 14px; }

.small { font-size: 13px; color: #6b7280; }

.hr { height: 1px; background: #eef0f5; margin: 14px 0; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }

/* =========================
   Services page visuals
   ========================= */

.section-title {
  font-weight: 900;
  font-size: 22px;
  margin: 0 0 10px;
}

.svc {
  border: 1px solid #e6e8ee;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fff;
}

.svc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.svc-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.svc-left input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 0;
}

.svc-left label {
  display: inline;
  margin: 0;
  font-weight: 900;
}

.reveal-box {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #f8f9fc;
  border: 1px solid #e6e8ee;
}

.price-row { margin-top: 10px; }

.total-box {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border: 1px dashed #d6d9e3;
  border-radius: 12px;
  margin-top: 14px;
  font-weight: 900;
}

/* Date overlay (prevents iOS date input weird sizing + keeps inside card) */
.date-overlay { position: relative; }

.date-display {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid #d6d9e3;
  background: #fff;
  pointer-events: none;
}

.date-display.placeholder { color: #9aa4b2; }

.date-overlay input[type="date"]{
  position: absolute;
  inset: 0;
  opacity: 0; /* still clickable, but we see the display box */
}

/* =========================
   Signature area (sign page)
   ========================= */

.sig-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.sig-actions > * { flex: 1; }

.sig-wrap {
  position: relative;
  width: 100%;
  height: 190px;
  border: 1px solid #d6d9e3;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  touch-action: none; /* important for mobile drawing */
}

#sigCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sig-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  z-index: 2;
}

/* =========================
   Terms modal (fixed overlay)
   ========================= */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.modal.show {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
}

.modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 92vw);
  max-height: 86vh;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e6e8ee;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}

.modal-header,
.modal-footer {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header { border-bottom: 1px solid #eef0f5; }
.modal-footer { border-top: 1px solid #eef0f5; flex-wrap: wrap; }

.modal-close {
  width: auto;
  padding: 10px 12px;
}

/* iOS Safari: iframe inside flex needs an explicit height */
.modal-body {
  position: relative;
  height: 55vh;        /* forces visible scrolling area */
  min-height: 240px;
  overflow: hidden;    /* iframe will scroll, not the modal */
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.modal-open { overflow: hidden; }