/* Mini App de pagos — paleta alineada con carga-cajas-bot (periwinkle, dark).
   Dark-only a propósito: es como se ve el resto del ecosistema y así no hay dos
   identidades visuales en el mismo Telegram. */

:root {
  --fondo:        #14161c;
  --superficie:   #1c1f27;
  --superficie-2: #242832;
  --borde:        #2e3340;
  --texto:        #e8eaf0;
  --texto-tenue:  #9aa2b5;
  --acento:       #79a1f2;
  --acento-tenue: #2a3350;
  --exito:        #4ad07f;
  --aviso:        #f2c16b;
  --error:        #f2716b;
  --radio:        14px;
  --seguro-abajo: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: var(--seguro-abajo);
}

.oculto { display: none !important; }

.pantalla { padding: 16px 16px 32px; max-width: 560px; margin: 0 auto; }
.centrada {
  min-height: 80vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 8px;
}

.cabecera { display: flex; align-items: center; gap: 12px; margin: 8px 0 20px; }
h1 { font-size: 22px; margin: 0; font-weight: 650; }
h2 { font-size: 18px; margin: 0; font-weight: 600; }
.tenue { color: var(--texto-tenue); font-size: 14px; margin: 2px 0 0; }
.icono-grande { font-size: 44px; line-height: 1; }

.titulo-seccion {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texto-tenue); font-weight: 600; margin: 24px 0 10px;
}

/* ── Botones ─────────────────────────────────────────────────────────────── */

.boton-principal {
  width: 100%; padding: 15px; border: 0; border-radius: var(--radio);
  background: var(--acento); color: #10131a; font-size: 16px; font-weight: 650;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  /* 52px de alto mínimo: es un formulario que se usa de pie, con una mano */
  min-height: 52px;
}
.boton-principal:active { opacity: .85; }
.boton-principal:disabled { opacity: .45; cursor: default; }

.boton-secundario {
  flex: 1; padding: 13px; border: 1px solid var(--borde); border-radius: var(--radio);
  background: var(--superficie-2); color: var(--texto); font-size: 15px;
  cursor: pointer; min-height: 48px;
}
.boton-secundario:active { background: var(--borde); }

.boton-icono {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--superficie-2); color: var(--texto); font-size: 20px; cursor: pointer;
}

.boton-texto {
  margin-top: 10px; background: none; border: 0; color: var(--texto-tenue);
  font-size: 15px; cursor: pointer; padding: 10px;
}

.fila-botones { display: flex; gap: 10px; margin-top: 10px; }

/* ── Formulario ──────────────────────────────────────────────────────────── */

.campo { margin-bottom: 18px; }
.campo-doble { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.etiqueta {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--texto-tenue); margin-bottom: 7px;
}

.control {
  width: 100%; padding: 13px 14px; border: 1px solid var(--borde);
  border-radius: var(--radio); background: var(--superficie);
  color: var(--texto); font-size: 16px; /* 16px evita el zoom automático en iOS */
  min-height: 50px;
}
.control:focus { outline: 2px solid var(--acento); outline-offset: -1px; border-color: transparent; }

.control-con-sufijo { position: relative; }
.control-con-sufijo .sufijo {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--texto-tenue); pointer-events: none;
}

.ayuda { font-size: 13px; color: var(--acento); margin: 8px 0 0; }

/* ── Selector de tipo ────────────────────────────────────────────────────── */

.segmentado {
  display: flex; gap: 4px; padding: 4px;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
}
.segmento {
  flex: 1; padding: 11px; border: 0; border-radius: 10px; background: none;
  color: var(--texto-tenue); font-size: 15px; font-weight: 600; cursor: pointer;
  min-height: 44px;
}
.segmento.activo { background: var(--acento); color: #10131a; }

/* ── Foto ────────────────────────────────────────────────────────────────── */

.foto-zona {
  border: 1.5px dashed var(--borde); border-radius: var(--radio);
  background: var(--superficie); min-height: 170px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.foto-zona img { width: 100%; max-height: 320px; object-fit: contain; display: block; }
.foto-vacia { text-align: center; padding: 26px; }
.foto-vacia p { margin: 8px 0 0; }

/* ── Sugerencias de proveedor ────────────────────────────────────────────── */

.sugerencias { margin-top: 6px; }
.sugerencias:empty { display: none; }
.sugerencia {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; padding: 13px 14px; margin-bottom: 4px; text-align: left;
  border: 1px solid var(--borde); border-radius: 10px;
  background: var(--superficie-2); color: var(--texto); font-size: 15px;
  cursor: pointer; min-height: 48px;
}
.sugerencia:active { border-color: var(--acento); }
.sugerencia .conteo { font-size: 12px; color: var(--texto-tenue); flex-shrink: 0; }

/* ── Lista de comprobantes ───────────────────────────────────────────────── */

.lista:empty::after {
  content: "Todavía no hay pagos registrados.";
  display: block; padding: 26px 0; text-align: center;
  color: var(--texto-tenue); font-size: 14px;
}

.item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 14px; margin-bottom: 8px;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
}
.item .quien { font-weight: 600; font-size: 15px; }
.item .meta { font-size: 12.5px; color: var(--texto-tenue); margin-top: 3px; }
.item .importe { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.estado {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em;
}
.estado-pendiente  { background: rgba(242,193,107,.16); color: var(--aviso); }
.estado-conciliado { background: rgba(74,208,127,.16); color: var(--exito); }
.estado-duplicado,
.estado-rechazado  { background: rgba(242,113,107,.16); color: var(--error); }

/* ── Mensajes ────────────────────────────────────────────────────────────── */

.error {
  background: rgba(242,113,107,.12); border: 1px solid rgba(242,113,107,.35);
  color: var(--error); padding: 12px 14px; border-radius: var(--radio);
  font-size: 14.5px; margin: 0 0 16px;
}

.avisos {
  background: rgba(242,193,107,.1); border: 1px solid rgba(242,193,107,.3);
  border-radius: var(--radio); padding: 13px 15px; margin: 16px 0;
  text-align: left; font-size: 14px; color: var(--aviso);
}
.avisos ul { margin: 6px 0 0; padding-left: 18px; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */

.spinner {
  width: 30px; height: 30px; border: 3px solid var(--borde);
  border-top-color: var(--acento); border-radius: 50%;
  animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.5s; }
}
