:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --primary: #c85e38;
  --primary-dark: #a84a2a;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --ok: #16a34a;
  --err: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.card-header {
  padding: 22px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  font-size: 20px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}

.card-body { padding: 22px 28px 30px; }

.page-footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

h1.title { font-size: 22px; margin: 6px 0 4px; }
p.subtitle { color: var(--muted); margin: 0 0 22px; font-size: 15px; }

/* Steps indicator */
.steps { display: flex; gap: 6px; }
.steps .dot {
  width: 26px; height: 6px; border-radius: 4px; background: var(--border);
}
.steps .dot.active { background: var(--primary); }
.steps .dot.done { background: var(--ok); }

/* Form */
.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px;
}
.field input[type="text"], .field input[type="tel"] {
  width: 100%; padding: 13px 14px; font-size: 16px;
  border: 1.5px solid var(--border); border-radius: 10px; outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--primary); }
.field .errorlist { color: var(--err); font-size: 13px; margin: 6px 0 0; padding: 0; list-style: none; }
.help { color: var(--muted); font-size: 13px; margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 18px; font-size: 16px; font-weight: 600;
  background: var(--primary); color: #fff; border: none; border-radius: 10px;
  cursor: pointer; transition: background .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--primary); border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: #f8fafc; }

.alert {
  padding: 11px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 12px;
}
.alert-error { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }
.messages { padding: 0 28px; margin-top: 14px; }

/* OTP */
.otp-input {
  width: 100%; text-align: center; letter-spacing: 14px; font-size: 28px;
  font-weight: 700; padding: 14px; border: 1.5px solid var(--border);
  border-radius: 10px;
}
.otp-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.timer { color: var(--muted); font-size: 14px; }
.resend-form { display: inline; }
.link-btn {
  background: none; border: none; color: var(--primary); cursor: pointer;
  font-size: 14px; font-weight: 600; padding: 0;
}
.link-btn:disabled { color: var(--muted); cursor: not-allowed; }

/* Oferta preview */
.oferta-box {
  max-height: 320px; overflow-y: auto; overflow-x: hidden;
  border: 1.5px solid var(--border);
  border-radius: 10px; padding: 16px 18px; background: #f8fafc; margin-bottom: 20px;
  font-size: 14px; line-height: 1.55;
  overflow-wrap: anywhere; word-break: break-word;
}
.oferta-box h2 { font-size: 17px; margin: 4px 0 10px; }
.oferta-box h3 { font-size: 15px; margin: 14px 0 6px; }
.oferta-box p { margin: 0 0 8px; }
.oferta-box img { max-width: 100%; height: auto; }
.oferta-table {
  width: 100%; border-collapse: collapse; margin: 8px 0;
  table-layout: fixed;
}
.oferta-table td {
  border: 1px solid var(--border); padding: 6px 8px;
  overflow-wrap: anywhere; word-break: break-word; vertical-align: top;
}

/* Signature pad */
.sig-label { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.sig-wrap {
  position: relative; border: 1.5px dashed #cbd5e1; border-radius: 10px;
  background: #fff; touch-action: none;
}
.sig-wrap canvas { display: block; width: 100%; height: 200px; border-radius: 10px; }
.sig-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #cbd5e1; font-size: 15px; pointer-events: none;
}
.sig-actions { display: flex; gap: 10px; margin: 12px 0 20px; }
.sig-actions .btn { width: auto; flex: 0 0 auto; padding: 10px 16px; font-size: 14px; }

.consent {
  display: flex; gap: 10px; align-items: flex-start; font-size: 13px;
  color: var(--muted); margin-bottom: 18px;
}
.consent input { margin-top: 3px; }

/* Oferta "read" button + consent link */
.oferta-open { width: 100%; margin-bottom: 20px; }
.oferta-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.oferta-link:hover { color: var(--primary-dark); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: 100%; max-width: 620px; max-height: 88vh;
  background: var(--card); border-radius: var(--radius);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
  animation: modal-in .18s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; margin: 0; }
.modal-close {
  background: none; border: none; font-size: 28px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 18px 20px; overflow-y: auto; overflow-x: hidden; flex: 1;
  font-size: 14px; line-height: 1.6;
  overflow-wrap: anywhere; word-break: break-word;
}
.modal-body.oferta-box {
  max-height: none; border: none; background: transparent; margin: 0; border-radius: 0;
}
.modal-body h2 { font-size: 17px; margin: 4px 0 10px; }
.modal-body h3 { font-size: 15px; margin: 14px 0 6px; }
.modal-body p { margin: 0 0 8px; }
.modal-footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
}
.modal-footer .btn { width: 100%; }

/* Thank you */
.success-icon {
  width: 72px; height: 72px; border-radius: 50%; background: #f0fdf4;
  display: flex; align-items: center; justify-content: center; margin: 8px auto 18px;
}
.success-icon svg { width: 38px; height: 38px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.warn-box {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  padding: 12px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 18px;
}
