:root {
  --tinta: #0d0d12;
  --tinta-2: #4a4a55;
  --papel: #f3f2f4;
  --tarjeta: #ffffff;
  --linea: #e3e1e6;
  --acento: #d6247c;
  --acento-oscuro: #b01a65;
  --radio: 16px;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  background: var(--papel);
  color: var(--tinta);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

.ico { width: 22px; height: 22px; flex: none; }
.ico-wa { width: 26px; height: 26px; }

.tarjeta {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--tarjeta);
  padding: 0 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portada {
  margin: 0 -20px;
  height: 112px;
  background: var(--tinta);
  padding: calc(12px + env(safe-area-inset-top)) 20px 0;
  border-radius: 0 0 28px 28px;
}

.marca { display: block; height: 42px; width: auto; margin: 0 auto; }

.identidad { text-align: center; margin-top: -44px; }

.avatar {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 4px solid var(--tarjeta);
  background: var(--acento);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.01em; }
.cargo { margin-top: 6px; font-size: 17px; font-weight: 600; color: var(--acento-oscuro); }
.empresa { margin-top: 2px; font-size: 15px; color: var(--tinta-2); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: var(--radio);
  font: inherit;
  font-size: 17px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn-principal { background: var(--acento); color: #fff; }
.btn-principal:hover { background: var(--acento-oscuro); }
.btn-wa { background: #118a47; color: #fff; }
.btn-wa:hover { background: #0e7339; }
.btn-secundario { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.btn-secundario:hover { background: #26262e; }

.acciones {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.accion {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 60px;
  padding: 10px 4px;
  border-radius: var(--radio);
  background: var(--papel);
  color: var(--tinta);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.accion:active { background: var(--linea); }

.enlaces {
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  overflow: hidden;
}

.fila {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 6px 16px;
  color: var(--tinta);
  text-decoration: none;
}
.fila + .fila { border-top: 1px solid var(--linea); }
.fila:active { background: var(--papel); }
.fila-texto { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.fila-texto strong { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.fila-texto small { font-size: 13px; color: var(--tinta-2); }
.flecha { width: 18px; height: 18px; color: var(--tinta-2); }

.ayuda { text-align: center; font-size: 14px; color: var(--tinta-2); margin-top: -6px; }

.pie {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.enlace-pie {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--tinta-2);
  cursor: pointer;
}

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--acento);
  outline-offset: 2px;
}

/* Hojas modales */
dialog {
  width: 100%;
  max-width: 440px;
  margin: auto auto 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--tarjeta);
  color: var(--tinta);
  max-height: 92dvh;
  overflow-y: auto;
}
dialog::backdrop { background: rgba(16, 28, 46, 0.55); }
dialog[open] { animation: sube 0.22s ease-out; }
@keyframes sube { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

dialog form, dialog > div:not(.dlg-cab) { display: flex; flex-direction: column; gap: 14px; }
dialog[open] > div.exito[hidden], dialog form[hidden] { display: none; }

.dlg-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-cab h2, .exito h2 { font-size: 20px; line-height: 1.2; }
.cerrar {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--papel); color: var(--tinta); cursor: pointer; flex: none;
}

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
label em { font-style: normal; font-weight: 400; color: var(--tinta-2); }

input, textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1.5px solid var(--linea);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 16px; /* evita el zoom automático en iOS */
  color: var(--tinta);
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #8a93a1; }

.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.error { color: #b3261e; font-size: 14px; font-weight: 600; }
.legal { font-size: 12.5px; color: var(--tinta-2); text-align: center; }

.exito { text-align: center; align-items: center; padding: 12px 0; }
.check {
  width: 64px; height: 64px; border-radius: 50%; background: var(--acento); color: #fff;
  display: grid; place-items: center; font-size: 32px; font-weight: 700;
}

.qr-caja {
  align-self: center;
  padding: 14px;
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  background: #fff;
}
.qr-caja img { display: block; width: min(240px, 62vw); height: auto; }

@media (min-width: 480px) {
  body { padding: 24px 0; }
  .tarjeta {
    min-height: 0;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(16, 28, 46, 0.12);
  }
  dialog { margin: auto; border-radius: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
