:root {
  /* Paleta Grow360 */
  --green: #2E9279;        /* Teal 600 (primario) */
  --green-dark: #001C42;   /* Navy 1000 (títulos) */
  --teal-light: #3FBF9E;   /* Teal 400 */
  --green-soft: #e6f4ef;
  --ink: #12303f;
  --muted: #6b7d80;
  --line: #d8e6e0;
  --bg: #f3f8f6;
  --white: #ffffff;
  --danger: #c0392b;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(20, 60, 45, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 400px at 50% -8%, #d6f0e6 0%, transparent 60%),
    var(--bg);
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px calc(10px + env(safe-area-inset-top));
  padding-top: max(14px, env(safe-area-inset-top));
}
.event-label {
  text-align: center;
  line-height: 1.1;
  flex: 1;
  min-width: 0;
}
.event-label span {
  font-weight: 700;
  color: var(--green-dark);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-label small { color: var(--muted); font-size: 12px; }

.icon-btn {
  border: none;
  background: var(--white);
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 18px;
  box-shadow: var(--shadow);
}

.lang-toggle {
  display: inline-flex;
  background: var(--white);
  border-radius: 12px;
  padding: 3px;
  box-shadow: var(--shadow);
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 9px;
}
.lang-btn.active { background: var(--green); color: #fff; }

/* ---------- Layout ---------- */
.wrap {
  max-width: 460px;
  margin: 0 auto;
  padding: 8px 16px calc(40px + env(safe-area-inset-bottom));
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px;
}

.card-head { text-align: center; margin-bottom: 16px; }
.deco { color: #cfa94a; letter-spacing: 6px; font-size: 12px; margin-bottom: 6px; }
.card-head h1 { margin: 0; font-size: 31px; color: var(--green-dark); letter-spacing: -.3px; }
.event-hero { margin: 12px 0 4px; font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1.12; }
.event-hero.muted { color: var(--muted); font-weight: 600; }
.event-date-hero { margin: 0; font-size: 14.5px; color: var(--muted); font-weight: 500; }

/* ---------- Form ---------- */
form { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.row { display: flex; gap: 12px; }
.row .field { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 600; color: var(--ink); }
.req { color: var(--danger); }

input, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px; /* evita zoom en iOS */
  background: #fbfdfc;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px #f7e2df; }
textarea { resize: none; }

/* ---------- Selector de cuenta (enrutamiento) ---------- */
.route-field { align-items: center; margin-bottom: 2px; }
.type-select {
  display: inline-flex;
  gap: 3px;
  background: #eef4f1;
  padding: 3px;
  border-radius: 9px;
}
.type-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 7px;
  transition: background .12s;
}
.type-btn.active {
  background: var(--green);
  color: #fff;
}

/* ---------- Selfie ---------- */
.selfie-area { }
.selfie-empty {
  width: 100%;
  min-height: 150px;
  border: 2px dashed var(--green);
  border-radius: 16px;
  background: var(--green-soft);
  color: var(--green-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}
.cam-icon { font-size: 38px; }

.cam-live { position: relative; border-radius: 14px; overflow: hidden; background: #000; }
.cam-live video {
  width: 100%;
  display: block;
  max-height: 60vh;
  object-fit: cover;
  transform: scaleX(-1); /* espejo, selfie natural */
}
.cam-controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
}
.shutter {
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.35);
}
.shutter:active { transform: scale(.94); }

.smile-hint {
  position: absolute;
  top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.55); color: #fff;
  font-weight: 700; font-size: 14px;
  padding: 7px 14px; border-radius: 999px;
  backdrop-filter: blur(2px);
  animation: smilePulse 1.6s ease-in-out infinite;
  white-space: nowrap;
}
@keyframes smilePulse { 0%,100% { opacity: .78; } 50% { opacity: 1; } }

.shot { position: relative; }
.shot img { width: 100%; border-radius: 14px; display: block; transform: scaleX(-1); }
.ghost-btn {
  border: none;
  background: rgba(255,255,255,.9);
  color: var(--ink);
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
}
.ghost-btn.small {
  position: absolute;
  bottom: 10px; right: 10px;
  box-shadow: var(--shadow);
}

/* ---------- Submit ---------- */
.submit {
  border: none;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  padding: 15px;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(46,146,121,.3);
  margin-top: 4px;
}
.submit:active { transform: translateY(1px); }
.submit:disabled { opacity: .6; }
.submit.outline { background: #fff; color: var(--green-dark); border: 2px solid var(--green); box-shadow: none; }

/* ---------- Success ---------- */
.success { text-align: center; padding: 40px 22px; }
.success-emoji { font-size: 60px; }
.success h2 { color: var(--green-dark); margin: 8px 0; }
.success p { color: var(--muted); margin: 0 0 22px; }
.success .submit { margin-top: 10px; }

/* ---------- Envío desde el celular (semi-automático) ---------- */
#liteCard { padding-top: 30px; }
#liteCard .submit { display: block; width: 100%; }
.lite-steps { text-align: left; color: var(--muted); font-size: 14px; line-height: 1.45; margin: 6px 0 16px; padding-left: 22px; }
.lite-steps li { margin-bottom: 6px; }
.lite-btns { display: flex; flex-direction: column; }
.lite-btns .submit:first-child { margin-top: 0; }
.lite-copy { display: block; margin: 12px auto 4px; background: var(--green-soft); color: var(--green-dark); }
.lite-sent { display: inline-block; margin-left: 6px; font-size: 13px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(20,40,32,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; z-index: 40;
}
.modal-card {
  background: #fff; border-radius: var(--radius);
  padding: 22px 18px; width: 100%; max-width: 380px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.modal-card h3 { margin: 0; color: var(--green-dark); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .submit { flex: 1; margin: 0; }
.modal-actions .ghost-btn { background: var(--green-soft); color: var(--green-dark); }
.card-link { text-align: center; margin: 4px 0 0; }
.card-link a { color: var(--green); font-weight: 600; text-decoration: none; font-size: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 12px;
  font-size: 14px; z-index: 50;
  box-shadow: var(--shadow);
  max-width: 90vw; text-align: center;
}
.toast.err { background: var(--danger); }

/* ---------- Escanear tarjeta ---------- */
.scan-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scan-btn {
  width: 100%; border: 1.5px dashed var(--green); background: var(--green-soft);
  color: var(--green-dark); font-weight: 700; font-size: 13px;
  padding: 11px 8px; border-radius: 12px;
}
.scan-btn:active { transform: translateY(1px); }
.cardcam { position: fixed; inset: 0; z-index: 60; background: #000; }
.cardcam video { width: 100%; height: 100%; object-fit: cover; }
.cardcam-hint { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 16px); left: 0; right: 0; text-align: center; color: #fff; font-weight: 600; font-size: 14px; text-shadow: 0 1px 5px rgba(0,0,0,.7); }
.cardcam-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; padding: 18px 22px calc(24px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(0,0,0,.6), transparent); }
.cardcam-bar .ghost-btn { background: rgba(255,255,255,.92); }

/* ---------- Preferencia de contacto (radios WhatsApp / Texto) ---------- */
.pref-field { gap: 6px; }
.pref-radios { display: flex; gap: 8px; }
.pref-opt {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid var(--line); border-radius: 9px;
  padding: 7px 9px; font-weight: 600; font-size: 12.5px;
  cursor: pointer; background: #fbfdfc;
  transition: border-color .12s, background .12s;
}
.pref-opt input[type="radio"] { width: 14px; height: 14px; margin: 0; accent-color: var(--green); flex: none; }
.pref-opt svg { flex: none; width: 15px; height: 15px; }
.pref-opt:has(input:checked) { border-color: var(--green); background: var(--green-soft); }

.brandline { text-align: center; color: var(--muted); font-size: 11px; margin: 18px 0 4px; letter-spacing: .02em; }
.brandline a { color: var(--green); text-decoration: none; font-weight: 700; }
.appver { text-align: center; color: var(--muted); font-size: 9.5px; opacity: .5; margin: 0 0 6px; letter-spacing: .03em; }

[hidden] { display: none !important; }
