/* WhatsApp inbox */
.wa-setup { padding: 20px; max-width: 720px; }
.wa-setup-form { display: grid; gap: 12px; margin-top: 12px; }
.wa-setup-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.wa-setup-form input { min-height: 42px; padding: 9px 12px; border: 1px solid var(--border, #e2e7ed); border-radius: 10px; font: inherit; }
.wa-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; height: calc(100vh - 230px); min-height: 480px; }
.wa-list, .wa-thread { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.wa-list-head { padding: 12px; border-bottom: 1px solid var(--border, #e8e7e3); display: grid; gap: 10px; }
.wa-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.wa-tabs button { border: 0; background: #f4f3f1; border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; color: #6f6b65; }
.wa-tabs button.active { background: #e7f8ee; color: #128c4a; }
.wa-list-head input { width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border, #e8e7e3); border-radius: 9px; font: inherit; }
.wa-conversations { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.wa-conversation { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 12px; border: 0; border-bottom: 1px solid #f0efec; background: #fff; text-align: left; font: inherit; color: inherit; }
.wa-conversation:hover, .wa-conversation.active { background: #f3fbf6; }
.wa-avatar { width: 38px; height: 38px; border-radius: 50%; background: #dcf5e6; color: #128c4a; display: grid; place-items: center; font-weight: 800; }
.wa-conv-main { display: grid; min-width: 0; gap: 2px; }
.wa-conv-main strong, .wa-conv-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-conv-main strong { font-size: 14px; }
.wa-conv-main span { font-size: 13px; color: var(--muted, #77736d); }
.wa-ad { font-style: normal; font-size: 11px; font-weight: 700; color: #a15c00; background: #fff3d6; border-radius: 6px; padding: 1px 5px; }
.wa-conv-meta { display: grid; justify-items: end; gap: 4px; }
.wa-conv-meta small { font-size: 11px; color: var(--muted, #77736d); }
.wa-conv-meta b { min-width: 20px; height: 20px; border-radius: 10px; background: #25d366; color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 5px; }
.wa-empty { padding: 24px 16px; color: var(--muted, #77736d); font-size: 14px; }
.wa-thread-empty { align-items: center; justify-content: center; color: var(--muted, #77736d); }
.wa-thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border, #e8e7e3); }
.wa-thread-head > div:nth-child(2) { display: grid; min-width: 0; flex: 1; }
.wa-thread-head span { font-size: 13px; color: var(--muted, #77736d); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-thread-actions { display: flex; gap: 6px; }
.wa-back { display: none; }
.wa-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #f6f4ef; }
.wa-msg { max-width: min(72%, 520px); padding: 8px 10px 6px; border-radius: 12px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.06); align-self: flex-start; display: grid; gap: 4px; }
.wa-msg.out { align-self: flex-end; background: #dcf8c6; }
.wa-msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.wa-msg img, .wa-msg video { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; }
.wa-msg audio { width: 260px; max-width: 100%; }
.wa-doc { font-size: 14px; color: inherit; }
.wa-media-wait { font-size: 13px; color: var(--muted, #77736d); font-style: italic; }
.wa-referral { font-size: 12px; font-weight: 700; color: #a15c00; }
.wa-msg-meta { justify-self: end; font-size: 11px; color: #7b8a80; }
.wa-tick { letter-spacing: -3px; margin-left: 2px; }
.wa-tick.read { color: #34b7f1; }
.wa-tick.failed { color: #d93025; letter-spacing: 0; font-weight: 800; }
.wa-msg-error { font-size: 12px; color: #d93025; }
.wa-reply { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: end; padding: 12px 16px; border-top: 1px solid var(--border, #e8e7e3); }
.wa-reply textarea { min-height: 44px; max-height: 160px; resize: vertical; padding: 10px 12px; border: 1px solid var(--border, #e8e7e3); border-radius: 10px; font: inherit; }
.wa-reply small { grid-column: 1 / -1; font-size: 12px; color: var(--muted, #77736d); }
.wa-window-closed { grid-column: 1 / -1; margin: 0; font-size: 13px; color: #8a5a00; background: #fff6df; border-radius: 10px; padding: 10px 12px; }
@media (max-width: 860px) {
  .wa-layout { grid-template-columns: 1fr; height: calc(100vh - 200px); }
  .wa-layout.thread-open .wa-list { display: none; }
  .wa-layout:not(.thread-open) .wa-thread { display: none; }
  .wa-back { display: inline-flex; }
  .wa-thread-actions .ghost { padding: 4px 6px; }
  .wa-msg { max-width: 88%; }
}
