/* pocket chat · Pocketful brand: base blanco/negro, teal solo para lo que es Pocketful,
   forma "pocket" (solo la esquina inferior derecha redondeada) en tarjetas, burbujas, botones e inputs. */
:root {
  --fondo: #F8F7F5; --blanco: #FFFFFF; --tinta: #1E1E1E; --titulos: #606060; --guia: #ACACAC; --linea: #DDDDDD;
  --teal: #90AEAE; --teal-oscuro: #2D3D3D; --teal-tinte: #DEE7E7;
  --titulo: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --cuerpo: 'Dosis', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --encabezado: 'Oswald', 'Helvetica Neue', Arial, sans-serif;
  --marca: 'Permanent Marker', 'Brush Script MT', cursive;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--cuerpo); font-size: 16px; line-height: 1.4; color: var(--tinta); background: var(--fondo); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font-family: inherit; font-size: 17px; color: inherit; }
a { color: var(--teal-oscuro); font-weight: 600; text-decoration: none; }
[hidden] { display: none !important; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.vista { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--fondo); max-width: 640px; margin: 0 auto; }
.titulo { font-family: var(--titulo); font-weight: 700; font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; }
.subtitulo { font-size: 13px; color: var(--titulos); }
.encabezado, .etiqueta, .menu-seccion, .tabs button, .tarjeta-titulo, .separador-dia, .fecha-grupo {
  font-family: var(--encabezado); font-weight: 300; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--titulos);
}
.lockup { display: flex; align-items: baseline; gap: 4px; }
.lockup .pocket { font-weight: 500; font-size: 14px; }
.lockup .chat { font-family: var(--marca); font-size: 16px; color: var(--teal); line-height: 1; }
.lockup-grande { padding-left: 12px; margin-top: 4px; }
.lockup-grande .pocket { font-size: 30px; letter-spacing: 0.02em; }
.lockup-grande .chat { font-size: 34px; }
.pocket-forma { border-radius: 0 0 12px 0; }

/* botones */
.btn-primario { display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; width: 100%; padding: 0 16px; background: var(--tinta); color: var(--blanco); border-radius: 0 0 12px 0; font-weight: 600; font-size: 15px; }
.btn-primario svg { stroke: var(--blanco); width: 20px; height: 20px; }
.btn-primario:disabled { opacity: .5; }
.btn-icono { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.btn-chip { height: 40px; padding: 0 14px; border: 1px solid var(--linea); background: var(--blanco); border-radius: 0 0 10px 0; font-size: 15px; font-weight: 500; white-space: nowrap; }
.btn-chip:active { background: var(--teal-tinte); }

/* 1 · login */
#vista-login { padding: calc(110px + var(--safe-top)) 32px calc(40px + var(--safe-bottom)); justify-content: space-between; overflow: hidden; }
.esquina { position: absolute; right: 0; bottom: 0; width: 200px; height: 200px; background: var(--teal-oscuro); border-radius: 100% 0 0 0; }
.login-cuerpo { position: relative; display: flex; flex-direction: column; gap: 18px; }
.logo { width: 200px; height: auto; margin-left: -6px; }
.login-sub { margin: 0; padding-left: 12px; color: var(--titulos); max-width: 280px; }
.form-login { display: flex; flex-direction: column; gap: 6px; margin-top: 26px; }
.form-login .etiqueta { margin-top: 10px; }
.form-login .btn-primario { margin: 16px 0 0 12px; width: auto; height: 52px; font-family: var(--titulo); font-size: 14px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700; }
.campo { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; margin-left: 12px; border: 1px solid var(--linea); border-radius: 0 0 12px 0; background: var(--blanco); }
.campo svg { width: 20px; height: 20px; stroke: var(--titulos); }
.campo input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; }
.error { margin: 6px 0 0 12px; color: #8F3B20; font-size: 14px; }
.login-nota { position: relative; display: flex; gap: 10px; align-items: flex-start; max-width: 150px; margin: 0; font-size: 14px; color: var(--titulos); line-height: 1.45; }
.login-nota svg { width: 20px; height: 20px; stroke: var(--titulos); }
.login-nota strong { color: var(--tinta); font-weight: 600; }

/* 2 · chat */
.barra { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-top)) 12px 12px; border-bottom: 1px solid var(--linea); background: var(--fondo); }
.barra-titulo { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mensajes { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 16px; -webkit-overflow-scrolling: touch; }
.separador-dia { align-self: center; color: var(--guia); }
.burbuja { max-width: 82%; padding: 12px 14px; border-radius: 0 0 16px 0; display: flex; flex-direction: column; gap: 12px; overflow-wrap: anywhere; }
.burbuja.bot { align-self: flex-start; background: var(--blanco); border: 1px solid var(--linea); }
.burbuja.usuario { align-self: flex-end; background: var(--teal); }
.burbuja.usuario img { display: block; max-width: 248px; width: 100%; border-radius: 0 0 12px 0; }
.burbuja.error { border-color: #8F3B20; }
.burbuja p { margin: 0; white-space: pre-wrap; }
.escribiendo { display: flex; gap: 5px; padding: 4px 2px; }
.escribiendo i { width: 7px; height: 7px; background: var(--guia); border-radius: 50%; animation: latido 1.2s infinite; }
.escribiendo i:nth-child(2) { animation-delay: .2s; } .escribiendo i:nth-child(3) { animation-delay: .4s; }
@keyframes latido { 0%, 80%, 100% { opacity: .3 } 40% { opacity: 1 } }

.tarjeta { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 0 0 12px 0; background: var(--fondo); border: 1px solid var(--linea); }
.tarjeta-valor { font-family: var(--titulo); font-weight: 700; font-size: 30px; line-height: 1.15; letter-spacing: 0.02em; }
.tarjeta-sub { font-size: 13px; color: var(--titulos); margin-bottom: 8px; }
.tarjeta-fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--linea); }
.tarjeta-fila:last-of-type { border-bottom: 0; }
.tarjeta-fila.destacada { padding: 8px 10px; margin: 0 -10px; border-radius: 0 0 8px 0; background: var(--teal-tinte); border-bottom: 0; }
.tarjeta-fila.destacada + .tarjeta-fila { border-top: 0; }
.tarjeta-fila .etiqueta-fila { display: flex; flex-direction: column; }
.tarjeta-fila .etiqueta-fila small { font-size: 12px; color: var(--teal-oscuro); }
.tarjeta-fila .valor-fila { font-weight: 500; display: flex; gap: 8px; align-items: center; }
.tarjeta-fila .valor-fila small { font-size: 13px; font-weight: 600; color: var(--teal-oscuro); }
.tarjeta-fila.destacada .valor-fila, .tarjeta-fila.destacada .etiqueta-fila > span { font-weight: 600; }
.tarjeta-nota { font-size: 13px; color: var(--titulos); margin-top: 6px; }

.adjunto { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 0 0 12px 0; background: var(--fondo); border: 1px solid var(--linea); color: inherit; }
.adjunto .icono { width: 36px; height: 36px; border-radius: 0 0 10px 0; background: var(--teal-tinte); display: flex; align-items: center; justify-content: center; }
.adjunto .icono svg { width: 20px; height: 20px; stroke: var(--teal-oscuro); }
.adjunto .texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.adjunto .texto b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adjunto .texto small { font-size: 13px; color: var(--titulos); }
.adjunto .ver { height: 36px; padding: 0 14px; border: 1px solid var(--linea); background: var(--blanco); border-radius: 0 0 10px 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; }

.chips { display: flex; gap: 8px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--linea); background: var(--fondo); }
.composer .btn-icono { height: 46px; }
.entrada { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.entrada input { width: 100%; height: 46px; padding: 0 16px; border: 1px solid var(--linea); border-radius: 0 0 12px 0; background: var(--blanco); outline: 0; font-size: 16px; }
.entrada input::placeholder { color: var(--guia); }
.entrada input:focus { border-color: var(--teal); }
.foto-preview { position: relative; width: 72px; }
.foto-preview img { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 0 0 10px 0; border: 1px solid var(--linea); }
.foto-preview button { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; background: var(--tinta); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.foto-preview button svg { width: 14px; height: 14px; stroke: var(--blanco); stroke-width: 2.5; }
.btn-enviar { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: var(--teal); border-radius: 0 0 12px 0; }
.btn-enviar svg { stroke-width: 2; }
.btn-enviar:disabled { background: var(--linea); }

/* 5 · menú */
.menu { position: fixed; inset: 0; z-index: 10; }
.menu-fondo { position: absolute; inset: 0; background: rgba(45, 61, 61, .85); }
.menu-panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(310px, 82vw); display: flex; flex-direction: column; gap: 24px; background: var(--fondo); padding: calc(20px + var(--safe-top)) 16px calc(24px + var(--safe-bottom)); border-radius: 0 0 28px 0; overflow-y: auto; }
.menu-usuario { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.avatar { width: 44px; height: 44px; border-radius: 0 0 12px 0; background: var(--teal); display: flex; align-items: center; justify-content: center; font-family: var(--titulo); font-weight: 700; font-size: 18px; }
.titulo-usuario { font-weight: 600; font-size: 17px; }
.menu-seccion { padding: 0 4px; margin-bottom: -14px; }
.menu-item { display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 12px; width: 100%; text-align: left; border-radius: 0 0 10px 0; }
.menu-item:active { background: var(--teal-tinte); }
.menu-item span { flex: 1; }
.menu-item small { font-size: 13px; color: var(--titulos); }
.menu-item.apagado { color: var(--titulos); }
.menu-pie { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.lockup-pie { padding: 0 12px; }
.lockup-pie .pocket { font-size: 13px; color: var(--titulos); }
.lockup-pie .chat { font-size: 15px; }
.lockup-pie em { font-style: normal; font-size: 12px; color: var(--guia); margin-left: 6px; }

/* 6 · panel */
.barra-panel { border-bottom: 0; padding-bottom: 0; }
.tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--linea); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { padding: 10px 12px; font-size: 13px; letter-spacing: 0.18em; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.activa { color: var(--tinta); font-weight: 400; border-bottom-color: var(--tinta); }
.panel-contenido { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.resumen { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 0 0 14px 0; background: var(--teal-tinte); }
.resumen .encabezado { color: var(--teal-oscuro); }
.resumen .valor { font-family: var(--titulo); font-weight: 700; font-size: 28px; line-height: 1.15; letter-spacing: 0.02em; }
.resumen .estado { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--teal-oscuro); font-weight: 600; padding-bottom: 4px; }
.resumen .estado svg { width: 16px; height: 16px; stroke: var(--teal-oscuro); stroke-width: 2.25; }
.fecha-grupo { padding: 4px 0 6px; }
.fila { display: flex; align-items: center; gap: 12px; padding: 11px 0 11px 12px; border-bottom: 1px solid var(--linea); }
.fila .texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fila .texto b { font-weight: 600; }
.fila .texto small { font-size: 13px; color: var(--titulos); }
.fila .monto { font-weight: 600; }
.fila a.ver { height: 36px; padding: 0 14px; border: 1px solid var(--linea); background: var(--blanco); border-radius: 0 0 10px 0; font-size: 14px; display: flex; align-items: center; }
.vacio { color: var(--titulos); padding: 24px 12px; text-align: center; }
.panel-pie { padding: 8px 16px calc(16px + var(--safe-bottom)); border-top: 1px solid var(--linea); background: var(--fondo); }

@media (min-width: 640px) { .vista { border-left: 1px solid var(--linea); border-right: 1px solid var(--linea); } }
