/* Mensajes internos (CHAT-01): la ventanita (views/partials/mensajes.ejs, public/mensajes.js) y la revisión de la dirección. */
.chw { position: fixed; right: 18px; bottom: 16px; z-index: 900; font-size: .9rem; }
.chw[hidden] { display: none; }
.chw-i { width: 1.15rem; height: 1.15rem; flex: none; }

/* Los botones del chat no toman el relieve de los botones generales (style.css). */
.chw button:hover, .chw button:active { transform: none; filter: none; }
.chw button.chw-icon, .chw button.chw-icon:hover, .chw button.chw-text-btn, .chw button.chw-row, .chw button.chw-person { box-shadow: none; }
.chw button.chw-row:hover, .chw button.chw-person:hover { background: #f6f7fd; }
.chw button.chw-person, .chw label.chw-person { justify-content: flex-start; text-align: left; }
.chw .chw-patient-results button:hover { background: #f6f7fd; }
.chw .chw-chip button:hover, .chw button.chw-text-btn:hover { background: transparent; }
.chw button.chw-secondary:hover, .chw button.chw-more:hover { background: #f6f7fd; box-shadow: none; }
.chw button.chw-danger:hover { background: #fdecec; box-shadow: none; }
.chw button.chw-primary:hover { box-shadow: none; }

/* Plegada: un botón con la cantidad sin leer. */
.chw-launch { display: inline-flex; align-items: center; gap: .5rem; height: 2.75rem; padding: 0 1rem 0 .85rem; border: 0; border-radius: 999px;
  background: var(--brand-deep, #19243a); color: #fff; font-weight: 650; font-size: .92rem; box-shadow: 0 6px 20px rgba(25, 36, 58, .28), 0 1px 3px rgba(25, 36, 58, .2); cursor: pointer; }
.chw-launch svg { width: 1.25rem; height: 1.25rem; }
.chw-launch:hover { background: var(--brand-strong, #3730a3); }
.chw-launch:focus-visible { outline: 3px solid var(--brand-focus, #4f46e5); outline-offset: 2px; }
.chw-count { min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; border-radius: 999px; background: #e5484d; color: #fff; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
.chw-count[hidden] { display: none; }
.chw.has-unread .chw-launch { background: var(--money, #0b7f76); }
.chw.blink .chw-launch { animation: chw-blink 1.1s ease-in-out infinite; }
@keyframes chw-blink { 0%, 100% { box-shadow: 0 6px 20px rgba(11, 127, 118, .3); transform: none; } 50% { box-shadow: 0 0 0 7px rgba(11, 127, 118, .28), 0 6px 20px rgba(11, 127, 118, .3); transform: translateY(-2px); } }
.chw.reduced.blink .chw-launch { animation: none; }
@media (prefers-reduced-motion: reduce) { .chw.blink .chw-launch { animation: none; } }
.chw.open .chw-launch { display: none; }

/* Abierta: como la pantalla de un teléfono. */
.chw-panel { width: min(380px, calc(100vw - 24px)); height: min(620px, calc(100vh - 32px)); display: flex; flex-direction: column; overflow: hidden;
  background: #f1f3f9; border-radius: 18px; box-shadow: 0 18px 50px rgba(25, 36, 58, .3), 0 2px 8px rgba(25, 36, 58, .15); border: 1px solid rgba(25, 36, 58, .08); }
.chw-panel[hidden] { display: none; }
html:not(.mo-reduced) .chw.open .chw-panel { animation: chw-in .22s cubic-bezier(.22, 1, .36, 1); transform-origin: bottom right; }
@keyframes chw-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) {
  .chw { right: 12px; bottom: 12px; }
  .chw.open { inset: 0; }
  .chw-panel { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
}

.chw-head { display: flex; align-items: center; gap: .55rem; padding: .7rem .7rem .7rem .9rem; background: var(--brand-gradient, linear-gradient(115deg, #19243a, #3730a3 65%, #0d9488)); color: #fff; flex: none; }
.chw-head-text { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.chw-head-text strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chw-head-text span { font-size: .78rem; opacity: .85; }
.chw button.chw-icon { width: 2.1rem; height: 2.1rem; display: inline-grid; place-items: center; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; flex: none; padding: 0; margin: 0; }
.chw button.chw-icon:hover { background: rgba(255, 255, 255, .14); }
.chw button.chw-icon:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.chw-head .chw-avatar { background: rgba(255, 255, 255, .18); color: #fff; }

.chw-avatar { width: 2.4rem; height: 2.4rem; border-radius: 999px; display: inline-grid; place-items: center; background: var(--brand-soft, #eef0fe); color: var(--brand, #4338ca); font-weight: 700; font-size: .82rem; flex: none; }
.chw-avatar.group { background: #e0f2ef; color: var(--teal-dark, #0f766e); }

.chw-body { flex: 1; min-height: 0; overflow-y: auto; }
.chw-empty { margin: 2rem 1.2rem; text-align: center; color: var(--muted, #667085); display: grid; gap: .35rem; }
.chw-empty strong { color: var(--text, #1b2430); }
.chw-error { margin: .5rem .8rem 0; padding: .45rem .65rem; border-radius: 8px; background: #fdecec; color: #b42323; font-size: .84rem; }
.chw-error[hidden] { display: none; }

/* Lista de conversaciones. */
.chw-list-actions { padding: .6rem .7rem .3rem; flex: none; }
.chw-search { display: flex; align-items: center; gap: .4rem; padding: 0 .65rem; height: 2.3rem; border-radius: 999px; background: #fff; border: 1px solid var(--line, #e4eaf1); color: var(--muted, #667085); }
.chw-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; padding: 0; margin: 0; box-shadow: none; font-size: .88rem; height: auto; }
.chw-list { background: #fff; margin: .3rem .55rem; border-radius: 12px; border: 1px solid var(--line, #e4eaf1); }
.chw-row { width: 100%; display: flex; align-items: center; gap: .65rem; padding: .62rem .75rem; border: 0; border-bottom: 1px solid #eef1f6; background: transparent; text-align: left; cursor: pointer; color: inherit; margin: 0; border-radius: 0; font: inherit; }
.chw-row:last-child { border-bottom: 0; }
.chw-row:hover, .chw-row:focus-visible { background: #f6f7fd; outline: 0; }
.chw-row-main { flex: 1; min-width: 0; display: grid; gap: .12rem; }
.chw-row-top, .chw-row-bottom { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.chw-row-top strong { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.chw-row-top time { font-size: .74rem; color: var(--muted, #667085); flex: none; }
.chw-row-preview { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted, #667085); font-size: .83rem; }
.chw-row.unread .chw-row-top strong { font-weight: 750; }
.chw-row.unread .chw-row-top time { color: var(--money, #0b7f76); font-weight: 700; }
.chw-row.unread .chw-row-preview { color: var(--text, #1b2430); }
.chw-badge { min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: var(--money, #0b7f76); color: #fff; font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; flex: none; }

.chw-foot { flex: none; display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; padding: .6rem .7rem; background: #fff; border-top: 1px solid var(--line, #e4eaf1); }
.chw-primary, .chw-secondary, .chw-danger { display: inline-flex; align-items: center; gap: .35rem; height: 2.2rem; padding: 0 .85rem; border-radius: 999px; font-weight: 650; font-size: .84rem; cursor: pointer; margin: 0; width: auto; }
.chw-primary { background: var(--brand, #4338ca); color: #fff; border: 0; }
.chw-primary:hover { background: var(--brand-strong, #3730a3); }
.chw-secondary { background: #fff; color: var(--brand, #4338ca); border: 1px solid var(--brand-line, #c7c9f5); }
.chw-danger { background: #fff; color: #b42323; border: 1px solid #f1c4c4; margin: 1rem .8rem; }
.chw-primary:disabled, .chw-secondary:disabled { opacity: .55; cursor: default; }
.chw-link { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--muted, #667085); margin-left: auto; }
.chw-foot .chw-hint { flex: 1; color: var(--muted, #667085); font-size: .82rem; }

/* Elegir personas. */
.chw-people { display: flex; flex-direction: column; padding: .55rem .7rem; gap: .5rem; }
.chw-people-list { background: #fff; border-radius: 12px; border: 1px solid var(--line, #e4eaf1); overflow: hidden; }
.chw-person { width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: .6rem; padding: .5rem .7rem; border: 0; border-bottom: 1px solid #eef1f6; background: transparent; cursor: pointer; text-align: left; font: inherit; color: inherit; margin: 0; border-radius: 0; }
.chw-person:last-child { border-bottom: 0; }
.chw-person:hover { background: #f6f7fd; }
.chw-person input { margin: 0; width: 1.05rem; height: 1.05rem; flex: none; }
.chw-person .chw-avatar { width: 2rem; height: 2rem; font-size: .74rem; flex: none; }
.chw .chw-person > span:not(.chw-avatar) { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chw-form { display: grid; gap: .45rem; padding: .7rem .8rem 0; }
.chw-form label { display: grid; gap: .25rem; font-size: .82rem; font-weight: 600; }
.chw-form input { margin: 0; }

/* Datos del grupo. */
.chw-info { padding: .4rem 0 1rem; }
.chw-info h3 { margin: .7rem .9rem .4rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #667085); }
.chw-member { display: flex; align-items: center; gap: .6rem; padding: .45rem .9rem; background: #fff; border-bottom: 1px solid #eef1f6; }
.chw-member > span:not(.chw-avatar) { flex: 1; min-width: 0; }
.chw-member small { color: var(--muted, #667085); }
.chw-member .chw-avatar { width: 2rem; height: 2rem; font-size: .74rem; }
.chw-text-btn { border: 0; background: transparent; color: #b42323; font-size: .8rem; font-weight: 600; cursor: pointer; padding: .2rem .4rem; margin: 0; width: auto; }
.chw-fold { margin: .7rem .8rem 0; background: #fff; border: 1px solid var(--line, #e4eaf1); border-radius: 12px; }
.chw-fold > summary { cursor: pointer; padding: .6rem .8rem; font-weight: 600; color: var(--brand, #4338ca); }
.chw-fold .chw-people { padding-top: 0; }
.chw-fold .chw-form { padding: 0 .8rem .8rem; }
.chw-row-end { display: flex; justify-content: flex-end; padding: 0 .7rem .7rem; }

/* La conversación. */
.chw-messages { padding: .6rem .7rem .8rem; display: flex; flex-direction: column; gap: .3rem;
  background: #eef1f8 radial-gradient(rgba(67, 56, 202, .045) 1px, transparent 1.2px) 0 0 / 14px 14px; }
.chw-day { align-self: center; margin: .5rem 0 .2rem; }
.chw-day span { display: inline-block; padding: .18rem .65rem; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--muted, #667085); font-size: .74rem; font-weight: 600; box-shadow: 0 1px 1px rgba(25, 36, 58, .06); }
.chw-event { align-self: center; max-width: 88%; text-align: center; font-size: .76rem; color: var(--muted, #667085); background: rgba(255, 255, 255, .7); padding: .2rem .6rem; border-radius: 8px; }
.chw-review { align-self: stretch; display: flex; gap: .4rem; align-items: flex-start; font-size: .78rem; color: #7a5212; background: #fdf6e7; border: 1px solid #f3dfb3; padding: .45rem .6rem; border-radius: 10px; }
.chw-msg { position: relative; align-self: flex-start; max-width: 82%; display: grid; gap: .25rem; padding: .42rem .6rem .3rem; background: #fff; border-radius: 4px 14px 14px 14px; box-shadow: 0 1px 1.5px rgba(25, 36, 58, .1); word-wrap: break-word; overflow-wrap: anywhere; }
.chw-msg.mine { align-self: flex-end; background: #dcf3ee; border-radius: 14px 4px 14px 14px; }
.chw-author { display: flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 700; color: var(--brand, #4338ca); }
.chw-author .chw-avatar { width: 1.3rem; height: 1.3rem; font-size: .55rem; }
/* Foto de la persona (migración 146). */
.chw-avatar.has-photo { overflow: hidden; background: #e8eef7; }
.chw-avatar.has-photo > img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.chw-head .chw-avatar.has-photo { box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
.chw-text { white-space: pre-wrap; line-height: 1.38; }
.chw-msg.withdrawn .chw-text { font-style: italic; color: var(--muted, #667085); }
.chw-meta { justify-self: end; display: inline-flex; align-items: center; gap: .25rem; font-size: .68rem; color: #7a8597; line-height: 1; }
.chw-tick { display: inline-flex; align-items: center; }
.chw-tick .chw-i { width: .95rem; height: .95rem; }
.chw-tick.seen { color: #2b7de9; }
.chw-photo { display: block; margin: -.12rem -.3rem 0; border-radius: 10px; overflow: hidden; background: #e8ebf3; }
.chw-photo img { display: block; max-width: 100%; max-height: 240px; width: auto; height: auto; margin: 0 auto; }
.chw-file { display: flex; gap: .5rem; align-items: center; padding: .45rem .55rem; border-radius: 10px; background: rgba(25, 36, 58, .05); color: inherit; text-decoration: none; }
.chw-file span { display: grid; min-width: 0; }
.chw-file strong { font-size: .84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chw-file small { color: var(--muted, #667085); font-size: .72rem; }
.chw-patient { display: inline-flex; align-items: center; gap: .3rem; justify-self: start; padding: .2rem .55rem; border-radius: 999px; background: var(--brand-soft, #eef0fe); color: var(--brand, #4338ca); font-weight: 650; font-size: .8rem; text-decoration: none; }
/* Acciones del mensaje (responder; retirar el propio): al pasar el mouse o, en pantallas táctiles, al tocarlo. */
.chw-actions { position: absolute; top: -.6rem; right: -.35rem; display: none; gap: .2rem; }
.chw-msg:not(.mine) .chw-actions { right: auto; left: calc(100% - 1.2rem); }
.chw-msg:hover .chw-actions, .chw-msg:focus-within .chw-actions, .chw-msg.act .chw-actions { display: inline-flex; }
.chw button.chw-act { width: 1.55rem; height: 1.55rem; border-radius: 999px; border: 1px solid var(--line, #e4eaf1); background: #fff; color: var(--muted, #667085); display: inline-grid; place-items: center; cursor: pointer; padding: 0; margin: 0; box-shadow: 0 1px 2px rgba(25, 36, 58, .12); }
.chw button.chw-act:hover { background: #f6f7fd; color: var(--brand, #4338ca); box-shadow: 0 1px 2px rgba(25, 36, 58, .12); }
.chw-act .chw-i { width: .85rem; height: .85rem; }
.chw-msg.chw-flash { animation: chw-flash 1.6s ease-out; }
@keyframes chw-flash { 0%, 35% { box-shadow: 0 0 0 3px rgba(67, 56, 202, .45); } 100% { box-shadow: 0 1px 1.5px rgba(25, 36, 58, .1); } }
@media (prefers-reduced-motion: reduce) { .chw-msg.chw-flash { animation: none; outline: 2px solid var(--brand, #4338ca); } }

/* Cita del mensaje al que se responde. */
.chw button.chw-quote { display: grid; gap: .05rem; text-align: left; width: 100%; margin: 0; padding: .3rem .5rem; border: 0; border-left: 3px solid var(--brand, #4338ca); border-radius: 6px; background: rgba(25, 36, 58, .05); color: inherit; cursor: pointer; font: inherit; box-shadow: none; min-width: 9rem; }
.chw button.chw-quote:hover { background: rgba(25, 36, 58, .09); box-shadow: none; }
.chw-msg.mine button.chw-quote { border-left-color: var(--teal-dark, #0f766e); }
.chw-quote strong { font-size: .74rem; color: var(--brand, #4338ca); }
.chw-msg.mine .chw-quote strong { color: var(--teal-dark, #0f766e); }
.chw-quote span { white-space: normal; overflow-wrap: anywhere; font-size: .8rem; color: #4b5565; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chw-replying { display: flex; align-items: center; gap: .45rem; padding: .35rem .4rem .35rem .6rem; background: #fff; border: 1px solid var(--line, #e4eaf1); border-left: 3px solid var(--brand, #4338ca); border-radius: 10px; color: var(--brand, #4338ca); }
.chw-replying[hidden] { display: none; }
.chw-replying > span { flex: 1; min-width: 0; display: grid; }
.chw-replying strong { font-size: .76rem; }
.chw-replying span span { font-size: .8rem; color: #4b5565; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chw-replying button { border: 0; background: transparent; padding: .2rem; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted, #667085); margin: 0; width: auto; box-shadow: none; }

/* @menciones. */
.chw-mention { color: var(--brand, #4338ca); font-weight: 650; }
.chw-mention.me { background: #e7e5fd; border-radius: 4px; padding: 0 .15rem; }
.chw-compose { position: relative; }
.chw-mention-pop { display: grid; max-height: 13rem; overflow-y: auto; background: #fff; border: 1px solid var(--line, #e4eaf1); border-radius: 12px; box-shadow: 0 8px 24px rgba(25, 36, 58, .16); padding: .25rem; }
.chw-mention-pop[hidden] { display: none; }
.chw button.chw-mention-opt { display: flex; align-items: center; justify-content: flex-start; gap: .5rem; width: 100%; margin: 0; padding: .35rem .5rem; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; box-shadow: none; }
.chw button.chw-mention-opt.on, .chw button.chw-mention-opt:hover { background: #eef0fe; box-shadow: none; }
.chw-mention-opt .chw-avatar { width: 1.8rem; height: 1.8rem; font-size: .7rem; }
.chw-at { min-width: 1.3rem; height: 1.3rem; border-radius: 999px; background: var(--brand, #4338ca); color: #fff; font-size: .74rem; font-weight: 800; display: inline-grid; place-items: center; flex: none; }

/* Escribiendo… */
.chw-row-preview.typing, .chw-head-text span.typing { color: var(--teal-dark, #0f766e); font-style: italic; }
.chw-head-text span.typing { color: #c9f4ec; opacity: 1; }

/* Búsqueda en los mensajes. */
.chw-section { margin: 0; padding: .55rem .75rem .25rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted, #667085); border-bottom: 1px solid #eef1f6; }
.chw-hit-text { white-space: normal; overflow-wrap: anywhere; color: #4b5565; font-size: .83rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chw-hit-text mark, .chw-hit-patient mark { background: #fdf0c7; color: inherit; padding: 0 .05rem; border-radius: 2px; }
.chw-hit-patient { display: inline-flex; align-items: center; gap: .25rem; font-size: .76rem; color: var(--brand, #4338ca); }
.chw-hit-patient .chw-i { width: .85rem; height: .85rem; }
.chw-empty.small { margin: .8rem; font-size: .82rem; }

/* Avisos del escritorio. */
.chw-notify { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .55rem; margin: .6rem .7rem 0; padding: .55rem .7rem; border-radius: 12px; background: #eef0fe; border: 1px solid var(--brand-line, #c7c9f5); color: #2b2f6b; font-size: .82rem; }
.chw-notify > .chw-i { color: var(--brand, #4338ca); }
.chw-notify > span:not(.chw-notify-actions) { flex: 1; min-width: 12rem; }
.chw-notify-actions { display: flex; gap: .4rem; margin-left: auto; }
.chw-notify .chw-primary { height: 1.9rem; font-size: .8rem; }
.chw button.chw-plain { border: 0; background: transparent; color: var(--muted, #667085); font-size: .8rem; font-weight: 600; cursor: pointer; padding: 0 .4rem; margin: 0; width: auto; box-shadow: none; }
.chw button.chw-plain:hover { background: transparent; color: var(--text, #1b2430); box-shadow: none; }
.chw-more { align-self: center; border: 0; background: rgba(255, 255, 255, .9); color: var(--brand, #4338ca); border-radius: 999px; padding: .3rem .8rem; font-size: .78rem; font-weight: 600; cursor: pointer; margin: 0 0 .3rem; width: auto; }

.chw-compose { flex: none; background: #f1f3f9; padding: .4rem .5rem .55rem; display: grid; gap: .35rem; border-top: 1px solid rgba(25, 36, 58, .06); }
.chw-compose .chw-error { margin: 0; }
.chw-bar { display: flex; align-items: flex-end; gap: .25rem; }
.chw div.chw-compose .chw-bar button.chw-icon { color: var(--muted, #667085); height: 2.4rem; width: 2.2rem; background: transparent; box-shadow: none; }
.chw div.chw-compose .chw-bar button.chw-icon:hover { background: rgba(25, 36, 58, .07); color: var(--brand, #4338ca); }
.chw-bar textarea { flex: 1; min-width: 0; resize: none; margin: 0; min-height: 2.4rem; max-height: 120px; padding: .55rem .85rem; border-radius: 20px; border: 1px solid var(--line, #e4eaf1); background: #fff; line-height: 1.3; font: inherit; font-size: .9rem; }
.chw-bar textarea:focus { outline: 2px solid var(--brand-focus, #4f46e5); outline-offset: 0; }
.chw div.chw-compose .chw-bar button.chw-send:hover { background: #096b63; }
.chw div.chw-compose .chw-bar button.chw-send { width: 2.4rem; height: 2.4rem; border-radius: 999px; border: 0; background: var(--money, #0b7f76); color: #fff; display: inline-grid; place-items: center; cursor: pointer; flex: none; padding: 0; margin: 0; }
.chw-send:disabled { opacity: .6; }
.chw-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chw-chips[hidden] { display: none; }
.chw-chip { display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; padding: .2rem .25rem .2rem .55rem; border-radius: 999px; background: #fff; border: 1px solid var(--line, #e4eaf1); font-size: .76rem; }
.chw-chip.patient { background: var(--brand-soft, #eef0fe); color: var(--brand, #4338ca); border-color: var(--brand-line, #c7c9f5); }
.chw-chip button { border: 0; background: transparent; padding: .1rem; display: inline-grid; place-items: center; cursor: pointer; color: inherit; margin: 0; width: auto; }
.chw-chip .chw-i { width: .85rem; height: .85rem; }
.chw-patient-search { display: grid; gap: .3rem; background: #fff; border: 1px solid var(--line, #e4eaf1); border-radius: 12px; padding: .45rem; }
.chw-patient-search[hidden] { display: none; }
.chw-patient-search input { margin: 0; }
.chw-patient-results { display: grid; max-height: 9rem; overflow-y: auto; }
.chw-patient-results button { text-align: left; border: 0; background: transparent; padding: .38rem .45rem; border-radius: 8px; cursor: pointer; font: inherit; font-size: .84rem; color: inherit; margin: 0; width: 100%; }
.chw-patient-results button:hover { background: #f6f7fd; }
.chw-patient-results .chw-empty { margin: .4rem; }
.chw-closed { flex: none; margin: 0; padding: .8rem; text-align: center; font-size: .84rem; color: var(--muted, #667085); background: #fff; border-top: 1px solid var(--line, #e4eaf1); }

@media print { .chw { display: none !important; } }

/* --- Revisión de conversaciones (dirección) ------------------------------------------------------------------------- */
.chr { display: grid; gap: 1rem; }
.chr-note { display: flex; gap: .55rem; align-items: flex-start; padding: .7rem .9rem; border-radius: 10px; background: #fdf6e7; border: 1px solid #f3dfb3; color: #7a5212; }
.chr-table td .chr-kind { font-size: .76rem; color: var(--muted, #667085); }
.chr-thread { display: flex; flex-direction: column; gap: .35rem; max-width: 46rem; padding: 1rem; border-radius: 14px; background: #eef1f8; }
.chr-thread .chw-msg { max-width: 88%; }
.chr-quote { display: grid; gap: .05rem; padding: .3rem .5rem; border-left: 3px solid var(--brand, #4338ca); border-radius: 6px; background: rgba(25, 36, 58, .05); }
.chr-withdrawn { font-size: .74rem; font-weight: 700; color: #9a6a1a; }
.chr-thread .chw-msg.withdrawn .chw-text { font-style: normal; color: inherit; }
