:root {
  --verde: #1f4d3a; --verde-claro: #e9f1ec; --oro: #a8874f; --tinta: #1b1f23;
  --gris: #5b6470; --linea: #d7dbe0; --papel: #fbfaf7; --mal: #a3302b; --ok: #1f7a3f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "Avenir Next", Helvetica, Arial, sans-serif;
  background: var(--papel); color: var(--tinta);
  display: flex; flex-direction: column; min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
header.app {
  background: var(--verde); color: #f6f3ea; padding: 14px 16px calc(14px + env(safe-area-inset-top)) 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between;
}
header.app h1 { font-family: "Didot", "Baskerville", serif; font-weight: normal; font-size: 22px; margin: 0; }
header.app .quien { font-size: 11px; color: #d9c79c; }
main { flex: 1; padding: 16px; padding-bottom: 90px; max-width: 480px; width: 100%; margin: 0 auto; }
.pantalla { display: none; }
.pantalla.activa { display: block; }
h2 { font-family: "Didot", "Baskerville", serif; font-weight: normal; color: var(--verde); font-size: 20px; margin: 0 0 12px 0; }
.tarjeta { background: white; border: 1px solid var(--linea); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.tarjeta h3 { margin: 0 0 6px 0; font-size: 15px; color: var(--verde); }
.tarjeta p { margin: 0; font-size: 14px; color: #333; line-height: 1.4; }
.estado { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.estado.ok { background: #e3f3e8; color: var(--ok); }
.estado.mal { background: #fbe7e5; color: var(--mal); }
label { display: block; font-size: 12px; color: var(--gris); margin: 10px 0 3px 0; }
input, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--linea); border-radius: 6px; font-size: 15px; font-family: inherit; }
textarea { min-height: 70px; resize: vertical; }
button.primario {
  width: 100%; margin-top: 14px; background: var(--verde); color: white; border: none;
  padding: 12px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
}
button.primario:active { opacity: .85; }
button.secundario { background: none; border: 1px solid var(--verde); color: var(--verde); border-radius: 8px; padding: 8px 12px; font-size: 13px; cursor: pointer; }
.aviso { font-size: 12px; color: var(--gris); background: #fff3cd; border: 1px solid #e3b341; border-radius: 6px; padding: 8px 10px; margin-bottom: 14px; }
.error { color: var(--mal); font-size: 13px; margin-top: 8px; }
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; background: white; border-top: 1px solid var(--linea);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; background: none; border: none; padding: 10px 4px 8px 4px; font-size: 10.5px;
  color: var(--gris); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
}
nav.tabs button.activa { color: var(--verde); font-weight: 600; }
nav.tabs .icono { font-size: 19px; }
.vacio { color: var(--gris); font-size: 13px; text-align: center; padding: 24px 0; }
.tarjeta-clic { cursor: pointer; }
.tarjeta-clic:active { opacity: .85; }
.fila-adjuntos { display: flex; gap: 8px; margin-top: 10px; }
.fila-adjuntos button.secundario { flex: 1; }
#boton-grabar-audio.grabando { background: var(--mal); border-color: var(--mal); color: white; }
.burbuja { max-width: 80%; margin-bottom: 8px; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; word-break: break-word; }
.burbuja p { margin: 0; }
.burbuja.mia { background: var(--verde); color: white; margin-left: auto; border-bottom-right-radius: 3px; }
.burbuja.suya { background: white; border: 1px solid var(--linea); margin-right: auto; border-bottom-left-radius: 3px; }
.burbuja.mia a { color: #e8dfc6; }
#lista-mensajes-conversacion { display: flex; flex-direction: column; margin-bottom: 12px; }
