/* WhatsApp Chat Component — styled after WhatsApp Web (light theme).
   Palette and metrics live in the tokens below; rules reference them so a host
   can re-skin by overriding the variables on .whatsapp-chat-shell. */

.whatsapp-chat-shell {
  --wa-font: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
  --wa-text: #111b21;
  --wa-text-secondary: #667781;
  --wa-icon: #54656f;
  --wa-icon-muted: #8696a0;
  --wa-panel: #ffffff;
  --wa-panel-header: #f0f2f5;
  --wa-hover: #f5f6f6;
  --wa-active: #f0f2f5;
  --wa-divider: #e9edef;
  --wa-border: #d1d7db;
  --wa-chat-bg: #efeae2;
  --wa-bubble-in: #ffffff;
  --wa-bubble-out: #d9fdd3;
  --wa-bubble-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --wa-green: #00a884;
  --wa-green-dark: #008069;
  --wa-unread: #25d366;
  --wa-unread-time: #1fa855;
  --wa-link: #027eb5;
  --wa-tick-read: #53bdeb;
  --wa-chip-active-bg: #d9fdd3;
  --wa-chip-active-fg: #008069;

  container-type: inline-size;
  container-name: wa-shell;
  display: flex;
  height: calc(100vh - 180px);
  border: 1px solid var(--wa-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--wa-panel);
  font-family: var(--wa-font);
  color: var(--wa-text);
  -webkit-font-smoothing: antialiased;
}

.whatsapp-chat-shell .card {
  cursor: default;
}

/* Left panel - Chat list */
.wa-chat-list {
  width: 30%;
  min-width: 300px;
  max-width: 420px;
  border-right: 1px solid var(--wa-border);
  display: flex;
  flex-direction: column;
  background: var(--wa-panel);
}

.wa-chat-list-header {
  padding: 8px 12px 6px;
  position: relative;
}

/* Search pill with a leading magnifier, like WhatsApp Web. */
.wa-chat-list-header::before {
  content: "";
  position: absolute;
  left: 26px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -7px;
  background: var(--wa-icon-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.009 13.805h-.636l-.22-.219a5.184 5.184 0 0 0 1.256-3.386 5.207 5.207 0 1 0-5.207 5.208 5.183 5.183 0 0 0 3.385-1.255l.221.22v.635l4.004 3.999 1.194-1.195-3.997-4.007zm-4.808 0a3.605 3.605 0 1 1 0-7.21 3.605 3.605 0 0 1 0 7.21z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.009 13.805h-.636l-.22-.219a5.184 5.184 0 0 0 1.256-3.386 5.207 5.207 0 1 0-5.207 5.208 5.183 5.183 0 0 0 3.385-1.255l.221.22v.635l4.004 3.999 1.194-1.195-3.997-4.007zm-4.808 0a3.605 3.605 0 1 1 0-7.21 3.605 3.605 0 0 1 0 7.21z'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

.wa-chat-list-header input {
  width: 100%;
  height: 36px;
  border-radius: 18px;
  background: var(--wa-panel-header);
  border: none;
  outline: none;
  padding: 0 14px 0 44px;
  font-size: 14.5px;
  color: var(--wa-text);
  font-family: inherit;
}

.wa-chat-list-header input::placeholder {
  color: var(--wa-text-secondary);
}

.wa-chat-list-header input:focus {
  background: var(--wa-panel-header);
  box-shadow: inset 0 0 0 1.5px var(--wa-green);
}

/* Quick filter chips (Todos / No leídos / Grupos) under the search box. */
.wa-filter-chips {
  display: flex;
  gap: 8px;
  padding: 4px 12px 10px;
  flex-wrap: nowrap;
  align-items: center;
  border-bottom: 1px solid var(--wa-divider);
}

.wa-chip {
  border: none;
  background: var(--wa-panel-header);
  color: var(--wa-icon);
  font-size: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  line-height: 1.4;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.wa-chip:hover {
  background: #e9edef;
}

.wa-chip.active {
  background: var(--wa-chip-active-bg);
  color: var(--wa-chip-active-fg);
}

.wa-chip-count {
  background: var(--wa-green-dark);
  color: #fff;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* "Archivados" as a compact chip pushed to the right of the filter chips. */
.wa-chip-archived {
  margin-left: auto;
  gap: 0.3rem;
}

.wa-chip-archived svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* Back header shown while viewing the archived folder. */
.wa-archived-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f2f5;
  color: #008069;
  font-weight: 500;
  font-size: 0.95rem;
  user-select: none;
}

.wa-archived-header:hover {
  background: #f5f6f6;
}

.wa-archived-header svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: #008069;
}

.wa-chat-empty {
  padding: 1.25rem 1rem;
  color: #8696a0;
  font-size: 0.9rem;
  text-align: center;
  list-style: none;
}

.wa-chat-items {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  list-style: none;
}

.wa-chat-items::-webkit-scrollbar {
  width: 6px;
}

.wa-chat-items::-webkit-scrollbar-track {
  background: transparent;
}

.wa-chat-items::-webkit-scrollbar-thumb {
  background: rgba(11, 20, 26, 0.2);
  border-radius: 3px;
}

.wa-chat-items::-webkit-scrollbar-thumb:hover {
  background: rgba(11, 20, 26, 0.3);
}

/* Chat row: 72px tall, 49px avatar, the divider runs under the text only. */
.wa-chat-item {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 0 15px 0 13px;
  cursor: pointer;
  gap: 15px;
  position: relative;
}

.wa-chat-item::after {
  content: "";
  position: absolute;
  left: 77px;
  right: 0;
  bottom: 0;
  border-bottom: 1px solid var(--wa-divider);
}

.wa-chat-item:last-child::after { display: none; }

.wa-chat-item:hover {
  background: var(--wa-hover);
}

.wa-chat-item.active {
  background: var(--wa-active);
}

.wa-chat-avatar {
  width: 49px;
  height: 49px;
  min-width: 49px;
  border-radius: 50%;
  background: #dfe5e7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #8696a0;
  overflow: hidden;
}

.wa-chat-avatar svg {
  width: 22px;
  height: 22px;
}

.wa-chat-avatar.wa-avatar-initials {
  color: #fff;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
  justify-content: center;
}

.wa-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-chat-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 12px 0;
}

.wa-chat-name {
  font-weight: 400;
  font-size: 17px;
  line-height: 21px;
  color: var(--wa-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-chat-phone {
  font-size: 14px;
  line-height: 20px;
  color: var(--wa-text-secondary);
}

.wa-chat-last-msg {
  font-size: 14px;
  line-height: 20px;
  color: var(--wa-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Time on top, unread badge under it — both right-aligned, like WhatsApp Web. */
.wa-chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  align-self: stretch;
  gap: 6px;
  flex-shrink: 0;
  padding: 14px 0 12px;
}

.wa-chat-time {
  font-size: 12px;
  line-height: 14px;
  color: var(--wa-text-secondary);
  white-space: nowrap;
}

.wa-chat-item:has(.wa-unread-badge) .wa-chat-time {
  color: var(--wa-unread-time);
  font-weight: 500;
}

.wa-chat-item:has(.wa-unread-badge) .wa-chat-name {
  font-weight: 500;
}

.wa-chat-item:has(.wa-unread-badge) .wa-chat-last-msg {
  color: var(--wa-text);
}

.wa-unread-badge {
  background: var(--wa-unread);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Right panel - Messages */
.wa-messages-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--wa-chat-bg);
  min-width: 0;
  position: relative;
}

.wa-messages-header {
  height: 60px;
  min-height: 60px;
  padding: 0 16px;
  background: var(--wa-panel-header);
  border-bottom: 1px solid var(--wa-divider);
  display: flex;
  align-items: center;
  gap: 15px;
  z-index: 2;
}

.wa-messages-header .wa-chat-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  font-size: 15px;
}

.wa-messages-header-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.wa-messages-header-name {
  font-weight: 400;
  font-size: 16px;
  line-height: 21px;
  color: var(--wa-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-messages-header-phone {
  font-size: 13px;
  line-height: 20px;
  color: var(--wa-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Conversation canvas. Side gutter scales with the panel so a narrow embedded
   shell (patient / appointment page) does not starve the bubbles of width. */
.wa-messages-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px clamp(12px, 6%, 64px) 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.wa-messages-body::-webkit-scrollbar {
  width: 6px;
}

.wa-messages-body::-webkit-scrollbar-track {
  background: transparent;
}

.wa-messages-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.wa-message {
  display: flex;
  flex-direction: column;
  margin-top: 12px;   /* gap between sender groups */
}

/* Consecutive messages from the same side form a group: tight spacing and only
   the first bubble of the group carries the tail. Date dividers break groups. */
.wa-message.sent + .wa-message.sent,
.wa-message.received + .wa-message.received {
  margin-top: 2px;
}

.wa-message.sent {
  align-items: flex-end;
}

.wa-message.received {
  align-items: flex-start;
}

.wa-bubble {
  max-width: min(65%, 560px);
  padding: 6px 7px 8px 9px;
  border-radius: 7.5px;
  position: relative;
  box-shadow: var(--wa-bubble-shadow);
  overflow-wrap: anywhere;
  font-size: 14.2px;
  line-height: 19px;
  color: var(--wa-text);
}

.wa-message.sent .wa-bubble {
  background: var(--wa-bubble-out);
}

.wa-message.received .wa-bubble {
  background: var(--wa-bubble-in);
}

/* Tail on the first bubble of each group (squared corner + little hook). */
.wa-message.sent:not(.sent + .sent) .wa-bubble { border-top-right-radius: 0; }
.wa-message.received:not(.received + .received) .wa-bubble { border-top-left-radius: 0; }

.wa-message.sent:not(.sent + .sent) .wa-bubble::before,
.wa-message.received:not(.received + .received) .wa-bubble::before {
  content: "";
  position: absolute;
  top: 0;
  width: 8px;
  height: 13px;
}

.wa-message.sent:not(.sent + .sent) .wa-bubble::before {
  right: -8px;
  background: var(--wa-bubble-out);
  clip-path: path("M0 0 H6.4 C7.9 0 8.6 1.8 7.6 2.9 L0 13 Z");
}

.wa-message.received:not(.received + .received) .wa-bubble::before {
  left: -8px;
  background: var(--wa-bubble-in);
  clip-path: path("M8 0 H1.6 C0.1 0 -0.6 1.8 0.4 2.9 L8 13 Z");
}

.wa-bubble-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.wa-bubble-text strong { font-weight: 700; }
.wa-bubble-text em { font-style: italic; }
.wa-bubble-text s { text-decoration: line-through; }

.wa-bubble-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.05em 0.3em;
  border-radius: 4px;
  font-size: 0.88em;
}

.wa-bubble-pre {
  margin: 0.25rem 0;
  padding: 0.5rem 0.7rem;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  white-space: pre-wrap;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.wa-bubble-pre code {
  background: transparent;
  padding: 0;
}

.wa-bubble-time {
  position: absolute;
  right: 7px;
  bottom: 3px;
  font-size: 11px;
  line-height: 15px;
  color: var(--wa-text-secondary);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

/* Invisible stand-in for the time at the end of the text (see buildMessageEl). */
.wa-time-spacer {
  display: inline-block;
  visibility: hidden;
  font-size: 11px;
  line-height: 15px;
  padding-left: 10px;
  white-space: nowrap;
  vertical-align: baseline;
}

.wa-time-spacer-status { padding-right: 20px; }

/* Message status icons */
.wa-msg-status {
  margin-left: 3px;
  display: inline-block;
  vertical-align: middle;
  position: relative;
  top: -1px;
}
.wa-msg-status svg {
  vertical-align: middle;
}
.wa-msg-status-pending { color: var(--wa-icon-muted); }
.wa-msg-status-sent { color: var(--wa-icon-muted); }
.wa-msg-status-delivered { color: var(--wa-icon-muted); }
.wa-msg-status-read { color: var(--wa-tick-read); }
.wa-msg-status-failed { color: #e74c3c; }

/* Floating "jump to latest" button (bottom-right of the conversation). */
.wa-scroll-down {
  position: absolute;
  right: 18px;
  bottom: 80px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--wa-panel);
  color: var(--wa-icon-muted);
  box-shadow: 0 1px 1px rgba(11, 20, 26, 0.06), 0 2px 5px rgba(11, 20, 26, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 3;
}

.wa-scroll-down.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.wa-scroll-down:hover { color: var(--wa-icon); }

/* Compose bar: a white rounded "pill" holding the attach / template icons and
   the text input, with the send button beside it — WhatsApp Web layout. */
.wa-compose {
  min-height: 62px;
  padding: 10px 16px;
  background: var(--wa-panel-header);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.wa-compose-pill {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  background: var(--wa-panel);
  border-radius: 24px;
  padding: 3px 6px;
  min-height: 42px;
}

/* Disconnected line: the composer is replaced by a reconnect notice. */
.wa-compose-offline {
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  background: #fdecea;
  border-top: 1px solid #f5c2c7;
  color: #842029;
  font-size: 0.85rem;
  text-align: center;
}
.wa-compose-offline svg { width: 1.05em; height: 1.05em; flex: none; }
.wa-compose-offline .wa-offline-link {
  color: #842029;
  font-weight: 600;
  text-decoration: underline;
}
.wa-compose-offline .wa-offline-link:hover { color: #b02a37; }

.wa-compose input,
.wa-compose textarea {
  flex: 1 1 0%;
  min-width: 0;
  border-radius: 0 !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 9px 8px;
  font-size: 15px;
  line-height: 20px;
  color: var(--wa-text);
  background: transparent;
  font-family: inherit;
  resize: none !important;
  max-height: 140px;
  overflow-y: auto;
}

.wa-compose textarea::placeholder {
  color: var(--wa-text-secondary);
}

.wa-compose input:focus,
.wa-compose textarea:focus {
  outline: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
  --tw-ring-shadow: 0 0 #0000;
  --tw-ring-offset-shadow: 0 0 #0000;
}

/* Send: a plain grey icon while the input is empty, a green circle once there
   is something to send (text or a picked file). */
.wa-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--wa-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.wa-send-btn svg { width: 22px; height: 22px; }

.wa-compose:has(textarea:not(:placeholder-shown)) .wa-send-btn,
.wa-messages-panel:has(.wa-file-preview:not([style*="none"])) .wa-send-btn {
  background: var(--wa-green);
  color: #fff;
}

.wa-compose:has(textarea:not(:placeholder-shown)) .wa-send-btn:hover {
  background: var(--wa-green-dark);
}

.wa-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Empty state */
.wa-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8696a0;
  background: #f0f2f5;
}

.wa-empty-state i {
  font-size: 5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.wa-empty-state p {
  font-size: 1rem;
}

/* History loading */
.wa-history-loading {
  text-align: center;
  color: #8696a0;
  font-size: 0.85rem;
  padding: 2rem;
}

/* The banner after it has stopped pretending to work: same place, no spinner
   cue, clearly a final state. A "loading" style on a message that is not
   loading anything is what made the old behaviour unreadable. */
.wa-history-loading--settled {
  opacity: 0.75;
  font-style: italic;
}

/* Media messages */
.wa-media-img {
  max-width: 100%;
  height: auto;              /* width/height attrs set the ratio; scale to fit */
  border-radius: 6px;
  cursor: pointer;
  display: block;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.04);   /* placeholder tint while the file loads */
}

.wa-media-video {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.04);
}

.wa-media-audio {
  width: 100%;
  margin-bottom: 4px;
}

.wa-voice-note {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  margin-bottom: 4px;
}

.wa-voice-note audio {
  display: none;
}

.wa-voice-play {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  border: none;
  background: #00a884;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
}

.wa-voice-play:hover {
  background: #008c6f;
}

.wa-voice-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  height: 24px;
  justify-content: center;
}

.wa-voice-track::before {
  content: "";
  display: block;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.15);
  width: 100%;
}

.wa-voice-bar {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 2px;
  background: #00a884;
  width: 0%;
  transition: width 0.1s linear;
}

.wa-voice-duration {
  font-size: 0.7rem;
  color: #667781;
  position: absolute;
  bottom: -2px;
  left: 0;
}

.wa-media-sticker {
  max-width: 180px;
  height: auto;
  display: block;
  margin-bottom: 4px;
}

/* Reserved box for media whose file hasn't downloaded yet. Inline width +
   aspect-ratio (set in JS from the stored dimensions) make it occupy exactly
   the space the real image/video will, so the swap-in causes no layout shift. */
.wa-media-placeholder {
  max-width: 100%;
  border-radius: 6px;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.06);
}

.wa-media-doc {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  color: #027eb5;
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.wa-media-doc:hover {
  background: rgba(0, 0, 0, 0.08);
}

.wa-media-doc i {
  font-size: 1.25rem;
}

.wa-bubble-unsupported {
  color: #8696a0;
  font-style: italic;
  font-size: 0.85rem;
}

/* Attach button */
.wa-attach-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--wa-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  flex-shrink: 0;
  transition: color 0.15s;
}

.wa-attach-btn svg { width: 24px; height: 24px; }

.wa-attach-btn:hover {
  color: #111b21;
}

/* File preview bar */
.wa-file-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: #e8e8e8;
  border-top: 1px solid #dee2e6;
}

.wa-file-preview-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.wa-file-preview i {
  font-size: 2rem;
  color: #54656f;
}

.wa-file-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.wa-file-preview-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-file-preview-size {
  font-size: 0.75rem;
  color: #667781;
}

.wa-file-preview-remove {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #667781;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.wa-file-preview-remove:hover {
  color: #111b21;
}

/* Drop zone overlay */
.wa-drop-zone {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 168, 132, 0.15);
  border: 3px dashed #00a884;
  border-radius: 8px;
  z-index: 10;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: #00a884;
  pointer-events: none;
}

.wa-drop-zone.active {
  display: flex;
}

/* Upload state */
.wa-uploading .wa-compose {
  opacity: 0.6;
  pointer-events: none;
}

/* Session selector */
.wa-session-select {
  border-radius: 6px;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid #dee2e6;
}

/* Old line (Kapso number migrated from Baileys) ----------------------------- */
/* Folder row for the old line's pending chats, like WhatsApp's "Archivados". */
.wa-legacy-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--wa-divider);
  background: var(--wa-panel);
  color: var(--wa-text);
  padding: 12px 16px 12px 22px;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.wa-legacy-row:hover { background: var(--wa-panel-header); }
.wa-legacy-row svg { width: 20px; height: 20px; color: var(--wa-green); flex: none; }
.wa-legacy-row-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-legacy-row-count { color: var(--wa-green); font-size: 12px; font-weight: 600; }

/* Messages from the old line: same bubbles, visibly in the past. */
.wa-msg-legacy .wa-bubble { opacity: 0.62; }
.wa-legacy-divider {
  display: flex;
  justify-content: center;
  margin: 16px 0 4px;
}
.wa-legacy-divider span {
  background: #fff7d6;
  color: #54656f;
  font-size: 12.5px;
  line-height: 18px;
  padding: 5px 12px;
  border-radius: 7.5px;
  box-shadow: var(--wa-bubble-shadow);
  text-align: center;
}

/* Date dividers */
.wa-date-divider {
  display: flex;
  justify-content: center;
  margin: 12px 0 0;
}

.wa-date-divider span {
  background: var(--wa-panel);
  color: var(--wa-icon);
  font-size: 12.5px;
  line-height: 21px;
  padding: 5px 12px 6px;
  border-radius: 7.5px;
  box-shadow: var(--wa-bubble-shadow);
}

/* Group chat sender name */
.wa-bubble-sender {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1f7aec; /* default, overridden by inline style per contact */
  margin-bottom: 2px;
}

/* Raw JSON dialog (easter egg) */
.wa-json-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-json-dialog {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 8px;
  width: 600px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.wa-json-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
  font-weight: 600;
  font-size: 0.9rem;
}

.wa-json-dialog-close {
  background: none;
  border: none;
  color: #d4d4d4;
  font-size: 1.2rem;
  cursor: pointer;
}

.wa-json-dialog pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  flex: 1;
  font-family: monospace;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
}

/* Chat dialog (modal) */
.wa-chat-dialog-body {
  height: 70vh;
  display: flex;
  flex-direction: column;
}

.wa-chat-dialog-body .wa-messages-panel {
  flex: 1;
  border-radius: 0;
}

.wa-chat-dialog-body .wa-messages-body {
  padding: 1rem 2rem;
}

.wa-loading-spinner {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 0.2em solid currentColor;
  border-right-color: transparent;
  animation: wa-spin 0.75s linear infinite;
  color: #25d366;
}

@keyframes wa-spin {
  to { transform: rotate(360deg); }
}

/* Per-message action menu (delete / edit) */
.wa-bubble {
  /* Ensure the absolute-positioned menu trigger anchors correctly */
}

/* Message action menu — WhatsApp Web style */
.wa-msg-menu {
  position: absolute;
  top: 0;
  right: 0;
  opacity: 0;
  transition: opacity 0.12s ease-in;
  z-index: 5;
  pointer-events: none;
}

.wa-message.received .wa-msg-menu {
  right: 0;
  left: auto;
}

.wa-bubble:hover .wa-msg-menu,
.wa-msg-menu:focus-within,
.wa-msg-menu:has(.wa-msg-menu-dropdown.open) {
  opacity: 1;
  pointer-events: auto;
}

/* Gradient fade behind the chevron so it blends with bubble */
.wa-msg-menu::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 32px;
  border-radius: 0 8px 0 0;
  pointer-events: none;
}

.wa-message.sent .wa-msg-menu::before {
  background: linear-gradient(to left, #d9fdd3 40%, transparent);
}

.wa-message.received .wa-msg-menu::before {
  background: linear-gradient(to left, #fff 40%, transparent);
}

.wa-msg-menu-trigger {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: #54656f;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  margin: 2px 2px 0 0;
}

.wa-msg-menu-trigger:hover {
  color: #111b21;
}

/* Chevron icon via CSS instead of text "⋮" */
.wa-msg-menu-trigger::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.wa-msg-menu-dropdown {
  display: none;
  position: absolute;
  top: 28px;
  right: 0;
  min-width: 190px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  padding: 6px 0;
  z-index: 100;
  overflow: hidden;
}

.wa-message.received .wa-msg-menu-dropdown {
  right: 0;
  left: auto;
}

.wa-msg-menu-dropdown.open {
  display: block;
}

.wa-msg-menu-item {
  display: block !important;
  width: 100% !important;
  padding: 10px 20px !important;
  text-align: left !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 0.9rem !important;
  color: #111b21 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  font-family: inherit !important;
  line-height: 1.4 !important;
}

.wa-msg-menu-item:hover {
  background: #f0f2f5 !important;
}

/* "Editing message" banner above the compose box */
.wa-edit-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: #f0f2f5;
  border-top: 1px solid #dee2e6;
  border-left: 3px solid #00a884;
  font-size: 0.85rem;
  color: #111b21;
}

.wa-edit-banner > i {
  color: #00a884;
  font-size: 1rem;
  flex-shrink: 0;
}

.wa-edit-banner-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.wa-edit-banner-title {
  font-weight: 600;
  color: #00a884;
  font-size: 0.8rem;
}

.wa-edit-banner-preview {
  color: #54656f;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-edit-banner-cancel {
  background: transparent;
  border: none;
  color: #54656f;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}

.wa-edit-banner-cancel:hover {
  color: #111b21;
}

/* Reply bar — shown above the compose area when replying */
.wa-reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: #f0f2f5;
  border-top: 1px solid #e9edef;
}

.wa-reply-bar-accent {
  width: 4px;
  align-self: stretch;
  background: #00a884;
  border-radius: 2px;
  flex-shrink: 0;
}

.wa-reply-bar-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.wa-reply-bar-sender {
  font-size: 0.8rem;
  font-weight: 600;
  color: #00a884;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-reply-bar-text {
  font-size: 0.82rem;
  color: #54656f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-reply-bar-cancel {
  background: none;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  cursor: pointer;
  color: #54656f;
  font-size: 1.2rem;
  padding: 0 4px;
  flex-shrink: 0;
  line-height: 1;
}

.wa-reply-bar-cancel:hover {
  color: #111b21;
}

/* Quoted / reply preview inside bubble */
.wa-quoted-msg {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border-left: 4px solid #00a884;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  margin-bottom: 6px;
  overflow: hidden;
  max-width: 100%;
}

.wa-message.sent .wa-quoted-msg {
  border-left-color: #0a6e4e;
}

/* Text body (sender + preview text) */
.wa-quoted-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 10px;
}

.wa-quoted-sender {
  font-size: 0.8rem;
  font-weight: 600;
  color: #00a884;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-message.sent .wa-quoted-sender {
  color: #0a6e4e;
}

.wa-quoted-text {
  font-size: 0.82rem;
  color: #54656f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Thumbnail on the right side of the quoted preview */
.wa-quoted-thumb {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  object-fit: cover;
  display: block;
  border-radius: 0 4px 4px 0;
}

/* Placeholder shown when thumb data is absent */
.wa-quoted-thumb-placeholder {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.12);
  border-radius: 0 4px 4px 0;
  font-size: 1.4rem;
  color: #54656f;
}

/* Flash highlight when scrolling to original */
.wa-msg-highlight .wa-bubble {
  animation: wa-highlight-flash 1.5s ease-out;
}

@keyframes wa-highlight-flash {
  0%   { box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.5); }
  100% { box-shadow: none; }
}

/* @Mentions inside bubbles */
.wa-mention {
  color: #027eb5;
  font-weight: 500;
  cursor: default;
}

.wa-message.sent .wa-mention {
  color: #0a6e4e;
}

/* Clickable links inside bubbles */
.wa-bubble-link {
  color: var(--wa-link);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.wa-bubble-link:hover {
  text-decoration: underline;
}

/* Reactions bar */
.wa-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: -10px;
  padding: 0 6px;
  position: relative;
  z-index: 2;
}

.wa-message.sent .wa-reactions {
  justify-content: flex-end;
  padding-right: 10px;
}

.wa-message.received .wa-reactions {
  justify-content: flex-start;
  padding-left: 10px;
}

.wa-reaction-pill {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid #e9edef;
  border-radius: 20px;
  padding: 2px 5px;
  font-size: 0.75rem;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  cursor: default;
  user-select: none;
  gap: 2px;
}

/* Deleted (revoked) bubble */
.wa-bubble-deleted {
  opacity: 0.65;
}

.wa-bubble-deleted-text {
  text-decoration: line-through;
  color: #8696a0;
}

/* Edited label inside bubble */
.wa-bubble-edited {
  display: inline-block;
  font-size: 0.7rem;
  color: #8696a0;
  margin-right: 6px;
  cursor: pointer;
  font-style: italic;
  vertical-align: middle;
}

.wa-bubble-edited:hover {
  color: #54656f;
  text-decoration: underline;
}

/* Edit history popover */
.wa-edit-history-popover {
  position: absolute;
  z-index: 9999;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  min-width: 260px;
  max-width: 360px;
  overflow: hidden;
}

.wa-edit-history-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #54656f;
  padding: 10px 14px 6px;
  border-bottom: 1px solid #f0f2f5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wa-edit-history-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid #f0f2f5;
}

.wa-edit-history-row:last-child {
  border-bottom: none;
}

.wa-edit-history-current {
  background: #f0fdf4;
}

.wa-edit-history-version {
  font-size: 0.7rem;
  font-weight: 600;
  color: #8696a0;
  min-width: 36px;
  padding-top: 2px;
  flex-shrink: 0;
}

.wa-edit-history-current .wa-edit-history-version {
  color: #00a884;
}

.wa-edit-history-text {
  font-size: 0.88rem;
  color: #111b21;
  line-height: 1.4;
  word-break: break-word;
}

/* ── Kapso: 24h window countdown + template composer ─────────────────────── */
.wa-window-timer {
  margin-left: auto;
  align-self: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #017561;
  background: #d9fdd3;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}
.wa-window-timer-low    { color: #b26a00; background: #ffecb3; }
.wa-window-timer-closed { color: #b3261e; background: #fbe0dd; }

/* Template button inside the composer (window open) */
.wa-template-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--wa-icon);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wa-template-btn svg { width: 22px; height: 22px; }
.wa-template-btn:hover { color: var(--wa-text); }

/* Composer replacement shown when the 24h window is closed */
.wa-compose-closed {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.wa-compose-closed svg { width: 22px; height: 22px; color: #b26a00; flex: none; }
.wa-closed-text { font-size: 0.85rem; color: #54656f; flex: 1 1 auto; min-width: 140px; }
.wa-compose-closed .wa-template-btn-lg {
  width: auto;
  height: auto;
  border: none;
  background: #008069;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  flex: none;
}
.wa-compose-closed .wa-template-btn-lg svg { width: 18px; height: 18px; }
.wa-compose-closed .wa-template-btn-lg:hover { background: #017561; }

/* Template picker modal */
.wa-tpl-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}
.wa-tpl-modal {
  background: #fff;
  width: min(560px, 92vw);
  max-height: 82vh;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.wa-tpl-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #008069;
  color: #fff;
  font-weight: 600;
}
.wa-tpl-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.wa-tpl-list { overflow-y: auto; padding: 0.5rem; }
.wa-tpl-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: #f7f8fa;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
}
.wa-tpl-item:hover { background: #eef0f2; }
.wa-tpl-name { font-weight: 600; color: #111b21; margin-right: 0.4rem; }
.wa-tpl-lang { font-size: 0.72rem; color: #8696a0; text-transform: uppercase; }
.wa-tpl-snippet { display: block; font-size: 0.82rem; color: #667781; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.wa-tpl-detail { overflow-y: auto; padding: 0.85rem 1rem 1rem; }
.wa-tpl-back { border: none; background: transparent; color: #008069; font-weight: 600; cursor: pointer; padding: 0; margin-bottom: 0.6rem; }
.wa-tpl-detail-name { font-weight: 600; color: #111b21; margin-bottom: 0.5rem; }
.wa-tpl-detail-name small { color: #8696a0; font-weight: 400; text-transform: uppercase; font-size: 0.72rem; }
.wa-tpl-preview-header { font-weight: 600; color: #111b21; margin-bottom: 0.25rem; }
.wa-tpl-preview {
  background: #d9fdd3;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  color: #111b21;
  white-space: pre-wrap;
  word-break: break-word;
}
.wa-tpl-preview-footer { font-size: 0.75rem; color: #8696a0; margin-top: 0.25rem; }
.wa-tpl-vars { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; }
.wa-tpl-var { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; color: #54656f; }
.wa-tpl-var input {
  border: 1px solid #dde1e5;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
}
.wa-tpl-var input:focus { outline: none; border-color: #008069; box-shadow: 0 0 0 2px rgba(0,128,105,0.15); }
.wa-tpl-actions { margin-top: 0.9rem; display: flex; align-items: center; gap: 0.75rem; }
.wa-tpl-send {
  border: none;
  background: #008069;
  color: #fff;
  font-weight: 600;
  border-radius: 20px;
  padding: 0.5rem 1.4rem;
  cursor: pointer;
}
.wa-tpl-send:disabled { opacity: 0.6; cursor: default; }
.wa-tpl-send:hover:not(:disabled) { background: #017561; }
.wa-tpl-error { color: #b3261e; font-size: 0.82rem; }

/* Kapso interactive-type badge (template / button / interactive / list) shown at
   the top of the bubble in place of the old "[TYPE]" text prefix. */
.wa-bubble-badge {
  display: block;
  width: max-content;
  max-width: 100%;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: #667781;
}
.wa-bubble-badge-template    { background: #cdeede; color: #017561; }
.wa-bubble-badge-interactive { background: #dbeafd; color: #1a6dc7; }
.wa-bubble-badge-button      { background: #e7e0fb; color: #6b4fbb; }
.wa-bubble-badge-list        { background: #fce7cd; color: #b26a00; }

/* Read-only display of the buttons / list options shown to the client (Kapso).
   Styled like WhatsApp's in-bubble buttons, but not clickable. */
/* Bubble + its quick-reply buttons, sharing one width (WhatsApp layout). */
.wa-bubble-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: min(65%, 560px);
}
.wa-bubble-stack > .wa-bubble { max-width: 100%; }

.wa-bubble-buttons {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wa-bubble-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 7.5px;
  background: var(--wa-bubble-in);
  box-shadow: var(--wa-bubble-shadow);
  color: var(--wa-link);
  font-size: 14px;
  cursor: default;
}
.wa-message.sent .wa-bubble-btn { background: var(--wa-bubble-out); }

/* Voice-note playback-speed toggle (1× / 1.5× / 2×), WhatsApp-style. */
.wa-voice-speed {
  flex: none;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: #54656f;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 7px;
  cursor: pointer;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.wa-voice-speed.active {
  background: #00a884;
  color: #fff;
}
.wa-voice-speed:hover {
  filter: brightness(0.96);
}

/* "Unsupported" inbound messages (WhatsApp error 131051): a clean muted note
   instead of the raw error string. */
.wa-bubble-unsupported-note {
  font-style: italic;
  color: #8696a0;
  font-size: 0.85rem;
}

/* Session <select> connection-status colors (shown alongside the 🟢/🟡/🔴 emoji;
   option colors render in Chrome/Firefox, the emoji covers every browser). */
.wa-session-select option.wa-opt-connected    { color: #017561; }
.wa-session-select option.wa-opt-connecting   { color: #b26a00; }
.wa-session-select option.wa-opt-disconnected { color: #b3261e; }

/* Chat list context menu (right-click / long-press → Archivar). */
.wa-chat-ctx-menu {
  position: fixed;
  z-index: 2000;
  min-width: 170px;
  padding: 4px 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.wa-chat-ctx-menu button {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: #111b21;
  cursor: pointer;
}
.wa-chat-ctx-menu button:hover { background: #f0f2f5; }
.wa-chat-item-pending { opacity: .5; pointer-events: none; }

/* Composer quick replies ("/" → list of canned replies). */
.wa-qr-menu {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 6px);
  max-height: 260px;
  overflow-y: auto;
  z-index: 1500;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  padding: 4px 0;
}
.wa-qr-title { font-size: 12px; color: #667781; padding: 6px 12px 4px; }
.wa-qr-item { padding: 6px 12px; cursor: pointer; }
.wa-qr-item.active, .wa-qr-item:hover { background: #f0f2f5; }
.wa-qr-shortcut { font-weight: 600; font-size: 13px; color: #111b21; }
.wa-qr-text { font-size: 12.5px; color: #54656f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-qr-empty { padding: 8px 12px; font-size: 13px; color: #667781; }


/* Narrow shells (an embedded panel, a small laptop with a side panel open):
   give the conversation the room — slimmer list, tighter gutters. */
@container wa-shell (max-width: 860px) {
  .wa-chat-list { width: 250px; min-width: 250px; }
  .wa-chat-item { gap: 12px; padding: 0 12px 0 10px; }
  .wa-chat-item::after { left: 71px; }
  .wa-messages-body { padding-left: 10px; padding-right: 10px; }
  .wa-bubble, .wa-bubble-stack { max-width: 85%; }
}

@container wa-shell (max-width: 560px) {
  .wa-chat-list { width: 200px; min-width: 200px; }
  .wa-chat-avatar { width: 40px; height: 40px; min-width: 40px; }
  .wa-chat-item::after { left: 62px; }
  .wa-chat-name { font-size: 15px; }
  .wa-filter-chips { overflow-x: auto; }
}
