/* Paleta inspirada en WhatsApp */
:root {
  --wa-teal: #008069;
  --wa-teal-dark: #075e54;
  --wa-green: #25d366;
  --wa-out: #d9fdd3;
  --wa-in: #ffffff;
  --wa-chat-bg: #efeae2;
  --wa-panel: #f0f2f5;
  --wa-text: #111b21;
  --wa-muted: #667781;
  --wa-line: #e9edef;
  --wa-shadow: rgba(11, 20, 26, 0.12);

  --bg: #0b141a;
  --panel: var(--wa-panel);
  --bot: var(--wa-in);
  --user: var(--wa-green);
  --accent: var(--wa-green);
  --text: var(--wa-text);
  --muted: var(--wa-muted);
  --line: var(--wa-line);
  --header: var(--wa-teal);
  --header-text: #ffffff;
  --bubble-user-text: #111b21;
  --radius-frame: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

/* En el celular ocupa la pantalla. En una pantalla grande se adapta a esa pantalla. */
body.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: stretch;
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 50% -20%, rgba(37, 211, 102, 0.18), transparent),
    #0b141a;
}

.phone-frame {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  background: var(--wa-chat-bg);
  border: 0;
  overflow: hidden;
  position: relative;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.phone-frame img,
.phone-frame video,
.phone-frame canvas,
.phone-frame input,
.phone-frame textarea,
.phone-frame select {
  max-width: 100%;
}

.choices > button,
.share-form,
.share-choice,
.perfil-tarjeta,
.community {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 767px) {
  html,
  body.shell {
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  .phone-frame {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--vv-top, 0px);
    height: var(--vv-height, 100dvh);
    bottom: auto;
    width: 100%;
    max-height: none;
  }

  html.ios,
  html.ios body.shell {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  html.ios .phone-frame {
    top: var(--vv-top, 0px);
    height: var(--vv-height, 100dvh);
    transform: none;
  }

  html.keyboard-open .phone-frame {
    padding-bottom: 0;
  }

  html.keyboard-open .choices {
    display: none;
  }

  html.keyboard-open .chat-input {
    position: relative;
    z-index: 6;
    padding: 0.4rem 0.65rem 0.55rem;
    background: #f0f2f5;
  }

  html.keyboard-open .chat-input form input {
    min-height: 48px;
    font-size: 16px;
    color: #111b21;
    -webkit-text-fill-color: #111b21;
    caret-color: #008069;
    background: #fff;
    opacity: 1;
  }

  .phone-frame input,
  .phone-frame textarea,
  .phone-frame select {
    font-size: 16px;
  }

  .members-sheet,
  .profile-sheet,
  .perfil-sheet-panel {
    max-width: 100%;
    max-height: calc(var(--vv-height, 100dvh) - 5.5rem);
  }
}

/* Pantalla grande: el chat ocupa el ancho y el alto de esa pantalla */
@media (min-width: 768px) {
  body.shell {
    place-items: stretch;
    padding: 0;
  }

  .phone-frame {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding-top: 0;
    padding-bottom: 0;
  }

  .msg-row {
    max-width: min(40rem, 72%);
  }
}

.chat-top {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 21;
}

.header-estado {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #d9fdd3;
}

.header-estado[hidden],
.header-redes-titulo[hidden] {
  display: none;
}

.header-bar:has(.misiones-reino) {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.header-bar:has(.profile-back) {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.header-bar:has(.profile-back):has(.misiones-reino) {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.misiones-reino {
  width: auto;
  max-width: 6.4rem;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0.28rem 0.5rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #075e54;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.feed-ig-puerta {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  display: grid;
  gap: 0.45rem;
  width: auto;
  max-width: 32rem;
  margin: 0 auto;
  padding: 0.9rem;
  box-sizing: border-box;
  background: #fff;
  color: #111;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.feed-ig-puerta p {
  margin: 0 0 0.2rem;
  font-weight: 700;
}

.feed-ig-puerta button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: #e6f4f1;
  color: #075e54;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.feed-ig-puerta button[data-ir="parte"] {
  background: #008069;
  color: #fff;
}

.chat-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.7rem 0.85rem;
  border-bottom: 0;
  background: var(--header);
  color: var(--header-text);
  position: sticky;
  top: 0;
  z-index: 20;
}

.franja-salida {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(0, 128, 105, 0.25);
  background: #e7f6f2;
  color: #008069;
  font-weight: 800;
  min-height: 42px;
  text-align: left;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
}

.franja-salida[hidden] {
  display: none;
}

.perfil-tarjeta {
  width: 100%;
  display: grid;
  gap: 0.75rem;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
}

.perfil-cabeza {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  column-gap: 0.9rem;
  row-gap: 0.12rem;
  align-items: center;
  text-align: left;
  background: #fff;
  border-radius: 22px;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(11, 20, 26, 0.06);
}

.perfil-cabeza > .profile-photo,
.perfil-cabeza > .chat-ball {
  grid-row: 1 / span 5;
  width: 96px;
  height: 96px;
}

.perfil-bloque {
  background: #fff;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 1px 2px rgba(11, 20, 26, 0.06);
}

.perfil-bloque summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0;
  padding: 0.9rem 1rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3b4a54;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.perfil-bloque summary::-webkit-details-marker {
  display: none;
}

.perfil-bloque summary::after {
  content: '▸';
  font-size: 0.95rem;
  color: #667781;
}

.perfil-bloque[open] summary::after {
  content: '▾';
}

.perfil-bloque > :not(summary) {
  padding: 0 1rem 1rem;
}

.perfil-lista {
  margin: 0;
  padding-left: 1.15rem;
}

.perfil-vincular {
  display: grid;
  gap: 0.55rem;
}

.perfil-vincular label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  background: #f7f8f8;
  border-radius: 16px;
  padding: 0.7rem 0.75rem;
  color: #111b21;
}

.perfil-vincular input {
  width: 100%;
  border: 1px solid #e4e8ea;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: #111b21;
  background: #fff;
}

.perfil-vincular button {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  background: #008069;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.perfil-titulo-reino {
  margin: 0;
  color: #008069;
  font-weight: 600;
}

.perfil-monedas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.perfil-moneda {
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  border: 0;
  border-radius: 16px;
  padding: 0.7rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.perfil-moneda strong {
  font-size: 1.25rem;
  line-height: 1.1;
}

.perfil-moneda:nth-child(1) { background: #fff6dc; color: #8a6a12; }
.perfil-moneda:nth-child(2) { background: #f2f3f5; color: #3d4450; }
.perfil-moneda:nth-child(3) { background: #f8efe6; color: #8a4b2a; }

.perfil-form-grid {
  display: grid;
  gap: 0.65rem;
}

.perfil-campo {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.perfil-campo input,
.perfil-campo select {
  width: 100%;
  border: 1px solid #e4e8ea;
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  background: #f7f8f8;
  color: #111b21;
}

.perfil-readonly {
  background: #f5f5f5 !important;
  color: #555;
}

.perfil-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.perfil-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  background: #f4f7f6;
  color: #111b21;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.perfil-check:has(input:checked) {
  background: #e7f6f2;
  border-color: #008069;
  color: #065c4c;
}

.perfil-check input {
  accent-color: #008069;
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.perfil-form-grid button,
.perfil-checks button,
.perfil-avisos button {
  width: 100%;
  flex: 1 1 100%;
  margin-top: 0.35rem;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  min-height: 48px;
  font: inherit;
  font-weight: 700;
  background: #008069;
  color: #fff;
  cursor: pointer;
}

.header-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.header-brand-slot {
  min-width: 0;
}

.header-right {
  position: relative;
  justify-self: end;
}

.role-menu-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 0;
  cursor: pointer;
}

.role-menu-btn span {
  display: block;
  width: 5px;
  height: 5px;
  background: #fff;
  border-radius: 50%;
}

.role-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  left: auto;
  width: min(260px, 78vw);
  background: #fff;
  border: 1px solid var(--wa-line);
  border-radius: 14px;
  box-shadow: 0 16px 40px var(--wa-shadow);
  padding: 0.55rem;
  z-index: 30;
  color: var(--wa-text);
}

.role-menu-meta {
  font-size: 0.75rem;
  color: var(--wa-muted);
  padding: 0.35rem 0.55rem 0.55rem;
  border-bottom: 1px solid var(--wa-line);
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.role-menu-list {
  display: grid;
  gap: 0.25rem;
}

.role-menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--wa-text);
  border-radius: 10px;
  padding: 0.7rem 0.65rem;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}

.role-menu-item:hover,
.role-menu-item:focus {
  background: rgba(0, 128, 105, 0.1);
  outline: none;
}

.role-menu-sub {
  padding-left: 1.35rem;
  font-weight: 500;
}

.pegar-nota {
  min-height: 1.1rem;
  color: #b45309;
  font-size: 0.82rem;
}

.role-menu-install {
  background: var(--wa-teal);
  border: 1px solid var(--wa-teal);
  color: #fff;
  border-radius: 999px;
  text-align: center;
  min-height: 44px;
  margin-bottom: 0.2rem;
}

.role-menu-install:hover,
.role-menu-install:focus {
  background: var(--wa-teal-dark);
  color: #fff;
}

.install-reminder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
  margin: 0.4rem 0 0;
  padding: 0.3rem 0.4rem;
  background: #fff;
  color: var(--wa-text);
  border-radius: 10px;
  height: auto;
  max-height: 4.6rem;
  overflow: hidden;
}

.install-reminder p {
  flex: 1 1 7.5rem;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.15;
}

.install-reminder-actions {
  display: flex;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.install-reminder button {
  min-height: 0;
  height: 1.7rem;
  border-radius: 999px;
  padding: 0 0.55rem;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.install-help {
  flex: 1 1 100%;
  color: var(--wa-muted);
  font-size: 0.68rem;
}

#install-now {
  border: 1px solid var(--wa-teal);
  background: var(--wa-teal);
  color: #fff;
}

#install-later {
  border: 1px solid rgba(0, 128, 105, 0.35);
  background: #fff;
  color: var(--wa-teal);
}

.header-faces {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: auto;
  overflow: visible;
}

.face-stack + .face-stack {
  margin-left: -16px;
}

.face-stack:nth-child(1) { z-index: 3; }
.face-stack:nth-child(2) { z-index: 2; }
.face-stack:nth-child(3) { z-index: 1; }

.reino-brand {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
}

.reino-brand .header-faces {
  flex: 0 0 auto;
  width: auto;
  justify-content: flex-start;
  margin-right: 0;
}

.reino-brand .header-faces > * + * {
  margin-left: -16px;
}

.reino-brand .header-faces.faces-labeled > * + * {
  margin-left: 0.55rem;
}

.group-name {
  margin: 0 0 0 0.75rem;
  text-align: left;
  color: #fff;
  font-weight: 800;
  font-size: 1.02rem;
}

.group-name[hidden] {
  display: none;
}

.face-stack {
  display: grid;
  justify-items: center;
  gap: 0.12rem;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 0;
  cursor: pointer;
}

.face-stack span {
  max-width: 5.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
}

.face-count {
  font-weight: 600;
  opacity: 0.92;
}

.members-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.members-chip {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22) center / cover no-repeat;
  color: #fff;
  font-weight: 800;
  font-size: 0.58rem;
  line-height: 1.05;
  padding: 0 4px;
  cursor: pointer;
}

.members-sheet {
  position: absolute;
  left: 0;
  right: 0;
  top: 4.6rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  z-index: 40;
  display: grid;
  gap: 0.55rem;
  padding: 0.9rem;
  background: #fff;
  color: var(--wa-text);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 16px 40px var(--wa-shadow);
  overflow-x: hidden;
  overflow-y: auto;
}

.members-sheet p {
  margin: 0;
  font-weight: 800;
}

.members-gallery {
  max-height: 75%;
  overflow-x: hidden;
  overflow-y: auto;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.member-card {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  background: transparent;
  padding: 0.2rem;
  text-align: center;
  font-size: 0.75rem;
}

.member-photo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #dfe5e7 center / cover no-repeat;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #075e54;
}

.grupo-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
}

.kind-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: 100%;
}

.kind-row button.on {
  background: #008069;
  color: #fff;
}

.members-sheet input,
.members-sheet textarea {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-radius: 12px;
  background: #f0f2f5;
  padding: 0.7rem 0.8rem;
  font: inherit;
  color: var(--wa-text);
}

.members-sheet textarea {
  resize: vertical;
  min-height: 6rem;
}

.members-sheet .pegar-nota {
  color: #667781;
  font-weight: 500;
  line-height: 1.35;
}

.members-sheet button {
  border: 0;
  border-radius: 12px;
  background: #f0f2f5;
  text-align: left;
  padding: 0.7rem 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.header-faces > * + * {
  margin-left: 0;
}

.header-faces .avatar-user {
  background: #c2185b;
}

.header-faces .avatar.has-photo,
.face-stack > .avatar.has-photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.brand {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  color: var(--header-text);
}

.brand > div:not(.avatar) {
  min-width: 0;
  flex: 1 1 auto;
}

.brand > .avatar {
  flex: 0 0 auto;
}

.chat-header .reino-brand > .header-faces {
  flex: 0 0 auto;
  width: auto;
}

.chat-header .reino-brand > .group-copy {
  flex: 0 1 auto;
  min-width: 0;
  margin-left: 0.7rem;
  text-align: left;
}

.chat-header .reino-brand h1 {
  text-align: left;
  cursor: pointer;
}

.chat-header .reino-brand h1 input {
  width: 11rem;
  max-width: 46vw;
  border: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.9);
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1.02rem;
  padding: 0 0 0.15rem;
  outline: none;
}

.chat-header .reino-brand h1 input::placeholder {
  color: rgba(255, 255, 255, 0.72);
}

.members-sheet .group-hero {
  width: 96px;
  height: 96px;
  justify-self: center;
  padding: 0;
  background: #dfe5e7;
  overflow: hidden;
}

.group-hero,
.group-hero img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto;
  object-fit: cover;
  display: block;
  border: 0;
  place-items: center;
  font-weight: 800;
  color: #075e54;
}

.share-screen {
  justify-content: flex-start;
}

.share-screen::before {
  display: none;
}

.share-form {
  display: grid;
  gap: 0.75rem;
  background: #fff;
  color: var(--wa-text);
  border-radius: 18px;
  padding: 0.9rem;
  width: 100%;
  max-width: 100%;
  box-shadow: 0 8px 24px var(--wa-shadow);
}

.share-drop {
  display: grid !important;
  place-items: center;
  gap: 0.2rem !important;
  min-height: 108px;
  border: 1.5px dashed rgba(0, 128, 105, 0.45);
  background: #f4faf8;
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
}

.share-drop-title {
  color: var(--wa-teal-dark);
  font-weight: 800;
  font-size: 1rem;
}

.share-drop-hint {
  color: var(--wa-muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.share-previews {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.share-previews:empty {
  display: none;
}

.share-preview {
  min-height: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f2f5;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: var(--wa-muted);
  padding: 0.35rem;
  text-align: center;
}

.share-preview img {
  width: 100%;
  height: 88px;
  object-fit: cover;
  display: block;
}

.share-form #corona,
.share-form button[type="submit"] {
  border: 0;
  border-radius: 999px;
  background: var(--wa-teal);
  color: #fff;
  font-weight: 700;
  min-height: 46px;
  cursor: pointer;
}

.share-form #back {
  border: 0;
  background: transparent;
  color: var(--wa-muted);
  font-weight: 700;
  cursor: pointer;
}

.share-form label {
  display: grid;
  gap: 0.3rem;
  font-weight: 700;
  font-size: 0.85rem;
}

.share-form input,
.share-form textarea {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: #f0f2f5;
  padding: 0.7rem 0.8rem;
  font: inherit;
}

.share-fold {
  border: 1px solid rgba(0, 128, 105, 0.28);
  border-radius: 16px;
  background: #f7fbfa;
  padding: 0.35rem 0.7rem 0.7rem;
}

.share-fold summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--wa-teal-dark);
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}

.share-fold summary::-webkit-details-marker {
  display: none;
}

.share-fold summary span {
  color: var(--wa-teal);
  font-size: 0.82rem;
}

.share-groups {
  display: grid;
  gap: 0.45rem;
}

.share-piece pre {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  font: inherit;
  background: #f0f2f5;
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
  color: var(--wa-text);
}

.share-choice {
  display: flex !important;
  width: 100%;
  font: inherit;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  min-height: 64px;
  border-radius: 16px;
  border: 1px solid rgba(0, 128, 105, 0.28);
  background: #fff;
  color: var(--wa-text);
  font-weight: 700 !important;
  font-size: 0.95rem;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  text-align: left;
}

.share-ball {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: #dfe5e7 center / cover no-repeat;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #075e54;
}

.share-copy {
  display: grid;
  gap: 0.1rem;
  flex: 1 1 auto;
  min-width: 0;
}

.share-copy strong,
.share-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-copy small {
  color: var(--wa-muted);
  font-weight: 600;
  font-size: 0.78rem;
}

.share-choice:has(input:checked) {
  background: #f4faf8;
  border-color: var(--wa-teal);
}

.share-choice:has(input:checked) .share-copy small {
  color: var(--wa-teal-dark);
}

.share-leave {
  border: 0;
  background: transparent;
  color: var(--wa-teal);
  font-weight: 800;
  cursor: pointer;
  flex: 0 0 auto;
}

.members-sheet .share-choice {
  margin-top: 0.45rem;
}

.share-choice input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  accent-color: currentColor;
}

.choices > button {
  line-height: 1.25;
}

.share-note {
  margin: 0;
  color: var(--wa-muted);
  font-size: 0.82rem;
}

.share-media {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.share-media img,
.share-media video {
  width: 100%;
  max-height: 220px;
  border-radius: 12px;
  object-fit: cover;
}

.share-publish {
  border: 0;
  border-radius: 999px;
  background: var(--wa-teal);
  color: #fff;
  font-weight: 700;
  min-height: 42px;
  cursor: pointer;
}

.dato-imagen {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 0.55rem;
  display: block;
}

.dato-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.55rem;
}

.dato-mas {
  margin: 0;
  border: 0;
  background: transparent;
  color: #008069;
  font-weight: 700;
  padding: 0.35rem 0;
  cursor: pointer;
  text-align: left;
}

.dato-acciones .share-publish {
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 0.4rem 0.9rem;
}

.bubble-text .share-publish {
  margin-top: 0.45rem;
  width: 100%;
}

.participants-title {
  margin: 0.2rem 0 0;
  font-weight: 800;
}

.group-name-line {
  text-align: center;
  font-size: 1.05rem;
  background: transparent;
}

.members-sheet .group-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid #e6eaee;
}

.members-sheet .group-profile .member-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex: 0 0 52px;
}

body.platform .avatar {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  cursor: pointer;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(
    145deg,
    var(--accent, #25d366),
    var(--header, #008069)
  );
  color: #fff;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.avatar.has-logo {
  background: #ffffff;
  padding: 3px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.avatar.has-logo img,
img.avatar.has-logo {
  object-fit: contain;
  background: #fff;
  padding: 4px;
}

.brand h1 {
  margin: 0;
  font-size: 1.02rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand p {
  margin: 0.1rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-redes-titulo {
  font-size: 0.68rem;
  letter-spacing: 0.01em;
}

.brand .escribiendo-vivo {
  display: none;
  margin: 0.02rem 0 0;
  padding: 0;
  min-height: 0;
  background: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.15;
}

.brand .escribiendo-vivo.on {
  display: block;
}

.header-redes {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  margin-top: 0.22rem;
}

.header-redes a {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  color: #111;
}

.header-redes svg {
  width: 13px;
  height: 13px;
  display: block;
}

.header-redes a.ig { color: #E1306C; }
.header-redes a.fb { color: #1877F2; }
.header-redes a.tt { color: #111; }
.header-redes a.xx { color: #111; }

.chat-messages {
  padding: 0.85rem;
  overflow-y: auto;
  overflow-anchor: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  scroll-behavior: smooth;
  background-color: var(--wa-chat-bg);
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 18px 18px;
  min-height: 0;
}

.chat-messages::before {
  content: "";
  flex: 1 1 auto;
  min-height: 0;
}

.msg-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 92%;
  min-width: 0;
}

.msg-row.msg-entra {
  animation: texto-llega 1s cubic-bezier(0.16, 0.84, 0.32, 1);
}

@keyframes texto-llega {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

@keyframes msg-llega {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.msg-row.bot {
  align-self: flex-start;
}

.msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-row.member {
  align-self: flex-start;
}

.chat-ball {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  line-height: 1;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: #1b73e8;
  box-shadow: 0 1px 1px rgba(11, 20, 26, 0.18);
}

.msg-row.user .chat-ball {
  background-color: #c2185b;
}

.msg-row.member .chat-ball {
  background-color: #6a1b9a;
}

.bubble-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.msg-row.bot .bubble-name {
  color: #1b73e8;
}

.msg-row.user .bubble-name {
  color: #c2185b;
}

.msg-row.member .bubble-name {
  color: #6a1b9a;
}

.bubble-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble-link,
.dis-burbuja a,
.dis-burbuja-btn a,
.dis-hilo a {
  color: #008069;
  text-decoration: underline;
  font-weight: 500;
  word-break: break-all;
}

.bubble-link:hover,
.dis-burbuja a:hover,
.dis-burbuja-btn a:hover {
  opacity: 0.85;
}

.feed-ig {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  background: #eef2f6;
  color: #111;
  box-sizing: border-box;
  overflow: hidden;
  touch-action: pan-y;
}

.feed-ig-barra {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 0.75rem 0.6rem;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  box-sizing: border-box;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  z-index: 2;
}

.feed-ig-barra-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.feed-ig-tabs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0;
}

.feed-ig-tabs .feed-ig-btn-cerrar {
  margin-left: auto;
}

.feed-ig-tabs::-webkit-scrollbar {
  display: none;
}

.feed-ig-vistas {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.feed-ig-tabs button,
.feed-ig-vistas button,
.feed-ig-btn-cerrar,
.feed-ig-barra > button {
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.feed-ig-btn-cerrar {
  font-weight: 600;
  color: #475569;
  background: #e2e8f0;
}

.feed-ig-tabs button.on,
.feed-ig-vistas button.on {
  background: #008069;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 128, 105, 0.25);
}

.feed-ig-scroll {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow-y: scroll !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain;
  touch-action: pan-y !important;
  display: block;
  padding: 0.75rem 0.75rem calc(1.2rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  background: #eef2f6;
}

.feed-ig-card {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-width: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  margin: 0 auto 0.85rem;
}

.feed-ig-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

.feed-ig-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #008069;
  background: #e6f4f1;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.feed-ig-card-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: min(72dvh, 36rem);
  background: #111;
  overflow: hidden;
}

.feed-ig-card-media img,
.feed-ig-card-media video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(72dvh, 36rem);
  object-fit: contain;
  object-position: center;
  background: #111;
}

/* Barra de acciones tipo Instagram debajo de la imagen */
.feed-ig-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.65rem 0.9rem 0.45rem;
  background: #ffffff;
  gap: 0.55rem;
}

.feed-ig-toolbar-redes {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.feed-ig-mision {
  flex: 1 1 8rem;
  min-width: 0;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #334155;
}

.feed-ig-mision strong {
  color: #111;
}

.feed-ig-mision-texto {
  font-weight: 400;
  font-style: italic;
  color: #c4a035;
}

.feed-ig-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.feed-ig-mision .feed-ig-nota:empty {
  display: none;
}

.feed-ig-mision .feed-ig-nota:not(:empty) {
  display: block;
  margin-top: 0.25rem;
}

.feed-ig-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #1e293b;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.feed-ig-icon-btn:hover {
  background: #f1f5f9;
}

.feed-ig-icon-btn:active {
  transform: scale(0.92);
  background: #e2e8f0;
}

.feed-ig-icon-btn .red-logo {
  width: 25px;
  height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.feed-ig-icon-btn .red-logo svg {
  width: 100%;
  height: 100%;
  display: block;
}

.feed-ig-btn-share {
  color: #0f172a;
}

.feed-ig-btn-share:hover {
  color: #008069;
}

.feed-ig-nota {
  color: #008069;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0 0.2rem;
  animation: fadeIn 0.2s ease;
}

/* Copy tipo Instagram con botón "más" */
.feed-ig-copy {
  padding: 0.35rem 0.95rem 0.65rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #1e293b;
  word-break: break-word;
}

.feed-ig-copy.truncado .feed-ig-copy-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}

.feed-ig-copy-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.feed-ig-ver-mas {
  display: inline;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.feed-ig-ver-mas:hover {
  color: #0f172a;
  text-decoration: underline;
}

.feed-ig-card-llamado {
  margin: 0.2rem 0.95rem 0.85rem;
  padding: 0.55rem 0.8rem;
  background: #f0fdf4;
  border-left: 3px solid #008069;
  border-radius: 4px;
  font-size: 0.84rem;
  font-weight: 500;
  color: #14532d;
}

.feed-ig-scroll.mosaico {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.75rem 0.75rem calc(1.2rem + env(safe-area-inset-bottom, 0px));
  background: #eef2f6;
}

.feed-ig-scroll.mosaico .feed-ig-card {
  max-width: none;
  margin: 0;
  cursor: pointer;
}

.feed-ig-scroll.mosaico .feed-ig-card-media {
  display: block;
  aspect-ratio: 1;
  max-height: none;
}

.feed-ig-scroll.mosaico .feed-ig-card-media img,
.feed-ig-scroll.mosaico .feed-ig-card-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
}

@media (min-width: 900px) {
  .feed-ig-scroll.mosaico {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.feed-ig-mosaico {
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  padding: 0.35rem;
  background: #0f172a center / cover no-repeat;
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  text-align: left;
  overflow: hidden;
  position: relative;
}

.feed-ig-mosaico::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
  pointer-events: none;
}

.feed-ig-mosaico span {
  position: relative;
  z-index: 1;
  color: #fff;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.feed-ig-vacio {
  margin: 2rem 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

.lista-grupos {
  display: grid;
  gap: 0.45rem;
}

.lista-grupos .grupo-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
  text-align: left;
  background: #fff;
  border: 1px solid #e6eaee;
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
}

.lista-grupos .grupo-foto {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: #e7f3ef center / cover no-repeat;
}

.lista-grupos strong,
.lista-grupos small {
  display: block;
}

.lista-grupos small {
  color: #667781;
  font-size: 0.78rem;
}

.bubble-media {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  margin-top: 0.25rem;
}

.bubble-qr {
  width: 148px;
  height: auto;
  background: #fff;
}

.medio-marco {
  position: relative;
  display: block;
  width: 100%;
}

.fuente-fija {
  position: absolute;
  left: 0.4rem;
  bottom: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  z-index: 1;
}

.fuente-fija a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #111b21;
  border: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.fuente-fija .red-logo {
  width: 18px;
  height: 18px;
}

.chat-ball.has-photo {
  overflow: hidden;
  padding: 0;
  background: #111;
}

.chat-ball.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  pointer-events: none;
}

.profile-page {
  display: grid;
  justify-items: stretch;
  align-content: start;
  gap: 0.75rem;
  padding: 0.85rem 0.85rem 1.25rem;
  text-align: center;
  color: var(--wa-text);
  overflow-y: auto;
  background: #efeae2;
}

.profile-logo,
.profile-photo {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  background: #111;
}
.profile-logo {
  object-fit: contain;
  background: #fff;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(11, 20, 26, 0.12);
}

.profile-photo {
  border-radius: 50%;
}

.profile-stats {
  width: 100%;
  display: grid;
  gap: 0.35rem;
  margin: 0.4rem 0 0.2rem;
  text-align: left;
}

.profile-stats p {
  margin: 0;
  max-width: none;
}

.invite-link {
  user-select: all;
  word-break: break-all;
  background: #f4f7f6;
  color: #111b21;
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  font-size: 0.88rem;
}

.perfil-invitacion {
  display: grid;
  gap: 0.7rem;
  justify-items: stretch;
  width: 100%;
  min-width: 0;
}

.perfil-invitacion .invite-link {
  width: 100%;
  max-width: none;
  margin: 0;
  text-align: left;
}

.perfil-qr {
  display: block;
  width: min(100%, 220px);
  height: auto;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
}

.perfil-invitacion-acciones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  width: 100%;
}

.perfil-invitacion-acciones button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: #e7f6f2;
  color: #075e54;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.perfil-invitacion-acciones button.primary {
  background: #008069;
  color: #fff;
}

.invite-qr {
  display: block;
  width: min(240px, 100%);
  height: auto;
  background: #fff;
  border-radius: 8px;
  image-rendering: pixelated;
}

.share-card {
  display: grid;
  gap: 0.35rem;
  width: min(240px, 100%);
  color: inherit;
  text-decoration: none;
}

.share-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: #fff;
}

.share-card strong,
.share-card span,
.share-card small {
  display: block;
}

.share-card small {
  color: #667781;
  word-break: break-all;
}

.profile-form {
  width: 100%;
  display: grid;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.profile-form input[type="text"] {
  width: 100%;
  border: 1px solid var(--wa-line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  font: inherit;
}

.profile-form button,
.profile-file {
  border: 0;
  border-radius: 12px;
  background: var(--header);
  color: #fff;
  font-weight: 700;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
}

.profile-file {
  display: inline-block;
  text-align: center;
  background: #fff;
  color: var(--wa-teal);
  border: 1px solid rgba(0, 128, 105, 0.35);
}

.profile-choices {
  justify-content: center;
  padding: 0.35rem 0 0;
  background: transparent;
  max-height: none;
  overflow: visible;
}

.profile-note {
  min-height: 1.2rem;
  color: var(--wa-muted);
  font-size: 0.85rem;
}

.community {
  width: 100%;
  display: grid;
  gap: 0.45rem;
  text-align: left;
  margin-top: 0.35rem;
}

.community p {
  margin: 0;
  max-width: none;
}

.community-person {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  border: 0;
  background: #f7f8f8;
  border-radius: 16px;
  padding: 0.55rem 0.7rem;
  color: #111b21;
  font: inherit;
  text-align: left;
}

button.community-person {
  cursor: pointer;
}

.community-person .chat-ball {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.profile-socials {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.profile-socials button {
  border: 1px solid rgba(0, 128, 105, 0.35);
  background: #fff;
  color: var(--wa-teal);
  border-radius: 999px;
  padding: 0.65rem 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.profile-socials button.active {
  background: var(--wa-teal);
  color: #fff;
}

.profile-page h2 {
  margin: 0.35rem 0 0;
  font-size: 1.2rem;
}

.profile-page p {
  margin: 0;
  max-width: 22rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.profile-ball {
  width: 72px;
  height: 72px;
  font-size: 1.6rem;
  cursor: default;
}

.profile-back-bar {
  padding: 0.65rem 0.85rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: #efeae2;
}

.profile-back {
  display: block;
  width: 100%;
  max-width: none;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #075e54;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(11, 20, 26, 0.08);
  cursor: pointer;
}

.profile-sheet {
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 5.5rem;
  z-index: 25;
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  padding: 1rem 1rem 0.85rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 40px var(--wa-shadow);
  color: var(--wa-text);
  text-align: center;
}

.profile-sheet[hidden] {
  display: none;
}

.profile-sheet h2 {
  margin: 0.2rem 0 0;
  font-size: 1.05rem;
}

.profile-sheet p {
  margin: 0;
  line-height: 1.4;
}

.profile-sheet .chat-ball {
  width: 52px;
  height: 52px;
  font-size: 1.15rem;
  cursor: default;
}

.profile-sheet button.close-profile {
  margin-top: 0.35rem;
  border: 0;
  border-radius: 12px;
  background: var(--header);
  color: #fff;
  font-weight: 700;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

.bubble {
  max-width: 100%;
  min-width: 0;
  padding: 0.4rem 0.7rem 0.5rem;
  border-radius: 12px;
  line-height: 1.35;
  font-size: 0.95rem;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  color: var(--wa-text);
}

.bubble.bot,
.bubble.member {
  background: #fff;
  border-top-left-radius: 4px;
}

.bubble.user {
  background: #d9fdd3;
  color: var(--wa-text);
  border-top-right-radius: 4px;
}

.msg-row .bubble {
  max-width: none;
}

.escribiendo-fila {
  animation: texto-llega 0.35s ease;
}

.escribiendo-fila.sale {
  animation: texto-sale 0.28s ease forwards;
}

@keyframes texto-sale {
  to { opacity: 0; transform: translateY(8px); }
}

.puntos {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-width: 2.4rem;
  min-height: 1.1rem;
}

.puntos span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #667781;
  animation: punto 1.1s ease-in-out infinite;
}

.puntos span:nth-child(2) { animation-delay: 0.15s; }
.puntos span:nth-child(3) { animation-delay: 0.3s; }

@keyframes punto {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  padding: 0 0.85rem 0.75rem;
  background: var(--wa-chat-bg);
  max-height: calc(var(--app-height, 100dvh) * 0.5);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  min-height: 0;
  align-content: start;
  animation: choices-panel-entra 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.choices[hidden] {
  display: none !important;
}

@keyframes choices-panel-entra {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cuando hay selector de marca, ocupamos bien el panel y dejamos acciones fijas abajo */
.choices:has(.brand-picker) {
  display: block;
  max-height: min(52dvh, 420px);
  padding-bottom: 0.5rem;
}

.choices > button.con-marca {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.red-logo {
  display: inline-flex;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.red-logo svg {
  width: 100%;
  height: 100%;
  display: block;
}

.redes-pieza {
  display: grid;
  gap: 0.45rem;
}

.redes-pieza p {
  margin: 0;
  font-size: 0.82rem;
}

.redes-pieza-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.redes-pieza-logos a {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #111b21;
  border: 1px solid #d1d7db;
}

.redes-pieza-logos .red-logo {
  width: 22px;
  height: 22px;
}

.choices > button {
  animation: boton-opcion-entra 0.38s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  position: relative;
  width: 100%;
  min-width: 0;
  white-space: normal;
  text-align: center;
  border: 1px solid rgba(0, 128, 105, 0.35);
  background: #fff;
  color: var(--wa-teal);
  border-radius: 999px;
  padding: 0.7rem 0.85rem;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.choices > button:active {
  transform: scale(0.98);
}

@keyframes boton-opcion-entra {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.msg-pop {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

.choices > button.primary {
  background: var(--wa-teal);
  color: #fff;
  border-color: var(--wa-teal);
}

.choices > button.elegida {
  background: var(--wa-teal);
  color: #fff;
  border-color: var(--wa-teal);
}

.salomon-redes {
  margin-top: 0.75rem;
}

.salomon-redes-titulo {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: #667781;
}

.salomon-redes-iconos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.salomon-redes-iconos a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 128, 105, 0.1);
  color: #008069;
}

.salomon-redes-iconos svg {
  width: 18px;
  height: 18px;
  display: block;
}

.encuesta-terminos {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: flex-start;
  background: #fff;
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #111b21;
}

.encuesta-terminos input {
  margin-top: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.encuesta-terminos a,
.ver-mas-legal {
  color: #008069;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.legal-leido {
  display: block;
  flex: 1 1 100%;
  margin-top: 0.45rem;
  white-space: pre-line;
  color: #111b21;
  font-weight: 500;
}

.brand-picker {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: inherit;
  min-height: 0;
}

.brand-picker-scroll {
  display: grid;
  gap: 0.55rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  max-height: min(38dvh, 300px);
  padding-bottom: 0.25rem;
}

.brand-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  position: sticky;
  bottom: 0;
  padding: 0.45rem 0 0.15rem;
  background: linear-gradient(to top, var(--wa-chat-bg) 70%, transparent);
  z-index: 2;
}

.brand-picker-actions > button {
  border: 1px solid rgba(0, 128, 105, 0.35);
  background: #fff;
  color: var(--wa-teal);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.brand-picker-actions > button.primary {
  background: var(--wa-teal);
  border-color: var(--wa-teal);
  color: #fff;
}

.chat-input {
  min-width: 0;
  padding: 0.55rem 0.65rem 0.7rem;
  border-top: 0;
  background: var(--wa-panel);
}

.reino-lane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.reino-lane[hidden] {
  display: none;
}

.reino-lane button {
  border: 1px solid rgba(0, 128, 105, 0.35);
  background: #fff;
  color: var(--wa-teal);
  border-radius: 999px;
  padding: 0.55rem 0.6rem;
  min-height: 40px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.reino-lane button.active {
  background: var(--wa-teal);
  border-color: var(--wa-teal);
  color: #fff;
}

.terms {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0 0.15rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--wa-text);
}

.terms[hidden] {
  display: none;
}

.seal {
  color: var(--wa-teal);
  font-size: 1.25rem;
  font-weight: 700;
  padding-left: 0.15rem;
}

.seal[hidden] {
  display: none;
}

.terms input {
  margin-top: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.terms a {
  color: var(--wa-teal);
}

.chat-input form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.chat-input form input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: #fff;
  color: #111b21;
  -webkit-text-fill-color: #111b21;
  caret-color: #008069;
  border-radius: 24px;
  padding: 0.75rem 1rem;
  outline: none;
  font-size: 16px;
  opacity: 1;
  box-shadow: 0 1px 1px rgba(11, 20, 26, 0.06);
}

.chat-input form input::placeholder {
  color: var(--wa-muted);
}

.chat-input button {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--wa-teal);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
}

.menu-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.menu-list a {
  display: block;
  text-decoration: none;
  color: var(--wa-teal-dark);
  background: #f0f2f5;
  border: 1px solid var(--wa-line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font-weight: 600;
}

/* Selector de marca: paleta + previews */
.brand-picker-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--wa-muted);
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  padding: 0;
  position: relative;
  min-height: 40px;
}

.color-swatch.selected::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 50%;
}

.color-swatch:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.theme-cards {
  display: grid;
  gap: 0.45rem;
}

.theme-card {
  width: 100%;
  border: 1.5px solid var(--wa-line);
  background: #fff;
  border-radius: 12px;
  padding: 0.45rem;
  cursor: pointer;
  text-align: left;
  min-height: unset;
  color: inherit;
  font-weight: 500;
}

.theme-card.selected {
  border-color: var(--wa-teal);
  box-shadow: 0 0 0 2px rgba(0, 128, 105, 0.2);
}

.theme-card-preview {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.theme-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.theme-card-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.theme-card-body {
  background: #efeae2;
  padding: 0.4rem;
  display: grid;
  gap: 0.25rem;
}

.theme-card-bubble {
  max-width: 78%;
  padding: 0.28rem 0.45rem;
  border-radius: 7px;
  font-size: 0.68rem;
  line-height: 1.25;
}

.theme-card-bubble.in {
  background: #fff;
  color: #111b21;
  justify-self: start;
}

.theme-card-bubble.out {
  justify-self: end;
  color: #111b21;
}

.theme-card-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--wa-muted);
}

.theme-card-chip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.brand-editable {
  cursor: pointer;
}

.brand-editable:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.avatar.brand-editable:active {
  transform: scale(0.96);
}

/* Perfil comercio (estilo IdealPet: editar identidad con preview en header) */
.perfil-sheet {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
}

.perfil-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 20, 26, 0.45);
}

.perfil-sheet-panel {
  position: relative;
  z-index: 1;
  max-height: min(88%, 640px);
  overflow: hidden;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 0.85rem 0.85rem 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
}

.perfil-sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  flex: 1;
  display: grid;
  gap: 0.65rem;
  padding-right: 0.1rem;
}

.perfil-footer {
  display: flex;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.55rem 0 calc(0.9rem + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--wa-line);
}

.perfil-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
}

.perfil-hero-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--header));
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.perfil-hero-avatar.has-logo {
  background: #fff;
  padding: 4px;
}

.perfil-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.perfil-hero-text {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}

.perfil-hero-text strong {
  font-size: 1.05rem;
  color: var(--wa-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.perfil-hero-text span {
  font-size: 0.78rem;
  color: var(--wa-muted);
}

.perfil-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f0f2f5;
  color: #111b21;
  cursor: pointer;
  font-size: 0.95rem;
}

.perfil-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--wa-muted);
  line-height: 1.35;
}

.perfil-rows {
  display: grid;
  gap: 0.35rem;
}

.perfil-row {
  width: 100%;
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 0.45rem;
  align-items: center;
  text-align: left;
  border: 1px solid var(--wa-line);
  background: #f8faf9;
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  cursor: pointer;
  min-height: 48px;
  color: inherit;
  font: inherit;
}

.perfil-row-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--wa-muted);
}

.perfil-row-value {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.86rem;
  color: var(--wa-text);
}

.perfil-row-value > span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.perfil-row-chips {
  display: inline-flex;
  gap: 3px;
  flex-shrink: 0;
}

.perfil-row-chips i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.perfil-row-edit {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--wa-teal);
}

.perfil-btn {
  flex: 1;
  border: 1px solid rgba(0, 128, 105, 0.35);
  background: #fff;
  color: var(--wa-teal);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  min-height: 44px;
  font-weight: 700;
  cursor: pointer;
}

.perfil-btn.primary {
  background: var(--wa-teal);
  border-color: var(--wa-teal);
  color: #fff;
}

a.perfil-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}

.perfil-btn.danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff5f5;
}

.perfil-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0 0.1rem 0.15rem;
  -webkit-overflow-scrolling: touch;
}

.perfil-tab {
  flex: 0 0 auto;
  border: 1px solid var(--wa-line);
  background: #f0f2f5;
  color: var(--wa-muted);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.perfil-tab.active {
  background: var(--wa-teal);
  border-color: var(--wa-teal);
  color: #fff;
}

.perfil-cards-panel .perfil-sheet-body {
  padding-bottom: 0.25rem;
}

.agag-card-list {
  display: grid;
  gap: 0.5rem;
}

.agag-card {
  border: 1px solid var(--wa-line);
  background: #f8faf9;
  border-radius: 14px;
  padding: 0.75rem;
}

.agag-card-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
}

.agag-card h4 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  color: var(--wa-text);
}

.agag-card p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--wa-muted);
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.agag-card-meta {
  margin-top: 0.35rem !important;
  font-size: 0.74rem !important;
}

.agag-card-edit {
  border: 0;
  background: transparent;
  color: var(--wa-teal);
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.2rem 0.15rem;
}

.agag-add-card {
  width: 100%;
  border: 1.5px dashed rgba(0, 128, 105, 0.45);
  background: #fff;
  color: var(--wa-teal);
  border-radius: 14px;
  padding: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 48px;
}

.agag-card-form {
  display: grid;
  gap: 0.55rem;
  background: #fff;
  border-color: rgba(0, 128, 105, 0.35);
}

.agag-card-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--wa-muted);
}

.agag-card-form input,
.agag-card-form textarea {
  width: 100%;
  border: 1px solid var(--wa-line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  font-weight: 500;
  color: var(--wa-text);
  background: #fff;
}

.agag-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.agag-card-actions .perfil-btn {
  flex: 1;
  min-width: 100px;
}

.agag-check-group {
  display: grid;
  gap: 0.35rem;
}

.agag-check-group > span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--wa-muted);
}

.agag-checks {
  display: grid;
  gap: 0.3rem;
}

.agag-check {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600 !important;
  color: var(--wa-text) !important;
  font-size: 0.86rem !important;
}

.agag-form-note {
  margin: 0;
  font-size: 0.74rem;
  color: var(--wa-muted);
  line-height: 1.35;
}

.agag-disp-chip {
  margin-top: 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--wa-line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: start;
}

.agag-disp-chip strong {
  display: block;
  font-size: 0.82rem;
  color: var(--wa-text);
}

.agag-disp-chip span {
  display: block;
  font-size: 0.72rem;
  color: var(--wa-muted);
  margin-top: 0.15rem;
}
