.em-channel-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 0 12px;
}
.em-channel-tabs button {
  border: 1px solid #dce1ec;
  border-radius: 12px;
  background: #fff;
  color: #334155;
  padding: 10px 20px;
  font: 600 14px inherit;
  cursor: pointer;
}
.em-channel-tabs button[aria-pressed="true"] {
  background: #182438;
  color: #fff;
  border-color: #182438;
}
.em-inbox {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  border: 1px solid #dce1ec;
  border-radius: 20px;
  background: #fff;
  height: var(--em-inbox-height, calc(100dvh - 200px));
  min-height: 0;
  overflow: hidden;
}
.em-inbox[hidden],
.whatsapp-workspace > .inbox-shell[hidden] {
  display: none !important;
}
.em-inbox-list {
  border-right: 1px solid #e7eaf0;
  overflow: auto;
}
.em-inbox-list header,
.em-inbox-chat-head {
  padding: 20px;
  border-bottom: 1px solid #e7eaf0;
}
.em-inbox h2 {
  font-size: 18px;
  margin: 0 0 8px;
  color: #182438;
}
.em-inbox p {
  font-size: 14px;
  line-height: 1.6;
  color: #536176;
}
.em-inbox button {
  cursor: pointer;
  font: inherit;
}
.em-inbox-list header button,
.em-inbox-draft button {
  border: 1px solid #dce1ec;
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
  color: #182438;
}
.em-inbox-thread {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 17px 20px;
  border: 0;
  border-bottom: 1px solid #eff1f5;
  background: #fff;
  color: #182438;
}
.em-inbox-thread:hover,
.em-inbox-thread:focus-visible {
  background: #eef3ff;
}
.em-inbox-thread span {
  color: #64748b;
  font-size: 12px;
}
.em-inbox-chat {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f7f9fc;
  overflow: hidden;
}
.em-inbox-messages {
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
  touch-action: pan-y;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}
.em-inbox-bubble {
  flex-shrink: 0;
  align-self: flex-start;
  max-width: 85%;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 16px;
  padding: 12px 16px;
}
.em-inbox-bubble.outbound {
  align-self: flex-end;
  background: #e9efff;
  border-color: #d7e2ff;
}
.em-inbox-bubble span {
  font-size: 11px;
  color: #536176;
}
.em-inbox-bubble p,
.em-inbox-draft p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 6px 0 0;
  color: #182438;
}
.em-inbox-draft {
  border: 1px solid #bbcdf7;
  border-radius: 16px;
  background: #fff;
  padding: 16px;
}
.em-inbox-draft button {
  margin: 12px 8px 0 0;
}
.em-inbox-status {
  padding: 12px 20px;
  margin: 0;
}
.em-inbox .is-error {
  color: #a12838;
}
.em-inbox button:focus-visible,
.em-channel-tabs button:focus-visible {
  outline: 3px solid #557dec;
  outline-offset: 3px;
}
@media (max-width: 640px) {
  .em-inbox {
    grid-template-columns: 1fr;
  }
  .em-inbox-list {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid #e7eaf0;
  }
  .em-inbox-chat {
    min-height: 0;
  }
  .em-inbox-bubble {
    max-width: 94%;
  }
}

.em-inbox-list,.em-inbox-chat-head,.em-inbox-status,.em-inbox-composer {min-height:0;}
.em-inbox-chat-head,.em-inbox-status,.em-inbox-composer {flex-shrink:0;}
.em-inbox-messages > * {flex-shrink:0;}
.em-inbox-thread[aria-pressed="true"] {background:#eef3ff;box-shadow:inset 3px 0 #557dec;}
.em-inbox-composer {display:flex;align-items:flex-end;gap:12px;padding:16px;border-top:1px solid #e7eaf0;background:#fff;}
.em-inbox-composer textarea {box-sizing:border-box;flex:1;min-width:0;max-height:140px;resize:vertical;border:1px solid #dce1ec;border-radius:12px;padding:12px;font:inherit;font-size:14px;color:#182438;background:#f7f9fc;}
.em-inbox-composer textarea:focus-visible {outline:2px solid #557dec;outline-offset:2px;}
.em-inbox-send {border:0;border-radius:12px;background:#182438;color:#fff;padding:12px 20px;min-height:44px;font-weight:600;}
.em-inbox button:disabled {opacity:.55;cursor:default;}
.em-inbox-back {display:none;border:0;background:none;color:#334155;padding:0 0 12px;min-height:36px;}
@media(max-width:640px){
 .em-inbox:not(.has-selection) .em-inbox-chat {display:none;}
 .em-inbox.has-selection .em-inbox-list {display:none;}
 .em-inbox-back {display:block;}
 .em-inbox-chat-head {padding:12px 16px;}
 .em-inbox-chat-head h2 {margin-bottom:0;}
 .em-inbox-chat-head p {margin:4px 0 0;}
 .em-inbox-status {font-size:12px;padding:8px 16px;}
 .em-inbox-composer {padding:12px;gap:8px;}
 .em-inbox-composer textarea {font-size:16px;}
 .em-inbox-send {padding:12px;}
}

.whatsapp-workspace[data-inbox-channel="messenger"] .enlaza-inbox-details-button,
.whatsapp-workspace[data-inbox-channel="messenger"] .enlaza-inbox-backdrop,
.whatsapp-workspace[data-inbox-channel="messenger"] .enlaza-inbox-close {display:none !important;}

.em-channel-tabs {flex-wrap:wrap;align-items:center;}
.em-channel-tabs .em-inbox-refresh {margin-left:auto;padding:10px 12px;}
.em-channel-tabs .em-inbox-refresh[hidden] {display:none !important;}
@media(max-width:640px){.em-channel-tabs button {font-size:13px;padding:10px 12px;}}

/* Enlaza composer viewport fix v1: tabs and chat share available space. */
.main .inbox-page.whatsapp-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.main .whatsapp-workspace > .em-channel-tabs {
  flex: 0 0 auto;
}
.main .inbox-page.whatsapp-workspace > .inbox-shell,
.main .inbox-page.whatsapp-workspace > .em-inbox {
  flex: 1 1 0;
  height: auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.main .whatsapp-workspace .chat-stage {
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
@media (min-width: 851px) {
  .main .whatsapp-workspace .chat-stage { display: flex; }
}
@media (max-width: 850px) {
  .main .whatsapp-workspace.has-selected-chat .chat-stage { display: flex; }
}
.main .whatsapp-workspace .chat-head,
.main .whatsapp-workspace .chat-stage > .conversation-paused-banner,
.main .whatsapp-workspace .chat-stage > .conversation-routing-banner {
  flex: 0 0 auto;
}
.main .whatsapp-workspace .message-stream,
.main .whatsapp-workspace .em-inbox-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.main .whatsapp-workspace .inbox-composer,
.main .whatsapp-workspace .em-inbox-composer {
  flex: 0 0 auto;
  max-height: 45%;
  overflow-y: auto;
  position: relative;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.main .whatsapp-workspace .em-inbox-chat { height: 100%; min-height: 0; }
.main .whatsapp-workspace .inbox-composer textarea,
.main .whatsapp-workspace .em-inbox-composer textarea { min-height: 44px; }
