#whatsappRoot { min-width: 0; }
.wa-shell { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: calc(100dvh - 154px); min-height: 520px; max-height: 1000px; border: 1px solid #d5dedb; border-radius: 12px; overflow: hidden; background: #efeae2; }
.wa-sidebar { grid-column: 2; grid-row: 1; background: #fff; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid #d9e0dc; }
.wa-conversation { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background-image: radial-gradient(#b8c5ba45 .8px, transparent .8px); background-size: 15px 15px; }
.wa-toolbar, .wa-chat-header { display: flex; align-items: center; gap: 10px; padding: 14px; background: #f0f2f5; flex-shrink: 0; }
.wa-toolbar { justify-content: space-between; }
.wa-toolbar h1 { margin: 0; font-size: 22px; }
.wa-toolbar small, .wa-account label { color: #64746d; font-size: 12px; }
.wa-account { padding: 12px 14px; display: grid; gap: 7px; border-bottom: 1px solid #edf0ef; }
.wa-account select, .wa-add input { min-width: 0; width: 100%; padding: 9px; border-radius: 7px; border: 1px solid #d5dedb; background: #fff; }
.wa-tools { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 7px; }
.wa-tools button { font-size: 11px; }
.wa-connection { font-size: 12px; color: #215e4e; }
.wa-new { align-self: flex-start; margin: 10px 14px 0; }
.wa-search { padding: 10px 14px; }
.wa-search input { border: 0; background: #f0f2f5; border-radius: 8px; width: 100%; padding: 11px; }
.wa-add { padding: 12px; background: #edf5f1; }
.wa-add:not([hidden]) { display: grid; gap: 8px; }
.wa-add label { font-size: 12px; }
.wa-conversations { overflow-y: auto; min-height: 0; flex: 1; }
.wa-contact-row { display: flex; align-items: center; border-bottom: 1px solid #edf0ef; background: #fff; }
.wa-contact-row.selected { background: #e9edef; }
.wa-contact { display: flex; flex: 1; min-width: 0; width: 100%; align-items: center; gap: 11px; border: 0; background: transparent; padding: 14px; text-align: left; min-height: 76px; }
.wa-chart-actions { display: flex; flex-direction: column; flex-shrink: 0; padding-right: 6px; }
.wa-chart-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #215e4e; cursor: pointer; }
.wa-chart-button:hover { background: #d7e4dd; }
.wa-chart-button:focus-visible { outline: 2px solid #215e4e; outline-offset: -2px; }
.wa-contact:hover, .wa-contact.selected { background: #e9edef; }
.wa-avatar { flex-shrink: 0; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #d7e4dd; color: #527366; font-weight: 600; }
.wa-contact-copy { flex: 1; min-width: 0; display: grid; gap: 6px; }
.wa-contact-copy strong, .wa-contact-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-contact-copy strong { font-size: 14px; }
.wa-contact-copy small { color: #667781; font-size: 12px; }
.wa-meta { display: inline-flex; align-items: center; flex-shrink: 0; gap: 6px; padding-right: 14px; white-space: nowrap; color: #667781; font-size: 10px; }
.wa-meta b { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px; padding: 3px 6px; border-radius: 20px; background: #25d366; color: #17352b; }
.wa-chat-header { flex-wrap: wrap; }
.wa-chat-identity { display: grid; gap: 5px; flex: 1; min-width: 100px; overflow-wrap: anywhere; }
.wa-chat-identity small { font-size: 12px; color: #667781; }
.wa-clinical-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wa-patient-choices { margin: 0; padding: 10px 14px; border: 0; background: #fff4d8; color: #6d4816; font-size: 13px; min-width: 0; }
.wa-patient-choices legend { padding: 0; float: left; width: 100%; margin-bottom: 8px; }
.wa-patient-choices label { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; overflow-wrap: anywhere; }
.wa-patient-choices input { width: auto; }
.wa-clinical-actions .button { font-size: 12px; padding: 8px 10px; }
.wa-messages { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 9px; padding: 24px clamp(12px, 3vw, 40px); overflow-y: auto; }
.wa-bubble { max-width: 85%; border-radius: 8px; padding: 9px 12px 6px; box-shadow: 0 1px 2px #122c231f; overflow-wrap: anywhere; color: #172d28; }
.wa-bubble.incoming { align-self: flex-start; background: #fff; border-top-left-radius: 0; }
.wa-bubble.outgoing { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 0; }
.wa-bubble p { margin: 0 0 5px; white-space: pre-wrap; font-size: 14px; line-height: 1.5; }
.wa-bubble time { display: block; text-align: right; font-size: 10px; color: #667781; }
.wa-media { display: block; margin-bottom: 5px; font-size: 12px; }
.wa-composer { padding: 12px; display: flex; align-items: end; gap: 10px; background: #f0f2f5; }
.wa-composer textarea { flex: 1; resize: none; min-width: 0; max-height: 180px; padding: 12px; border: 0; border-radius: 9px; background: #fff; }
.wa-welcome { margin: auto; padding: 30px; text-align: center; max-width: 500px; line-height: 1.7; color: #52665c; }
.wa-welcome h2 { font-size: 24px; font-weight: 500; }
.wa-welcome small { display: block; margin-top: 25px; }
.wa-welcome-icon { display: block; font-size: 64px; color: #6a9c83; }
.wa-empty { margin: auto; padding: 25px; font-size: 13px; color: #62746a; text-align: center; line-height: 1.6; }
.wa-error, .wa-notice { padding: 12px; background: #fff4d8; color: #6d4816; font-size: 13px; margin: 8px 0; }
.wa-notice { margin: 0; }
.wa-feedback { font-size: 12px; min-height: 20px; padding-top: 6px; color: #62746a; }
.wa-qr { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; background: #11221ab3; padding: 20px; }
.wa-qr > div { background: #fff; border-radius: 14px; padding: 24px; width: min(460px, 100%); max-height: 90dvh; overflow-y: auto; text-align: center; }
.wa-qr img { display: block; width: min(280px, 100%); margin: 18px auto; }
.wa-back { display: none; }
@media (max-width: 1000px) and (min-width: 761px) {
  .wa-shell { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 760px) {
  .page-content:has(#whatsappRoot) { padding: 0; }
  .wa-shell { display: block; height: calc(100dvh - 82px); min-height: 420px; border: 0; border-radius: 0; max-height: none; }
  .wa-sidebar, .wa-conversation { height: 100%; border: 0; }
  .wa-conversation, .wa-chat-open .wa-sidebar { display: none; }
  .wa-chat-open .wa-conversation { display: flex; }
  .wa-toolbar { background: #075e54; color: white; }
  .wa-toolbar small { color: #d4eee5; }
  .wa-toolbar .button { background: transparent; color: white; }
  .wa-back { display: inline-flex; }
  .wa-chat-header { gap: 8px; padding: 10px; }
  .wa-chat-header .wa-avatar { width: 34px; height: 34px; }
  .wa-clinical-actions { width: 100%; justify-content: flex-end; }
  .wa-messages { padding: 16px 12px; }
  .wa-bubble { max-width: 89%; }
  .wa-feedback { padding-left: 12px; }
}
