:root {
  --bg0: #e8f3ef;
  --bg1: #f7f1e8;
  --ink: #1c2b28;
  --muted: #5a6b66;
  --brand: #0f766e;
  --brand-2: #c45c26;
  --card: rgba(255, 255, 255, 0.78);
  --line: rgba(28, 43, 40, 0.1);
  --guide: #ecf8f5;
  --user: #fff7ed;
  --danger: #b42318;
  --radius: 18px;
  --font: "Segoe UI", "Nunito", system-ui, sans-serif;
  --font-size-base: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --touch-min: 44px;
  --header-logo: 44px;
  --msg-avatar: 36px;
}

* { box-sizing: border-box; }

html {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: var(--font-size-base);
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #b7e4d8 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #f6d6b8 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}

a { color: var(--brand); }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: calc(1.5rem + var(--safe-bottom) + 2rem);
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Evitar centrado vertical que corta el scroll en móviles */
.wrap.centered {
  justify-content: flex-start;
  padding-top: 1.25rem;
}

@media (min-width: 768px) {
  .wrap.centered {
    justify-content: center;
    min-height: 100dvh;
    padding-top: 1rem;
  }
}

.brand {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: .5rem;
  flex-shrink: 0;
}
.brand .logo {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #134e4a);
  color: #fff; font-size: 1.35rem;
  box-shadow: 0 8px 24px rgba(15, 118, 110, .25);
  flex-shrink: 0;
}
.brand .logo.logo-photo {
  padding: 0;
  overflow: hidden;
  background: #134e4a;
}
.brand .logo.logo-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-photo-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: .5rem 0 1rem;
}
.profile-photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand), #134e4a);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.8rem;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(15, 118, 110, .2);
}
.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-photo-actions {
  flex: 1;
  min-width: 0;
}
.profile-photo-actions .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .5rem;
}
.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), #134e4a);
  color: #fff;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand h1 { font-size: 1.35rem; margin: 0; letter-spacing: -.02em; }
.brand p { margin: 0; color: var(--muted); font-size: .9rem; }

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: 0 10px 30px rgba(28, 43, 40, .06);
  flex-shrink: 0;
}

label { display: block; font-size: .85rem; color: var(--muted); margin: .7rem 0 .3rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem .9rem;
  font: inherit;
  background: #fff;
  font-size: 16px; /* evita zoom raro en iOS */
}
button, .btn {
  appearance: none; border: 0; cursor: pointer;
  background: var(--brand); color: #fff;
  border-radius: 999px; padding: .75rem 1.1rem;
  font: inherit; font-weight: 600;
}
button.secondary, .btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.ghost { background: transparent; color: var(--brand); }
.err { color: var(--danger); font-size: .9rem; margin: .5rem 0; }
.ok { color: #067647; font-size: .9rem; margin: .5rem 0; }
.muted { color: var(--muted); font-size: .85rem; }

/* Login / recuperar clave — cálido, cercano, legible en cualquier dispositivo */
body.page-auth {
  font-family: "Nunito", var(--font);
  font-size: 1.05rem;
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.1rem;
  padding-top: calc(1.5rem + var(--safe-top));
  padding-bottom: calc(1.5rem + var(--safe-bottom));
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body.page-auth .wrap,
body.page-auth .wrap.centered,
body.page-auth .auth-shell {
  max-width: 26rem;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  min-height: 0;
  display: block;
}
.auth-hero {
  text-align: center;
  margin: 0 0 1.15rem;
}
.auth-avatar {
  width: 6.5rem;
  height: 6.5rem;
  margin: 0 auto .45rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow:
    0 10px 28px rgba(15, 118, 110, .22),
    0 0 0 6px rgba(15, 118, 110, .1);
  background: #134e4a;
}
.auth-guide-name {
  margin: 0 0 .75rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--brand);
}
.auth-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.auth-avatar-soft {
  opacity: .55;
  transform: scale(.88);
  box-shadow:
    0 6px 16px rgba(15, 118, 110, .12),
    0 0 0 4px rgba(15, 118, 110, .06);
}
.auth-avatar-fallback {
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), #134e4a);
}
.auth-kicker {
  margin: 0 0 .2rem;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand);
}
.auth-title {
  margin: 0 0 .4rem;
  font-size: clamp(1.45rem, 5.2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  color: var(--ink);
}
.auth-sub {
  margin: 0 auto;
  max-width: 22rem;
  font-size: .95rem;
  line-height: 1.45;
  color: var(--muted);
}
.auth-dot { margin: 0 .2rem; opacity: .7; }
.auth-away-line {
  margin: .55rem auto 0;
  max-width: 22rem;
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.4;
  color: #0f766e;
}
.auth-card.card {
  padding: 1.35rem 1.25rem 1.45rem;
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(28, 43, 40, .08);
  box-shadow: 0 12px 36px rgba(28, 43, 40, .08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.auth-lead {
  margin: 0 0 .85rem;
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--ink);
}
body.page-auth .auth-form label {
  display: block;
  font-size: .95rem;
  margin: .75rem 0 .35rem;
  color: var(--ink);
  font-weight: 700;
}
body.page-auth .auth-form label:first-of-type { margin-top: .15rem; }
body.page-auth .auth-form input {
  display: block;
  width: 100%;
  font-size: 1.08rem;
  font-family: inherit;
  padding: .95rem 1rem;
  min-height: 3.15rem;
  border-radius: 14px;
  border: 1.5px solid rgba(28, 43, 40, .16);
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}
body.page-auth .auth-form input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, .55);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .16);
}
body.page-auth .auth-form input::placeholder {
  color: #8a9a95;
}
.auth-actions {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-top: 1.15rem;
}
body.page-auth .auth-submit,
body.page-auth .auth-actions .btn {
  width: 100%;
  min-height: 3.2rem;
  font-size: 1.08rem;
  font-weight: 750;
  font-family: inherit;
  border-radius: 999px;
  justify-content: center;
  text-align: center;
}
body.page-auth .auth-submit {
  border: 0;
  background: linear-gradient(135deg, var(--brand), #0d5f59);
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .28);
  cursor: pointer;
}
body.page-auth .auth-forgot {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid rgba(28, 43, 40, .14);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.auth-switch {
  margin: .9rem 0 0;
  text-align: center;
  font-size: .88rem;
}
.auth-switch a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: .15em;
  font-weight: 650;
}
.auth-switch a:hover {
  color: var(--brand);
}
.auth-foot {
  margin: 1rem 0 0;
  text-align: center;
  font-size: .88rem;
  line-height: 1.4;
}
body.page-auth .err,
body.page-auth .ok {
  font-size: .95rem;
  margin: 0 0 .75rem;
  padding: .65rem .75rem;
  border-radius: 12px;
}
body.page-auth .ok {
  background: #ecfdf5;
  border: 1px solid rgba(6, 118, 71, .2);
}
body.page-auth .err {
  background: #fef3f2;
  border: 1px solid rgba(180, 35, 24, .18);
}
@media (max-width: 480px) {
  body.page-auth {
    align-items: flex-start;
    padding-top: calc(1.75rem + var(--safe-top));
  }
  .auth-avatar {
    width: 5.75rem;
    height: 5.75rem;
  }
  .auth-title {
    font-size: 1.55rem;
  }
}
@media (min-width: 720px) {
  .auth-avatar {
    width: 7.25rem;
    height: 7.25rem;
  }
}

.app-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: .5rem; margin-bottom: .5rem;
  flex-shrink: 0;
}
.app-header nav,
.app-nav-desktop,
.chat-nav-desktop { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.app-nav-desktop .btn.nav-active,
.app-nav-desktop a.nav-active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--guide);
}
.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.85);
  color: var(--ink);
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: none;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(28, 43, 40, .06);
  flex-shrink: 0;
}
.menu-fab-bars,
.menu-fab-bars::before,
.menu-fab-bars::after {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  content: "";
}
.menu-fab-bars {
  position: relative;
}
.menu-fab-bars::before {
  position: absolute;
  top: -5px;
  left: 0;
}
.menu-fab-bars::after {
  position: absolute;
  top: 5px;
  left: 0;
  content: "";
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}
.ai-status-line {
  margin-top: .2rem !important;
  font-size: .78rem !important;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.status-dot.on { background: #12b76a; box-shadow: 0 0 0 3px rgba(18,183,106,.18); }
.status-dot.warn { background: #f79009; }
.status-dot.off { background: #f04438; }
.app-menu-sheet,
.app-menu-backdrop,
.chat-menu-sheet,
.chat-menu-backdrop { display: none; }
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
}

/* Chat: viewport fijo — scrollea solo #messages, el header queda visible */
body.page-chat {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
body.page-chat .wrap.chat-layout {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: .65rem;
  padding-bottom: calc(.55rem + var(--safe-bottom));
  overflow: hidden;
  max-width: 960px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
/* Móvil / PWA: ancho completo (clase puesta por JS, no solo media-query) */
html.psico-phone body.page-chat .wrap.chat-layout {
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
body.page-chat .chat-toolbar {
  flex-shrink: 0;
  margin-bottom: .45rem;
  padding: .55rem .75rem;
}
body.page-chat .chat-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0;
}
.chat-main-row {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: .55rem;
  align-items: stretch;
}
.chat-main-row > .chat-shell {
  flex: 1 1 auto;
  min-width: 0;
}
.chat-shell {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ask-now-btn,
.contribute-now-btn {
  padding: .4rem .85rem;
  font-size: .82rem;
}
.contribute-now-btn {
  border-color: rgba(15, 118, 110, .35);
}
.label-short { display: none; }
.label-full { display: inline; }
.pending-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: .2rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
}
.pending-panel {
  flex: 0 0 240px;
  width: 240px;
  max-width: 42%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: .65rem .7rem;
  overflow: hidden;
}
.pending-panel.collapsed {
  display: none;
}
.pending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  margin-bottom: .35rem;
}
.pending-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: .1rem .35rem;
}
.pending-intro { margin: 0 0 .5rem; font-size: .78rem; }
.pending-list {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-height: 0;
}
.pending-item {
  padding: .55rem .6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.65);
}
.pending-q {
  margin: 0 0 .45rem;
  font-size: .9rem;
  line-height: 1.4;
  font-weight: 600;
}
.pending-context {
  margin: 0 0 .4rem;
  font-size: .78rem;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pending-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .65rem;
  margin-bottom: .35rem;
}
.pending-topic {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  max-width: 100%;
  padding: .15rem .5rem;
  font-size: .72rem;
  font-weight: 700;
  color: #0f766e;
  letter-spacing: .01em;
  text-transform: none;
  background: rgba(15, 118, 110, .1);
  border-radius: 999px;
}
.pending-topic.is-shared {
  color: #1d4ed8;
  background: rgba(29, 78, 216, .1);
}
.pending-when {
  display: inline-block;
  font-size: .72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
}
.pending-actions .btn {
  padding: .28rem .65rem;
  font-size: .72rem;
}
.pending-skip-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .72rem;
  cursor: pointer;
  text-decoration: underline;
}
.pending-empty { margin: .4rem 0; font-size: .82rem; }
.answer-hint {
  margin: .25rem 0 0;
  font-size: .78rem;
}
/* Backdrop del sheet de pendientes (móvil) */
.pending-backdrop {
  display: none;
}

.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  min-height: 0;
  height: auto;
  max-height: none;
}
.chat-load-earlier {
  display: flex;
  justify-content: center;
  padding: .15rem 0 .35rem;
  flex-shrink: 0;
}
.chat-load-earlier .btn {
  padding: .4rem .9rem;
  font-size: .82rem;
  font-weight: 600;
}
.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .75rem;
  align-items: flex-end;
}
/* En columna móvil NO usar flex-grow: hincha el toolbar (hueco vacío en Samsung) */
.toolbar-space { flex: 1 1 180px; min-width: 0; }
body.page-chat .toolbar-space { flex: 0 0 auto; width: 100%; max-width: 100%; }
.toolbar-space label { display: block; margin-bottom: .2rem; }
.toolbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .85rem;
  margin-top: .4rem;
}
body.page-chat .toolbar-meta { flex: 0 0 auto; width: 100%; }
.chat-tips {
  font-size: .8rem;
  color: var(--muted);
}
.chat-tips summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
}
.chat-tips .tone-hint { margin: .35rem 0 0; }
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: .45rem;
  max-width: 100%;
}
.msg-row.guide { align-self: flex-start; }
.msg-row.user { align-self: flex-end; justify-content: flex-end; }
.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(15, 118, 110, .2);
  border: 2px solid #fff;
  background: #134e4a;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.msg-avatar:hover,
.msg-avatar:focus-visible {
  transform: scale(1.08);
  box-shadow: 0 3px 12px rgba(15, 118, 110, .32);
  outline: none;
}
.avatar-lightbox {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 22, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
  animation: avatarLbIn .18s ease;
}
.avatar-lightbox[hidden] { display: none !important; }
.avatar-lightbox img {
  width: min(78vw, 22rem);
  height: min(78vw, 22rem);
  max-width: 100%;
  max-height: min(70vh, 22rem);
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
  background: #134e4a;
  cursor: zoom-out;
}
.avatar-lightbox-close {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #134e4a;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}
@keyframes avatarLbIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.bubble {
  max-width: 92%;
  padding: .85rem 1rem;
  border-radius: 16px;
  white-space: pre-wrap;
  line-height: 1.45;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.msg-row .bubble { max-width: 100%; }
.msg-row.guide .bubble { max-width: min(92%, calc(100% - 44px)); }
.bubble.guide { align-self: flex-start; background: var(--guide); border-bottom-left-radius: 6px; }
.bubble.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 6px; }
.guide-avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: .75rem;
  margin-top: .5rem;
}
.guide-avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .35rem;
  padding: .85rem .6rem;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  margin: 0;
}
.guide-avatar-card input { position: absolute; opacity: 0; pointer-events: none; }
.guide-avatar-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 4px 14px rgba(15, 118, 110, .18);
}
.guide-avatar-card strong { font-size: .92rem; }
.guide-avatar-card .muted { font-size: .75rem; line-height: 1.35; }
.guide-avatar-card.active,
.guide-avatar-card:has(input:checked) {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
  background: rgba(15, 118, 110, .04);
}
.bubble .meta {
  margin-top: .45rem;
  font-size: .75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .28rem;
  flex-wrap: wrap;
}
.bubble.user .meta { justify-content: flex-end; }
.bubble.guide .meta { justify-content: flex-start; }
.wa-ticks {
  display: inline-flex;
  align-items: center;
  letter-spacing: -.42em;
  line-height: 1;
  font-size: .92em;
  color: #9ca3af;
  user-select: none;
}
.wa-ticks .tick {
  font-style: normal;
  font-weight: 700;
  font-family: system-ui, Segoe UI, sans-serif;
}
.wa-ticks.pending .tick2 { display: none; }
.wa-ticks.pending { color: #9ca3af; }
.wa-ticks.received,
.wa-ticks.processing,
.wa-ticks.delivered { color: #9ca3af; }
.wa-ticks.ready { color: #0f766e; }
.wa-ticks.read { color: #53bdeb; }
.wa-ticks.failed { color: #b42318; }
.wa-ticks.processing { opacity: .85; }
.bubble-error {
  border-color: rgba(180, 35, 24, .35);
  background: #fff5f4;
}
.retry-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
  border-radius: 999px;
  padding: .28rem .7rem;
  font: inherit;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: .45rem;
  margin-right: .35rem;
}
.retry-btn:hover { border-color: var(--brand); }
.retry-btn:disabled { opacity: .55; cursor: wait; }
.bubble .en { margin-top: .35rem; font-size: .8rem; color: #0f766e; font-style: italic; }
.auto-listen {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--muted);
  margin-top: .45rem;
}
.auto-listen input { width: auto; margin: 0; }

/* Reproductor estilo WhatsApp */
.wa-audio {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-top: .55rem;
  padding: .4rem .5rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, .08);
  border: 1px solid rgba(15, 118, 110, .12);
  max-width: 100%;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.wa-audio .wa-wave { min-width: 40px; flex: 1 1 60px; }
.wa-audio .wa-speed { flex: 0 0 auto; }
.bubble.user .wa-audio {
  background: rgba(196, 92, 38, .1);
  border-color: rgba(196, 92, 38, .15);
}
.wa-play, .wa-speed {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  line-height: 1;
}
.wa-speed {
  width: auto;
  min-width: 34px;
  padding: 0 .45rem;
  font-size: .72rem;
  background: #fff;
  color: var(--brand);
  border: 1px solid rgba(15, 118, 110, .25);
}
.wa-audio.playing .wa-play,
.wa-audio.loading .wa-play {
  background: #0b5f58;
}
.wa-wave {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(15, 118, 110, .18);
  overflow: hidden;
  position: relative;
  min-width: 60px;
}
.wa-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--brand);
  border-radius: 999px;
  transition: width .1s linear;
}
.wa-time {
  flex-shrink: 0;
  font-size: .7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 3.2rem;
}

/* Composer estilo WhatsApp */
.composer {
  display: flex;
  align-items: flex-end;
  gap: .4rem;
  margin-top: .75rem;
  flex-shrink: 0;
  padding: .35rem 0 .25rem;
}
.composer .wa-field {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: .25rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: .25rem .35rem .25rem .55rem;
  min-height: 48px;
  box-shadow: 0 1px 2px rgba(28, 43, 40, .04);
}
.composer textarea {
  flex: 1;
  min-height: 36px;
  max-height: 120px;
  resize: none;
  border: 0;
  padding: .55rem .35rem;
  background: transparent;
  outline: none;
  box-shadow: none;
  line-height: 1.35;
}
.wa-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}
.wa-icon:hover { color: var(--brand); background: rgba(15, 118, 110, .06); }
.wa-icon.rec {
  background: #ef4444;
  color: #fff;
  animation: wa-pulse 1.1s ease-in-out infinite;
}
.wa-send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--brand);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 118, 110, .28);
}
.wa-send:disabled {
  opacity: .45;
  cursor: default;
  box-shadow: none;
}
.wa-rec-hint {
  display: none;
  font-size: .78rem;
  color: var(--danger);
  padding: 0 .2rem .35rem;
  width: 100%;
}
.composer.recording .wa-rec-hint { display: block; }
@keyframes wa-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Composer: SIEMPRE una sola fila (como WhatsApp). Nunca wrap. */
@media (max-width: 520px) {
  .composer {
    flex-wrap: nowrap;
    align-items: flex-end;
  }
  .composer .wa-field {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }
  .composer .wa-icon,
  .composer .wa-send {
    flex-shrink: 0;
  }
}

.switch-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 0; border-bottom: 1px solid var(--line);
  gap: .75rem;
}
.switch-row:last-child { border-bottom: 0; }

/* Toggle estilo guía: Suave | De libro | Espiritual */
.tone-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  margin-top: 0;
}
.tone-bar > span,
.tone-label {
  font-size: .8rem;
  color: var(--muted);
  margin-right: .1rem;
}
.tone-seg {
  display: inline-flex;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  max-width: 100%;
}
.tone-seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: .4rem .7rem;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}
.tone-seg button.active {
  background: var(--brand);
  color: #fff;
}
.tone-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.35;
}
.tone-hint-live {
  margin: .15rem 0 .45rem;
  padding: 0 .15rem;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Velocidad de escucha (Perfil) — siempre a la vista */
.speed-seg {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .35rem;
}
.speed-seg .speed-opt {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: .45rem .7rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  min-width: 3.1rem;
}
.speed-seg .speed-opt.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.speed-seg .speed-opt:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.stats-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: end;
}
.stats-filters > div { flex: 1 1 140px; }
.stats-filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  flex: 2 1 220px;
}
.stats-filters-actions .btn,
.stats-filters-actions button {
  padding: .55rem .85rem;
  font-size: .85rem;
}
.stats-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .65rem;
  margin-bottom: 1rem;
}
.stats-kpi strong {
  display: block;
  font-size: 1.45rem;
  margin: .15rem 0;
  letter-spacing: -.02em;
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.stats-table th,
.stats-table td {
  text-align: left;
  padding: .55rem .4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.stats-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.stats-name { font-weight: 600; }

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .55rem;
  margin-top: .4rem;
}
.voice-card {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin: 0;
  padding: .7rem .75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font-size: .85rem;
  line-height: 1.3;
}
.voice-card input { position: absolute; opacity: 0; pointer-events: none; }
.voice-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .15);
  background: #f0fdfa;
}
.voice-card .voice-preview-btn {
  margin-top: .45rem;
  align-self: flex-start;
  padding: .35rem .7rem;
  font-size: .78rem;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
}
.voice-card .voice-preview-btn.speaking {
  background: #ecfdf5;
  border-color: rgba(15, 118, 110, .35);
  color: var(--brand);
}

.reply-styles {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .5rem;
}
.reply-styles button {
  padding: .28rem .65rem;
  font-size: .72rem;
  font-weight: 600;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  line-height: 1.2;
}
.reply-styles button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.reply-styles button:disabled {
  opacity: .55;
  cursor: wait;
}
.reply-styles button.humanize-compare-btn {
  background: #ecfdf5;
  color: #0f766e;
  border-color: rgba(15, 118, 110, .35);
}
.unread-divider {
  display: flex;
  justify-content: center;
  margin: .9rem 0 .6rem;
}
.unread-divider span {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: #0f766e;
  background: #e6f4f1;
  border: 1px solid rgba(15, 118, 110, .2);
  padding: .25rem .8rem;
  border-radius: 999px;
}
.msg-variant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  margin: 0 0 .45rem;
}
.msg-variant-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .18rem .5rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, .1);
  color: #0f766e;
  line-height: 1.2;
}
.msg-variant-badge[data-variant="reprocess"] {
  background: rgba(180, 83, 9, .12);
  color: #b45309;
}
.msg-variant-badge[data-variant="contribution"] {
  background: rgba(67, 56, 202, .1);
  color: #4338ca;
}
.bubble-reprocess {
  border: 1px solid rgba(180, 83, 9, .22);
}
.msg-variant-badge[data-variant="superseded"] {
  background: rgba(100, 116, 139, .14);
  color: #64748b;
}
.bubble-superseded {
  opacity: .62;
  border: 1px dashed rgba(100, 116, 139, .35);
}
.bubble-superseded .reply-styles,
.bubble-superseded .humanize-compare-box,
.bubble-superseded .wa-audio {
  display: none;
}
.bubble-delete-btn {
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
}
.bubble-delete-btn:hover,
.bubble-delete-btn:focus-visible {
  opacity: 1;
  background: rgba(15, 23, 42, .06);
  color: #b91c1c;
}
.humanize-compare-box {
  margin-top: .55rem;
  padding: .65rem .75rem;
  border-radius: 12px;
  background: #f0fdfa;
  border: 1px dashed rgba(15, 118, 110, .35);
  font-size: .92rem;
  line-height: 1.45;
}
.humanize-compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  margin-bottom: .35rem;
}
.humanize-compare-label {
  font-size: .72rem;
  font-weight: 700;
  color: #0f766e;
  letter-spacing: .02em;
}
.humanize-compare-hint {
  margin: .4rem 0 0;
  font-size: .68rem;
  color: var(--muted);
  font-style: italic;
}
.humanize-compare-text {
  color: var(--ink);
  white-space: pre-wrap;
}
.bubble.rewriting,
.bubble.humanizing {
  opacity: .72;
}

/* —— Responsive: teléfono / tablet / touch (iOS + Android) —— */
/* Mismo tamaño en Xiaomi/Samsung: NO dejar que Android infle distinto cada teléfono */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  :root {
    --font-size-base: 18px;
    --touch-min: 44px;
    --header-logo: 44px;
    --msg-avatar: 36px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --composer-btn: 48px;
  }
  html {
    /* 100% = mismo aspecto en todos los Android (evita A52 inflado / Xiaomi chico) */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    font-size: 18px;
  }
  body {
    font-size: 1rem;
    line-height: 1.45;
    -webkit-tap-highlight-color: rgba(15, 118, 110, .12);
    overflow-x: hidden;
  }

  /* Ancho útil: casi pantalla completa, sin desborde horizontal */
  .wrap {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
    padding-top: max(.5rem, var(--safe-top));
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .card {
    padding: clamp(.9rem, 3.5vw, 1.2rem) clamp(.85rem, 3.2vw, 1.1rem);
    border-radius: clamp(16px, 4.5vw, 20px);
  }
  label {
    font-size: 1.05rem !important;
    font-weight: 600;
    color: var(--ink);
    margin: .7rem 0 .4rem;
  }
  input, select, textarea {
    font-size: 1.1rem !important; /* rem: crece con tipografía del sistema */
    padding: .85rem 1rem !important;
    min-height: var(--touch-min);
    border-radius: 14px;
  }
  button, .btn {
    font-size: 1.05rem !important;
    padding: .8rem 1.15rem !important;
    min-height: var(--touch-min);
    font-weight: 650;
    border-radius: 14px;
  }
  .muted {
    font-size: .95rem !important;
    line-height: 1.45;
  }
  .brand h1,
  .app-header .brand h1 {
    font-size: 1.35rem !important;
    font-weight: 700;
  }
  .brand p,
  .app-header .brand p {
    font-size: 1rem !important;
  }
  h2, .profile-section-title {
    font-size: clamp(1.25rem, 5.5vw, 1.45rem) !important;
    line-height: 1.3;
  }
  h3, .profile-section .card h3 {
    font-size: clamp(1.08rem, 4.5vw, 1.2rem) !important;
  }
  .profile-section-lead {
    font-size: clamp(.95rem, 4vw, 1.05rem) !important;
    line-height: 1.5;
  }
  .profile-nav {
    gap: .45rem;
    margin-bottom: .9rem;
  }
  .profile-nav a {
    font-size: clamp(.88rem, 3.5vw, .98rem) !important;
    padding: clamp(.6rem, 2.5vw, .8rem) clamp(.75rem, 3vw, .95rem) !important;
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
  }
  .profile-photo-preview {
    width: clamp(72px, 20vw, 96px) !important;
    height: clamp(72px, 20vw, 96px) !important;
    border-radius: clamp(16px, 4.5vw, 20px) !important;
  }
  .profile-photo-actions .btn,
  .profile-photo-actions button {
    font-size: clamp(.9rem, 3.6vw, 1rem) !important;
    min-height: var(--touch-min);
  }
  .guide-avatar-grid {
    grid-template-columns: repeat(auto-fill, minmax(clamp(110px, 30vw, 140px), 1fr)) !important;
    gap: clamp(.55rem, 2.5vw, .75rem) !important;
  }
  .guide-avatar-card img {
    width: clamp(60px, 18vw, 80px) !important;
    height: clamp(60px, 18vw, 80px) !important;
  }
  .guide-avatar-card strong {
    font-size: clamp(.88rem, 3.5vw, .98rem);
  }
  .guide-avatar-card .muted {
    font-size: clamp(.78rem, 3vw, .85rem) !important;
  }
  .ok, .err {
    font-size: clamp(.95rem, 4vw, 1.05rem) !important;
  }

  body.page-chat {
    overflow: hidden;
    overscroll-behavior: none;
    font-size: 1rem;
  }
  body.page-chat .wrap.chat-layout {
    max-width: 100%;
    width: 100%;
    padding: max(.45rem, var(--safe-top)) clamp(.55rem, 2.2vw, .8rem) calc(.5rem + var(--safe-bottom));
    height: 100dvh;
    max-height: 100dvh;
    gap: 0;
  }

  /* Header compacto (como barra de WhatsApp) */
  body.page-chat .chat-top,
  body .app-header.app-top {
    margin-bottom: .35rem;
    align-items: center;
    gap: .55rem;
    padding: .2rem 0;
    min-height: calc(var(--header-logo) + .15rem);
  }
  body.page-chat .chat-top .brand,
  body .app-header .brand {
    min-width: 0;
    flex: 1 1 auto;
    gap: .55rem;
  }
  body.page-chat .chat-top .logo,
  body .app-header .logo {
    width: var(--header-logo) !important;
    height: var(--header-logo) !important;
    border-radius: 50%;
    font-size: 1.35rem;
    box-shadow: 0 2px 8px rgba(15, 118, 110, .2);
  }
  body.page-chat .chat-top .logo img,
  body .app-header .logo img {
    width: 100% !important;
    height: 100% !important;
  }
  body.page-chat .chat-top .brand h1,
  body .app-header .brand h1 {
    font-size: 1.2rem !important;
    line-height: 1.2;
    letter-spacing: -.01em;
    font-weight: 700;
  }
  body.page-chat .chat-top .brand p,
  body .app-header .brand p {
    font-size: .95rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55vw;
    margin-top: .05rem;
  }
  body.page-chat .ai-status-line { display: none !important; }
  .app-nav-desktop,
  .chat-nav-desktop { display: none !important; }
  .menu-fab {
    display: grid !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    border-radius: 12px;
    font-size: 1.15rem;
  }

  /* Menú lateral unificado */
  .app-menu-backdrop,
  .chat-menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 32, 30, .38);
    backdrop-filter: blur(2px);
    z-index: 60;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }
  .app-menu-backdrop.open,
  .chat-menu-backdrop.open { display: block; }
  .app-menu-sheet,
  .chat-menu-sheet {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: min(88vw, 320px);
    max-width: 88vw;
    height: 100dvh;
    z-index: 70;
    background: linear-gradient(180deg, #f7fbf9 0%, #eef6f3 100%);
    border-left: 1px solid var(--line);
    box-shadow: -8px 0 32px rgba(28, 43, 40, .14);
    padding: .85rem .8rem calc(.85rem + var(--safe-bottom));
    transform: translateX(104%);
    transition: transform .22s ease;
    overflow-x: hidden;
    overflow-y: auto;
    pointer-events: none;
    box-sizing: border-box;
  }
  .app-menu-sheet.open,
  .chat-menu-sheet.open {
    transform: translateX(0);
    pointer-events: auto;
  }
  .app-menu-head,
  .chat-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: clamp(.55rem, 2vw, .75rem);
  }
  .app-menu-head strong,
  .chat-menu-head strong {
    font-size: clamp(.9rem, 3.5vw, 1rem);
  }
  .app-menu-links,
  .chat-menu-links {
    display: flex;
    flex-direction: column;
    gap: clamp(.25rem, 1vw, .35rem);
  }
  .app-menu-links a,
  .app-menu-reload,
  .chat-menu-links a,
  .chat-menu-reload {
    display: block;
    width: 100%;
    padding: clamp(.7rem, 2.5vw, .9rem) clamp(.75rem, 2.5vw, .95rem);
    min-height: var(--touch-min);
    border-radius: clamp(10px, 3vw, 14px);
    background: rgba(255,255,255,.78);
    border: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(.88rem, 3.5vw, .98rem);
    text-align: left;
    font: inherit;
    cursor: pointer;
  }
  .app-menu-links a:active,
  .app-menu-reload:active,
  .chat-menu-links a:active,
  .chat-menu-reload:active {
    background: var(--guide);
  }
  .app-menu-links a.is-active {
    border-color: var(--brand);
    background: var(--guide);
    color: var(--brand);
  }
  .app-menu-reload,
  .chat-menu-reload {
    color: var(--brand);
  }
  .app-menu-exit,
  .chat-menu-exit { color: var(--danger) !important; }
  .app-menu-extras,
  .chat-menu-extras {
    margin-top: clamp(.65rem, 2.5vw, .9rem);
    padding-top: clamp(.55rem, 2vw, .75rem);
    border-top: 1px solid var(--line);
  }
  .menu-listen {
    width: 100%;
    margin: 0 0 clamp(.45rem, 2vw, .65rem);
    padding: clamp(.5rem, 2vw, .65rem) clamp(.55rem, 2vw, .7rem);
    border-radius: clamp(8px, 2.5vw, 12px);
    background: rgba(255,255,255,.7);
    border: 1px solid var(--line);
    font-size: clamp(.78rem, 3vw, .86rem);
    color: var(--ink);
  }

  /* Toolbar: altura al contenido (sin hueco vacío) */
  body.page-chat .chat-toolbar {
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: none !important;
    padding: .55rem .65rem;
    margin-bottom: .3rem;
    border-radius: 14px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 2px 10px rgba(28, 43, 40, .05);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  body.page-chat .toolbar-row {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto !important;
    height: auto !important;
    gap: .45rem;
    width: 100%;
    max-width: 100%;
  }
  body.page-chat .toolbar-space label,
  body.page-chat .tone-label {
    display: none;
  }
  body.page-chat .toolbar-space {
    width: 100%;
    min-width: 0;
  }
  body.page-chat .toolbar-space select {
    width: 100%;
    max-width: 100%;
    padding: .55rem .7rem;
    border-radius: 12px;
    font-size: 16px !important;
    min-height: 44px;
    background: #fff;
    border-color: rgba(15, 118, 110, .2);
    box-sizing: border-box;
  }
  body.page-chat .tone-bar {
    width: 100%;
    margin: 0;
  }
  body.page-chat .tone-seg {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 3px;
    border-radius: 999px;
    box-sizing: border-box;
  }
  body.page-chat .tone-seg button {
    padding: .45rem .25rem;
    font-size: .78rem;
    min-height: 40px;
    font-weight: 650;
    border-radius: 999px;
  }
  body.page-chat .tone-hint-live {
    display: none !important;
  }
  body.page-chat .setup-guide-fab {
    display: none !important;
  }
  body.page-chat .toolbar-meta {
    margin-top: .35rem;
    gap: .35rem;
    width: 100%;
  }
  body.page-chat .toolbar-listen,
  body.page-chat .desktop-tips {
    display: none !important;
  }
  /* Botones en grilla 2 columnas — caben enteros, no se cortan */
  body.page-chat .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
    width: 100%;
    max-width: 100%;
  }
  body.page-chat .ask-now-btn,
  body.page-chat .contribute-now-btn,
  body.page-chat #togglePendingBtn,
  body.page-chat .systemic-reflection-btn,
  body.page-chat #systemicReflectionBtn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: .55rem .5rem;
    font-size: .88rem;
    line-height: 1.2;
    border-radius: 999px;
    text-align: center;
    justify-content: center;
    background: #fff;
    border: 1px solid rgba(15, 118, 110, .25);
    color: var(--brand);
    box-shadow: none;
    min-height: 42px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.page-chat .ask-now-btn:active,
  body.page-chat .contribute-now-btn:active,
  body.page-chat #togglePendingBtn:active {
    background: var(--guide);
  }
  body.page-chat .pending-count {
    background: var(--brand-2);
    min-width: 1.35rem;
    height: 1.35rem;
    font-size: .78rem;
  }
  body.page-chat .label-full { display: none !important; }
  body.page-chat .label-short { display: inline !important; }

  /* Chat: columna única + burbujas/composer como WhatsApp */
  .chat-main-row {
    flex-direction: column !important;
    position: relative;
    min-height: 0;
    flex: 1 1 auto;
  }
  .chat-main-row > .chat-shell {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
  }
  body.page-chat .chat-shell {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.page-chat .messages {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: .5rem .35rem .35rem;
    gap: .5rem;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
  }
  body.page-chat .msg-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: .4rem;
  }
  body.page-chat .msg-avatar {
    width: var(--msg-avatar) !important;
    height: var(--msg-avatar) !important;
    border-radius: 50%;
    flex-shrink: 0;
  }
  body.page-chat .msg-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }
  /* Burbujas: caben en pantalla, texto legible, sin cortar */
  body.page-chat .bubble {
    max-width: 100%;
    min-width: 0;
    padding: .65rem .8rem .5rem;
    font-size: 1rem !important;
    line-height: 1.4;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 1px 1px rgba(28, 43, 40, .08);
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  body.page-chat .bubble-text,
  body.page-chat .bubble .bubble-text {
    font-size: 1rem !important;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  body.page-chat .msg-row.guide .bubble {
    flex: 1 1 auto;
    max-width: calc(100% - 44px);
  }
  body.page-chat .bubble.guide {
    background: #fff;
    border-bottom-left-radius: 4px;
  }
  body.page-chat .bubble.user {
    background: #d9fdd3;
    border-bottom-right-radius: 4px;
  }
  body.page-chat .bubble .meta {
    font-size: .78rem !important;
    opacity: .85;
    margin-top: .25rem;
  }
  body.page-chat .bubble .en {
    font-size: .95rem !important;
  }
  body.page-chat .reply-styles button {
    padding: .45rem .75rem;
    font-size: .9rem;
    min-height: 40px;
  }
  /* Composer fijo abajo — UNA fila, como WhatsApp */
  body.page-chat .composer {
    flex-wrap: nowrap !important;
    align-items: flex-end;
    margin-top: 0;
    gap: .4rem;
    padding: .45rem .35rem calc(.45rem + var(--safe-bottom));
    background: #f0f2f5;
    border-radius: 0;
    flex-shrink: 0;
  }
  body.page-chat .composer .wa-field {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
    min-height: 50px;
    border-radius: 28px;
    border: 0;
    background: #fff;
    box-shadow: none;
    padding: .2rem .35rem .2rem .75rem;
  }
  body.page-chat .composer textarea {
    font-size: 1.1rem !important;
    min-height: 1.45em;
    max-height: 120px;
    line-height: 1.35;
    padding: .65rem .3rem;
  }
  body.page-chat .composer .wa-icon#btnPhoto {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    font-size: 1.25rem;
    border-radius: 50%;
  }
  /* Mic / Enviar: círculo grande a la derecha (como WA) */
  body.page-chat .composer .wa-icon#btnMic,
  body.page-chat .composer .wa-send {
    width: var(--composer-btn) !important;
    height: var(--composer-btn) !important;
    min-width: var(--composer-btn) !important;
    font-size: 1.4rem;
    border-radius: 50% !important;
    flex-shrink: 0;
  }
  body.page-chat .composer .wa-send {
    background: var(--brand);
    box-shadow: 0 2px 8px rgba(15, 118, 110, .35);
  }
  body.page-chat .composer .wa-icon#btnMic {
    background: var(--brand);
    color: #fff;
  }
  body.page-chat .answer-hint {
    font-size: .95rem !important;
    padding: 0 .5rem .35rem;
    background: #f0f2f5;
    margin: 0;
  }

  .pending-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28, 43, 40, .38);
    z-index: 40;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }
  .pending-backdrop.open {
    display: block;
  }
  body.pending-sheet-open,
  body.chat-menu-open {
    overflow: hidden;
  }
  .pending-panel {
    position: fixed !important;
    left: 0;
    right: 0;
    /* Deja visible el composer (estilo WhatsApp: barra de escribir siempre abajo) */
    bottom: calc(64px + var(--safe-bottom));
    top: auto;
    width: 100% !important;
    max-width: none !important;
    flex: none !important;
    max-height: min(48dvh, 380px);
    z-index: 50;
    border-radius: clamp(18px, 5.5vw, 24px) clamp(18px, 5.5vw, 24px) 0 0;
    box-shadow: 0 -8px 28px rgba(28, 43, 40, .18);
    padding: clamp(.85rem, 3.5vw, 1.1rem) clamp(.9rem, 3.5vw, 1.15rem) calc(clamp(.9rem, 3.5vw, 1.1rem) + var(--safe-bottom));
    transform: translateY(105%);
    transition: transform .22s ease;
    display: flex !important;
    flex-direction: column;
    pointer-events: none;
    background: #f7fbf9;
  }
  .pending-panel:not(.collapsed) {
    transform: translateY(0);
    pointer-events: auto;
  }
  .pending-panel.collapsed {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: none !important;
    height: 0 !important;
    max-height: 0 !important;
  }
  .pending-list {
    max-height: none;
  }
  .pending-item {
    padding: clamp(.8rem, 3.2vw, 1rem) clamp(.75rem, 3vw, .95rem);
    border-radius: clamp(12px, 3.5vw, 16px);
  }
  .pending-panel h2,
  .pending-panel .pending-title,
  #pendingPanel strong {
    font-size: 1.15rem !important;
  }
  .pending-panel .muted,
  .pending-intro {
    font-size: 1rem !important;
    line-height: 1.45;
  }
  .pending-q {
    font-size: 1.05rem !important;
    line-height: 1.45;
  }
  .pending-context {
    font-size: .9rem !important;
  }
  .pending-topic {
    font-size: .85rem !important;
  }
  .pending-when {
    font-size: .85rem !important;
  }
  .pending-actions .btn,
  .pending-actions .pending-skip-btn {
    min-height: var(--touch-min);
    padding: .7rem 1rem;
    font-size: 1.05rem;
  }
}

/* Pantallas muy pequeñas */
@media (max-width: 520px) {
  .wrap {
    padding: .5rem .5rem calc(1.25rem + var(--safe-bottom));
  }
  body.page-chat .wrap.chat-layout {
    padding-left: 8px;
    padding-right: 8px;
  }
  body.page-chat .chat-top .brand p {
    max-width: 48vw;
  }
}

/* Desktop con mouse: menú móvil oculto (no aplica en touch) */
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  .menu-fab,
  .app-menu-sheet,
  .app-menu-backdrop,
  .chat-menu-sheet,
  .chat-menu-backdrop,
  .menu-listen { display: none !important; }
  .app-nav-desktop { display: flex !important; }
  .toolbar-actions { display: contents; }
}

body.app-menu-open,
body.chat-menu-open {
  overflow: hidden;
}

/* ----- Tests ----- */
.tests-wrap { max-width: 640px; }
.tests-lead { margin-top: 0; line-height: 1.45; }
.tests-subject-card {
  margin-bottom: 1rem;
  padding: .9rem 1rem;
}
.tests-subject-card label { margin-top: 0; }
.subject-select {
  margin-top: .35rem;
  border-color: rgba(15, 118, 110, .22);
}
.subject-hint { margin: .45rem 0 0; font-size: .8rem; }
.subject-pill {
  display: inline-block;
  margin: 0;
  padding: .35rem .8rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, .1);
  color: var(--brand);
  font-size: .95rem;
  font-weight: 700;
}
.test-grid {
  display: grid;
  gap: 0;
}
.test-card {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.test-card:first-child { border-top: 0; padding-top: .15rem; }
.test-card.is-disabled {
  opacity: .42;
  filter: grayscale(.15);
}
.test-status {
  margin: .1rem 0 .55rem;
  font-size: .86rem;
  line-height: 1.5;
}
.test-status .st-done { color: #0f766e; }
.test-status .st-open { color: #b45309; font-weight: 600; }
.test-status .linkish { font-size: inherit; }
.dim-prev {
  display: block;
  margin-top: .2rem;
  font-size: .82rem;
  color: #64748b;
}
.tests-subject-card.pulse-pick {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .45);
  transition: box-shadow .25s ease;
}
.test-card-top {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.test-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(15,118,110,.12), rgba(196,92,38,.1));
  flex-shrink: 0;
  font-size: 1.2rem;
}
.test-card h3 {
  margin: 0 0 .3rem;
  font-size: 1.15rem;
  line-height: 1.3;
}
.test-card p {
  font-size: 1rem;
  line-height: 1.45;
}
.test-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .55rem;
  margin: .55rem 0 .75rem;
  font-size: .88rem;
  color: var(--muted);
}
.tag-other, .tag-self, .tag-media {
  padding: .12rem .45rem;
  border-radius: 999px;
  font-weight: 600;
}
.tag-other {
  background: rgba(15, 118, 110, .1);
  color: var(--brand);
}
.tag-self {
  background: rgba(28, 43, 40, .06);
  color: var(--muted);
}
.tag-media {
  background: rgba(196, 92, 38, .12);
  color: #9a3412;
}
.test-cite {
  margin: .35rem 0 0;
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.4;
  font-style: italic;
}
.test-stimulus {
  margin: 0 0 .85rem;
  padding: .55rem;
  border-radius: 16px;
  background: rgba(255,255,255,.75);
  border: 1px solid var(--line);
  text-align: center;
}
.test-stimulus img {
  max-width: 100%;
  height: auto;
  max-height: min(52vh, 420px);
  border-radius: 10px;
}
.test-progress {
  height: 6px;
  background: rgba(15, 118, 110, .12);
  border-radius: 99px;
  overflow: hidden;
  margin: .75rem 0 .35rem;
}
.test-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand), #2dd4bf);
  transition: width .25s ease;
}
.test-item-box { margin: 1rem 0; }
.test-prompt {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 .95rem;
  line-height: 1.45;
}
.likert-list {
  display: grid;
  gap: .55rem;
}
.likert-opt {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .85rem .95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.55);
  cursor: pointer;
  font-size: 1.08rem;
  line-height: 1.4;
}
.likert-opt:has(input:checked) {
  border-color: var(--brand);
  background: var(--guide);
}
.likert-opt input {
  margin-top: .25rem;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}
.test-nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}
.test-nav-row .btn,
.test-nav-row button {
  font-size: 1.05rem;
  padding: .75rem 1.1rem;
  min-height: 48px;
}
.page-tests .start-test-btn {
  font-size: 1.02rem;
  padding: .7rem 1rem;
  min-height: 46px;
}
.page-tests .tests-lead,
.page-tests .subject-hint {
  font-size: 1.02rem;
  line-height: 1.45;
}
.page-tests .subject-select {
  font-size: 1.08rem;
  min-height: 48px;
  padding: .65rem .75rem;
}
.page-tests #itemMeta,
.page-tests .test-progress + p,
.page-tests #runView .muted {
  font-size: 1rem;
}
@media (max-width: 720px) {
  .page-tests .app-header nav .btn {
    padding: clamp(.35rem, 1.5vw, .45rem) clamp(.5rem, 2vw, .7rem);
    font-size: clamp(.72rem, 2.8vw, .82rem);
  }
  .page-tests .tests-wrap {
    padding-bottom: calc(1.25rem + var(--safe-bottom));
  }
  .page-tests {
    font-size: clamp(15px, 3.8vw, 17px);
  }
  .test-card h3 {
    font-size: clamp(1rem, 4vw, 1.12rem);
  }
  .test-card p {
    font-size: clamp(.88rem, 3.5vw, .98rem);
  }
  .test-prompt {
    font-size: clamp(1.02rem, 4.2vw, 1.15rem);
    line-height: 1.45;
    margin-bottom: clamp(.75rem, 3vw, .95rem);
  }
  .likert-opt {
    font-size: clamp(.92rem, 3.6vw, 1.02rem);
    padding: clamp(.7rem, 2.5vw, .9rem) clamp(.75rem, 2.8vw, .95rem);
    gap: clamp(.55rem, 2vw, .7rem);
    border-radius: clamp(12px, 3.5vw, 16px);
  }
  .likert-opt input {
    width: clamp(1rem, 4vw, 1.15rem);
    height: clamp(1rem, 4vw, 1.15rem);
    margin-top: clamp(.15rem, .8vw, .25rem);
  }
  .likert-list {
    gap: clamp(.45rem, 1.8vw, .6rem);
  }
  .test-nav-row .btn,
  .test-nav-row button,
  .page-tests .start-test-btn {
    font-size: clamp(.88rem, 3.5vw, .98rem);
    min-height: var(--touch-min);
    width: 100%;
  }
  .page-tests .subject-select {
    font-size: 16px !important;
  }
  .page-tests .tests-lead,
  .page-tests .subject-hint {
    font-size: clamp(.85rem, 3.4vw, .95rem);
  }
  .dim-card,
  .result-dims {
    font-size: clamp(.88rem, 3.5vw, .98rem);
  }
  .page-tests #takeTitle,
  .page-tests #resultTitle {
    font-size: clamp(1.08rem, 4.5vw, 1.22rem);
  }
  .page-tests #takeDesc,
  .page-tests #progressLabel,
  .page-tests #resultNarrative,
  .page-tests #resultDisclaimer {
    font-size: clamp(.88rem, 3.5vw, .98rem);
    line-height: 1.45;
  }
  .subject-pill {
    font-size: clamp(.85rem, 3.4vw, .95rem);
  }
}
.result-dims {
  display: grid;
  gap: .65rem;
  margin: 1rem 0;
}
.dim-card {
  padding: .7rem .8rem;
  border-radius: 12px;
  background: rgba(15, 118, 110, .06);
  border: 1px solid var(--line);
}
.dim-bar {
  height: 6px;
  background: rgba(28,43,40,.08);
  border-radius: 99px;
  margin: .45rem 0;
  overflow: hidden;
}
.dim-bar i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
}
.trait-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.trait-chip {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .55rem .7rem;
  border-radius: 12px;
  background: rgba(255,255,255,.6);
  border: 1px solid var(--line);
  font-size: .85rem;
  min-width: 7rem;
}
.test-history {
  list-style: none;
  margin: 0;
  padding: 0;
}
.test-history li { margin: .35rem 0; }
button.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
button.linkish:hover { text-decoration: underline; }

/* Personas / vínculos */
.people-toolbar { margin-top: .75rem; }
.people-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.people-item {
  margin: 0;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  overflow: hidden;
}
.people-item-link {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .85rem 1rem;
  text-decoration: none;
  color: inherit;
}
.people-item-link:hover { background: rgba(15, 118, 110, .06); }
.people-item-name {
  font-weight: 650;
  font-size: 1.05rem;
}
.people-item-rel {
  color: var(--brand);
  font-size: .92rem;
}
.people-item-meta,
.people-item-note {
  font-size: .85rem;
  line-height: 1.35;
}
.people-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .4rem;
}
.people-form fieldset.people-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 0 0 .9rem;
  padding: .75rem .9rem 1rem;
  background: rgba(255,255,255,.45);
}
.people-form legend {
  padding: 0 .35rem;
  font-weight: 650;
  color: var(--brand);
}
.people-form label { display: block; margin: .55rem 0 .25rem; font-size: .92rem; }
.people-form input[type="text"],
.people-form input[type="number"],
.people-form select,
.people-form textarea {
  width: 100%;
}
.people-check {
  display: flex !important;
  align-items: center;
  gap: .45rem;
  margin-top: .7rem !important;
}
.field-hint { margin: .2rem 0 0; font-size: .8rem; }
.people-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .4rem;
}
.people-archive { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.danger-text { color: var(--danger) !important; }

/* Preferencia tipográfica (perfil) */
.display-pref-card select {
  width: 100%;
  font-size: 1.05rem;
  min-height: 46px;
  padding: .55rem .7rem;
}
.display-preview {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px dashed rgba(15, 118, 110, .35);
  background:
    linear-gradient(145deg, rgba(15, 118, 110, .07), rgba(255, 255, 255, .7));
  transition: font-size .15s ease, font-family .15s ease;
}
.display-preview-label {
  margin: 0 0 .45rem;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brand);
  font-family: "Segoe UI", system-ui, sans-serif;
}
.display-preview-title {
  margin: 0 0 .45rem;
  font-weight: 700;
  line-height: 1.3;
  font-size: 1.2em;
}
.display-preview-body {
  margin: 0 0 .55rem;
  line-height: 1.5;
}
.display-preview-meta {
  margin: 0;
  opacity: .75;
  font-size: .92em;
  line-height: 1.35;
}

/* Espejo del paciente */
.mirror-hero p { line-height: 1.5; }
.mirror-section { margin-bottom: 1rem; }
.mirror-section h2 { margin-top: 0; font-size: 1.15rem; }
.mirror-portrait {
  padding: .85rem 1rem;
  margin: .5rem 0 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(15,118,110,.08), rgba(196,92,38,.06));
  border: 1px solid var(--line);
  line-height: 1.55;
}
.mirror-portrait p { margin: 0 0 .75rem; }
.mirror-portrait p:last-child { margin-bottom: 0; }
.mirror-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.mirror-item {
  padding: .75rem .85rem;
  border-radius: 14px;
  background: rgba(255,255,255,.5);
  border: 1px solid var(--line);
}
.mirror-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .4rem;
  margin-bottom: .35rem;
}
.mirror-source {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.mirror-spark {
  display: flex;
  align-items: flex-end;
  gap: .45rem;
  min-height: 5.5rem;
  margin: .55rem 0 .35rem;
  padding: .55rem .6rem .35rem;
  background: color-mix(in srgb, var(--bg, #f7f4ef) 70%, transparent);
  border-radius: .7rem;
  border: 1px solid var(--line, #e6e0d6);
}
.mirror-spark-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 4.6rem;
  gap: .15rem;
}
.mirror-spark-bar {
  width: 100%;
  max-width: 1.6rem;
  margin-top: auto;
  border-radius: .35rem .35rem .2rem .2rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent, #6b8f71) 85%, #fff), var(--accent, #6b8f71));
  min-height: 4%;
}
.mirror-spark-val {
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink, #2a2a28);
  line-height: 1;
}
.mirror-spark-lab {
  font-size: .62rem;
  color: var(--muted, #7a746a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.mirror-observed {
  margin: 0 0 .5rem;
  line-height: 1.45;
  font-size: .95rem;
}
.mirror-claim {
  margin: .5rem 0;
  padding: .65rem .75rem;
  border-radius: 12px;
  background: rgba(15, 118, 110, .1);
  border: 1px solid rgba(15, 118, 110, .18);
}
.mirror-claim-label {
  font-size: .75rem;
  font-weight: 650;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .25rem;
}
.mirror-claim p { margin: 0 0 .45rem; line-height: 1.4; }
.mirror-clarify { margin-top: .35rem; }
.mirror-clarify summary {
  cursor: pointer;
  color: var(--brand);
  font-size: .92rem;
  font-weight: 600;
}
.mirror-clarify-form {
  margin-top: .55rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.mirror-clarify-form label { font-size: .88rem; }
.mirror-clarify-form select,
.mirror-clarify-form textarea { width: 100%; margin-top: .2rem; }

/* Perfil: navegación por secciones */
.profile-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0 0 1.1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: .55rem 0;
  background: linear-gradient(180deg, var(--bg, #e8f3ef) 70%, transparent);
}
.profile-nav a {
  text-decoration: none;
  font-size: .78rem;
  font-weight: 650;
  color: var(--brand);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .7rem;
}
.profile-nav a:hover { border-color: var(--brand); }
.profile-section { margin-bottom: 1.5rem; scroll-margin-top: 3.5rem; }
.profile-section-title {
  margin: 0 0 .25rem;
  font-size: 1.15rem;
  letter-spacing: -.02em;
}
.profile-section-lead { margin: 0 0 .85rem; font-size: .9rem; }
.profile-section .card h3 { font-size: 1.02rem; }

/* Cropper foto de perfil */
.photo-crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 100050;
  background: rgba(15, 23, 42, .6);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.photo-crop-overlay.is-open { display: flex; }
.photo-crop-sheet {
  background: #fff;
  border-radius: 20px 20px 14px 14px;
  max-width: 420px;
  width: 100%;
  padding: 1.1rem 1rem 1.2rem;
  box-shadow: 0 -8px 40px rgba(15, 23, 42, .25);
}
.photo-crop-sheet canvas {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  border-radius: 50%;
  background: #0f172a;
  touch-action: none;
  cursor: grab;
}
.photo-crop-sheet input[type=range] { width: 100%; }

.psico-ui-stamp {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #0f766e;
  background: #ecfdf5;
  border-radius: 999px;
  vertical-align: middle;
}

/* ============================================================
   Layout teléfono FORZADO (clase .psico-phone puesta por JS)
   Sirve cuando MIUI/Chrome reportan ancho “desktop” y los
   @media (max-width) no aplican → Xiaomi quedaba en columna chica.
   ============================================================ */
html.psico-phone body.page-chat {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html.psico-phone body.page-chat .wrap.chat-layout {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  padding-left: max(8px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(8px, env(safe-area-inset-right, 0px)) !important;
  box-sizing: border-box !important;
}
html.psico-phone body.page-chat .app-nav-desktop,
html.psico-phone body.page-chat .chat-nav-desktop {
  display: none !important;
}
html.psico-phone body.page-chat .menu-fab {
  display: grid !important;
}
html.psico-phone body.page-chat .chat-main-row {
  flex-direction: column !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
html.psico-phone body.page-chat .chat-main-row > .chat-shell {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}
html.psico-phone body.page-chat .chat-toolbar {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  flex: 0 0 auto !important;
  height: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  gap: .35rem !important;
}
html.psico-phone body.page-chat .tone-hint-live {
  display: none !important;
}
html.psico-phone body.page-chat .toolbar-row {
  display: flex !important;
  flex-direction: column !important;
  flex: 0 0 auto !important;
  height: auto !important;
  gap: .45rem !important;
  width: 100% !important;
}
html.psico-phone body.page-chat .toolbar-space {
  flex: 0 0 auto !important;
  width: 100% !important;
}
html.psico-phone body.page-chat .toolbar-space select {
  width: 100% !important;
  max-width: 100% !important;
  font-size: 1rem !important;
  box-sizing: border-box !important;
}
html.psico-phone body.page-chat .tone-seg {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr !important;
}
html.psico-phone body.page-chat .toolbar-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: .4rem !important;
  width: 100% !important;
}
html.psico-phone body.page-chat .ask-now-btn,
html.psico-phone body.page-chat .contribute-now-btn,
html.psico-phone body.page-chat #togglePendingBtn,
html.psico-phone body.page-chat #systemicReflectionBtn {
  width: 100% !important;
  min-width: 0 !important;
  border-radius: 999px !important;
  font-size: .9rem !important;
  min-height: 42px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html.psico-phone body.page-chat .label-full { display: none !important; }
html.psico-phone body.page-chat .label-short { display: inline !important; }
html.psico-phone body.page-chat .toolbar-listen,
html.psico-phone body.page-chat .desktop-tips { display: none !important; }
html.psico-phone body.page-chat .messages {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}
html.psico-phone body.page-chat .msg-row {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
html.psico-phone body.page-chat .msg-row.guide .bubble {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: calc(100% - 44px) !important;
}
html.psico-phone body.page-chat .bubble,
html.psico-phone body.page-chat .bubble-text {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
  font-size: 1rem !important;
  line-height: 1.45 !important;
  overflow-wrap: anywhere !important;
}
html.psico-phone body.page-chat .ask-now-btn,
html.psico-phone body.page-chat .contribute-now-btn,
html.psico-phone body.page-chat #togglePendingBtn,
html.psico-phone body.page-chat #systemicReflectionBtn,
html.psico-phone body.page-chat .systemic-reflection-btn {
  grid-column: auto !important;
  min-height: 48px !important;
  font-size: .9rem !important;
}
html.psico-phone body.page-chat .wa-audio {
  max-width: 100% !important;
  width: 100% !important;
  min-width: 0 !important;
  flex-wrap: wrap !important;
  box-sizing: border-box !important;
}
html.psico-phone body.page-chat .composer {
  display: flex !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  max-width: 100% !important;
  background: #f0f2f5 !important;
  z-index: 60;
  position: relative;
}
html.psico-phone body.page-chat .composer .wa-field {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}
html.psico-phone body.page-chat .composer .wa-icon#btnMic,
html.psico-phone body.page-chat .composer .wa-send {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  border-radius: 50% !important;
  background: var(--brand) !important;
  color: #fff !important;
  flex-shrink: 0 !important;
}
/* Pendientes = bottom sheet a pantalla completa (nunca sidebar de 240px) */
html.psico-phone body.page-chat .pending-panel {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: auto !important;
  bottom: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
  max-height: min(42dvh, 320px) !important;
  z-index: 50 !important;
  border-radius: 18px 18px 0 0 !important;
  box-sizing: border-box !important;
  transform: translateY(105%);
  transition: transform .22s ease;
  display: flex !important;
  flex-direction: column !important;
  pointer-events: none;
  background: #f7fbf9 !important;
}
html.psico-phone body.page-chat .pending-panel:not(.collapsed) {
  transform: translateY(0);
  pointer-events: auto;
}
html.psico-phone body.page-chat .pending-panel.collapsed {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: none !important;
  height: 0 !important;
  max-height: 0 !important;
}
/* Menú móvil siempre off-canvas (no meterlo en el flujo del desktop) */
html.psico-phone body.page-chat .app-menu-sheet,
html.psico-phone body.page-chat .chat-menu-sheet {
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  width: min(90vw, 340px) !important;
  max-width: 90vw !important;
  height: 100dvh !important;
  z-index: 70 !important;
  transform: translateX(104%) !important;
  pointer-events: none !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
}
html.psico-phone body.page-chat .app-menu-sheet.open,
html.psico-phone body.page-chat .chat-menu-sheet.open {
  transform: translateX(0) !important;
  pointer-events: auto !important;
}
/* Escritorio: nunca forzar layout teléfono */
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  html.psico-phone body.page-chat .app-nav-desktop {
    display: flex !important;
  }
  html.psico-phone body.page-chat .menu-fab,
  html.psico-phone body.page-chat .app-menu-sheet,
  html.psico-phone body.page-chat .app-menu-backdrop {
    display: none !important;
  }
}

/* ============================================================
   Hilos por tema (chat privado) — build 56
   Todo en rem: escala con la raíz fluida del teléfono.
   ============================================================ */
.thread-bar {
  display: flex;
  flex: 0 0 auto;
  gap: .4rem;
  margin: 0 0 .35rem;
  padding: .1rem .1rem .2rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.thread-bar::-webkit-scrollbar { display: none; }
.thread-chip {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .35rem;
  min-height: 2.3rem;
  padding: 0 .85rem;
  font-size: .85rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--line);
  border-radius: 999px;
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
}
.thread-chip.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(15, 118, 110, .28);
}
.thread-chip.is-empty { opacity: .62; font-weight: 600; }
.thread-chip.thread-shared { border-style: dashed; }
.thread-ico { font-size: 1em; line-height: 1; }
.thread-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.3em;
  height: 1.3em;
  padding: 0 .3em;
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand-2);
  border-radius: 999px;
}
.thread-badge[hidden] { display: none; }

.thread-resume {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: .25rem;
  margin: .35rem .35rem 0;
  padding: .5rem .45rem .5rem .75rem;
  font-size: .85rem;
  line-height: 1.35;
  color: var(--ink);
  background: #ecfdf5;
  border: 1px solid rgba(15, 118, 110, .18);
  border-radius: .9rem;
}
.thread-resume[hidden] { display: none !important; }
.thread-resume-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.thread-resume-title { font-weight: 700; color: var(--brand); }
.thread-resume-line {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.thread-resume.open .thread-resume-line {
  display: block;
  -webkit-line-clamp: unset;
}
.thread-resume-close {
  flex: 0 0 auto;
  min-width: 2.2rem;
  min-height: 2.2rem;
  padding: 0;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.thread-suggest {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .5rem;
  margin: .3rem .35rem 0;
  padding: .45rem .6rem .45rem .8rem;
  font-size: .85rem;
  line-height: 1.3;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: .9rem;
}
.thread-suggest[hidden] { display: none !important; }
.thread-suggest-text { flex: 1 1 auto; min-width: 0; }
.thread-suggest-yes {
  flex: 0 0 auto;
  min-height: 2.3rem;
  padding: 0 .95rem;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.thread-suggest-no {
  flex: 0 0 auto;
  min-width: 2.3rem;
  min-height: 2.3rem;
  padding: 0;
  font-size: 1rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* Bloqueo inmediato al cerrar sesión por privacidad (antes del redirect) */
.privacy-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #0f1715;
  color: #e8f2ef;
}
.privacy-lock-overlay[hidden] { display: none !important; }
.privacy-lock-card {
  max-width: 22rem;
  text-align: center;
}
.privacy-lock-card strong {
  display: block;
  font-size: 1.25rem;
  margin-bottom: .5rem;
}
.privacy-lock-card p {
  margin: 0;
  color: rgba(232, 242, 239, .85);
  line-height: 1.45;
}
body.privacy-locked #messages,
body.privacy-locked .composer,
body.privacy-locked .pending-panel {
  visibility: hidden !important;
}

.move-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(20, 32, 30, .42);
}
.move-sheet-backdrop[hidden],
.move-sheet[hidden],
#photoSheet[hidden],
#photoSheetBackdrop[hidden],
.thread-toast[hidden] { display: none !important; }
.move-sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 120;
  max-height: 70dvh;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  background: #fff;
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 -.5rem 1.75rem rgba(28, 43, 40, .22);
}
.move-sheet-title { margin: 0 0 .6rem; font-size: 1rem; font-weight: 700; }
.move-sheet-group {
  margin: .65rem 0 .35rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--muted);
}
.move-sheet-group:first-child { margin-top: .15rem; }
.move-sheet-opt {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  min-height: 3rem;
  margin: 0 0 .4rem;
  padding: 0 .9rem;
  font: inherit;
  font-size: 1rem;
  text-align: left;
  color: var(--ink);
  background: #f2f7f5;
  border: 0;
  border-radius: .8rem;
  cursor: pointer;
}
.move-sheet-opt.is-off { opacity: .72; }
.move-sheet-opt.is-shared { background: #eef6ff; }
.move-sheet-opt-tag {
  margin-left: auto;
  font-size: .72rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: lowercase;
}
.move-sheet-opt.is-shared .move-sheet-opt-tag { color: #1d4ed8; }
.move-sheet-create {
  margin: .55rem 0 .35rem;
  padding: .75rem .85rem;
  background: #f7faf9;
  border: 1px dashed rgba(15, 118, 110, .28);
  border-radius: .9rem;
}
.move-sheet-create-label {
  margin: 0 0 .45rem;
  font-size: .9rem;
  font-weight: 700;
}
.move-sheet-create-row {
  display: flex;
  gap: .45rem;
  align-items: stretch;
}
.move-sheet-create-row input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 1rem;
}
.move-sheet-create-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: .55rem .75rem;
}
.move-sheet-create-hint {
  margin: .45rem 0 0;
  font-size: .78rem;
}
.move-sheet-cancel {
  width: 100%;
  min-height: 3rem;
  margin-top: .2rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.thread-toast {
  position: fixed;
  left: 50%;
  bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  z-index: 130;
  max-width: 90vw;
  padding: .6rem 1rem;
  font-size: .9rem;
  font-weight: 600;
  color: #fff;
  background: #134e4a;
  border-radius: 999px;
  transform: translateX(-50%);
  box-shadow: 0 .4rem 1.2rem rgba(0, 0, 0, .25);
}

/* —— Guía de configuración (primera vez) —— */
.setup-guide-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 200 !important;
  background: rgba(15, 35, 32, .55) !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.setup-guide-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.setup-guide-sheet {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: 0 !important;
  z-index: 201 !important;
  width: min(440px, 100%) !important;
  max-width: 100vw !important;
  max-height: min(92dvh, 680px) !important;
  display: none;
  flex-direction: column !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #f4f8f6 !important;
  border: 1px solid var(--line) !important;
  border-bottom: 0 !important;
  border-radius: 1.15rem 1.15rem 0 0 !important;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .22) !important;
  transform: translate(-50%, 110%);
  transition: transform .26s ease;
  overflow: hidden !important;
  box-sizing: border-box !important;
  pointer-events: none;
}
.setup-guide-sheet.open {
  display: flex !important;
  transform: translate(-50%, 0) !important;
  pointer-events: auto !important;
}
.setup-guide-sheet[hidden] {
  display: none !important;
}
.setup-guide-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  padding: 1rem 1rem .35rem;
}
.setup-guide-head h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
  color: var(--ink);
}
.setup-guide-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 1rem .5rem;
}
.setup-guide-lead {
  margin: 0 0 .75rem;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.4;
}
.setup-guide-progress {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .75rem;
}
.setup-guide-bar {
  flex: 1;
  height: .35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, .08);
  overflow: hidden;
}
.setup-guide-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width .25s ease;
}
.setup-guide-progress strong {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}
.setup-guide-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.setup-guide-item {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .7rem .75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}
.setup-guide-item:hover {
  border-color: var(--brand);
}
.setup-guide-item.done {
  opacity: .8;
}
.setup-guide-check {
  flex: 0 0 auto;
  width: 1.45rem;
  height: 1.45rem;
  margin-top: .1rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid var(--line);
  font-size: .75rem;
  font-weight: 700;
  color: transparent;
  background: #fff;
}
.setup-guide-item.done .setup-guide-check {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.setup-guide-item-body {
  flex: 1 1 auto;
  min-width: 0;
}
.setup-guide-item-body strong {
  display: block;
  font-size: .95rem;
  margin-bottom: .15rem;
}
.setup-guide-item-body span {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.35;
}
.setup-guide-item-cta {
  flex: 0 0 auto;
  align-self: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}
.setup-guide-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: .75rem 1rem calc(.9rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: #eef5f2;
}
.setup-guide-actions .btn {
  width: 100%;
  min-height: 2.75rem;
  margin: 0;
}
.setup-guide-fab {
  position: fixed;
  right: max(.85rem, env(safe-area-inset-right));
  bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  min-height: 2.6rem;
  padding: 0 .95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: .82rem;
  font-weight: 650;
  box-shadow: 0 .25rem .9rem rgba(0, 0, 0, .12);
  cursor: pointer;
}
.setup-guide-fab[hidden] { display: none !important; }
.setup-guide-banner {
  margin-bottom: 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, #eef7f3, #f7faf8);
}
.setup-guide-banner h3 {
  margin: 0 0 .25rem;
  font-size: 1rem;
}
.setup-guide-banner p {
  margin: 0 0 .65rem;
  font-size: .86rem;
  color: var(--muted);
  line-height: 1.4;
}
.setup-guide-banner .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
/* Escritorio real: modal centrado (no bottom sheet) */
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  .setup-guide-sheet,
  .setup-guide-sheet.open {
    top: 50% !important;
    bottom: auto !important;
    max-height: min(85vh, 640px) !important;
    border-radius: 1.15rem !important;
    border-bottom: 1px solid var(--line) !important;
    transform: translate(-50%, -50%) !important;
  }
}
html.psico-phone body.page-chat .setup-guide-backdrop {
  z-index: 200 !important;
}
html.psico-phone body.page-chat .setup-guide-sheet,
html.psico-phone body.page-chat .setup-guide-sheet.open {
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  transform: none !important;
  border-radius: 1.15rem 1.15rem 0 0 !important;
}
html.psico-phone body.page-chat .setup-guide-sheet:not(.open),
html.psico-phone body.page-chat .setup-guide-sheet[hidden] {
  display: none !important;
}
html.psico-phone body.page-chat .setup-guide-sheet.open {
  display: flex !important;
  transform: none !important;
}
html.psico-phone body.page-chat .setup-guide-fab {
  display: none !important;
}
