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

/* Brand colors inyectados por JS tras validar el hex con regex.
   Defaults sirven mientras carga el JSON de la card; se sobreescriben
   con `document.documentElement.style.setProperty(...)`. CSSOM no está
   bajo style-src en CSP3, por eso podemos sacar 'unsafe-inline'. */
:root {
  --brand-bg: #1E88E5;
  --brand-fg: #ffffff;
  --brand-badge-bg: rgba(255, 255, 255, 0.25);
  --brand-spinner-border: rgba(255, 255, 255, 0.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f2f2f7;
  min-height: 100dvh;
  color: #1c1c1e;
}

/* Loading */
#loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  flex-direction: column;
  gap: 16px;
  color: #636366;
  font-size: 15px;
}
.spin {
  width: 32px; height: 32px;
  border: 3px solid #e5e5ea;
  border-top-color: #007aff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error */
#error-view {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
  text-align: center;
  flex-direction: column;
  gap: 12px;
}
#error-view h2 { font-size: 20px; }
#error-view p  { font-size: 14px; color: #636366; }
.error-icon    { font-size: 48px; }
.error-trace   {
  margin-top: 12px;
  font-family: monospace;
  font-size: 11px;
  color: #8e8e93;
  word-break: break-all;
  padding: 0 16px;
}

/* App */
#app { display: none; }

/* Hero card */
.hero {
  padding: 32px 24px 40px;
  text-align: center;
  background: var(--brand-bg);
  color: var(--brand-fg);
}
.hero-logo     { font-size: 40px; margin-bottom: 8px; }
.hero-business { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.hero-card     { font-size: 15px; opacity: 0.8; margin-top: 4px; }
.hero-badge    {
  display: inline-block;
  margin-top: 14px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--brand-badge-bg);
}

/* Form container */
.container { max-width: 480px; margin: 0 auto; padding: 24px 16px 48px; }

.intro { text-align: center; margin-bottom: 24px; }
.intro h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.intro p  { font-size: 14px; color: #636366; line-height: 1.5; }

.card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.field {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-bottom: 1px solid #f2f2f7;
}
.field:last-child { border-bottom: none; }
.field label {
  font-size: 11px;
  font-weight: 600;
  /* #6a6a70 sobre #fff ≈ 5.1:1 → WCAG AA (el #8e8e93 previo era 2.5:1). */
  color: #6a6a70;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.field input {
  font-size: 17px;
  color: #1c1c1e;
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
}
.field input::placeholder { color: #c7c7cc; }

/* Phone field: country-code select + national-number input en una sola
   línea. Select compacto a la izquierda con hairline divider; input a
   la derecha llena el resto. */
.phone-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Wrapper del prefijo: el <span> visible muestra solo "+52"; el <select>
   nativo está encima invisible (opacity ~0) para seguir recibiendo el
   tap y mostrar el picker nativo de iOS con el texto completo. */
.phone-cc-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.phone-cc-wrap #phone-cc-display {
  font-size: 17px;
  color: #1c1c1e;
  padding-right: 18px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%238e8e93' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right center;
  pointer-events: none;
  white-space: nowrap;
}
.phone-cc-wrap select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: transparent;            /* oculta el texto nativo del select */
  font-size: 17px;               /* coincide con el span para medir igual */
  cursor: pointer;
  opacity: 0.02;                 /* casi invisible, sigue tapable */
}
.phone-group input {
  flex: 1;
  border-left: 1px solid #e5e5ea;
  padding-left: 10px;
}
.field.invalid { background: #fff5f5; }
.field.invalid label { color: #d70015; }
.field .error-msg {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: #d70015;
  line-height: 1.4;
}
.field.invalid .error-msg { display: block; }
.form-error {
  display: none;
  background: #fff5f5;
  color: #d70015;
  border: 1px solid #ffd5d5;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}
.form-error.visible { display: block; }

.btn-submit {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-bottom: 16px;
  background: var(--brand-bg);
  color: var(--brand-fg);
}
.btn-submit:active   { opacity: 0.8; }
.btn-submit:disabled { opacity: 0.5; cursor: default; }

.disclaimer {
  text-align: center;
  font-size: 12px;
  color: #8e8e93;
  line-height: 1.6;
}
.disclaimer a {
  color: #6a6a70;
  text-decoration: underline;
}
.disclaimer a:active { opacity: 0.6; }

.spinner-btn {
  display: none;
  width: 22px; height: 22px;
  border-width: 3px;
  border-style: solid;
  border-color: var(--brand-spinner-border);
  border-top-color: var(--brand-fg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

/* Success */
.success { display: none; text-align: center; padding: 40px 24px; }
.success .check { font-size: 72px; margin-bottom: 16px; }
.success h2 { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
.success p  { font-size: 15px; color: #636366; line-height: 1.5; }
.success-fallback { margin-top: 28px !important; font-size: 13px !important; color: #8e8e93 !important; }
.success-btn {
  display: inline-block; margin-top: 10px; padding: 12px 22px;
  background: #1c1b19; color: #ffffff; border-radius: 12px;
  font-size: 15px; font-weight: 600; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.success-btn:active { opacity: 0.85; }

/* Documentos legales (privacy.html, terms.html) */
.legal { max-width: 720px; margin: 0 auto; padding: 32px 20px 64px; }
.legal h1 { font-size: 26px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.4px; }
.legal h2 { font-size: 17px; font-weight: 700; margin: 28px 0 8px; }
.legal p, .legal li { font-size: 15px; color: #3a3a3c; line-height: 1.55; margin-bottom: 10px; }
.legal ul, .legal ol { padding-left: 22px; margin-bottom: 14px; }
.legal a { color: #007aff; text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal .meta { font-size: 13px; color: #8e8e93; margin-bottom: 24px; }
.legal-back {
  display: inline-block; margin-bottom: 16px; padding: 8px 14px;
  font-size: 14px; color: #007aff; text-decoration: none;
}
.legal-back:hover { text-decoration: underline; }
