.portal-chat-launcher {
  align-items: center;
  background: linear-gradient(135deg, #075da8, #06457c);
  border: 0;
  border-radius: 999px;
  bottom: 22px;
  box-shadow: 0 16px 36px rgba(2, 42, 75, 0.28);
  color: #fff;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 850;
  gap: 0.5rem;
  min-height: 50px;
  padding: 0.7rem 1rem;
  position: fixed;
  right: 22px;
  z-index: 8500;
}

.portal-chat-launcher-badge {
  align-items: center;
  background: #ff356f;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.68rem;
  justify-content: center;
  min-height: 22px;
  min-width: 22px;
  padding: 0 0.35rem;
}

.portal-chat-shell {
  background: #fff;
  border-left: 1px solid #d8e4f0;
  bottom: 0;
  box-shadow: -18px 0 48px rgba(5, 35, 58, 0.18);
  color: #18364d;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-width: 100%;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(105%);
  transition: transform 0.24s ease;
  pointer-events: none;
  visibility: hidden;
  width: min(760px, 94vw);
  z-index: 9000;
}

.portal-chat-shell.is-open {
  pointer-events: auto;
  transform: translateX(0);
  visibility: visible;
}

.portal-chat-header {
  align-items: center;
  background: linear-gradient(135deg, #092b48, #075da8);
  color: #fff;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: 76px;
  padding: 0.85rem 1rem;
}

.portal-chat-header div {
  display: grid;
  gap: 0.2rem;
}

.portal-chat-header small {
  opacity: 0.8;
}

.portal-chat-header button,
.portal-chat-conversation-actions button {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  color: inherit;
  cursor: pointer;
  min-height: 40px;
  padding: 0.45rem 0.65rem;
}

.portal-chat-icon,.portal-chat-icon svg,.portal-chat-report-button svg,.portal-chat-help-actions svg{display:inline-block;flex:0 0 auto;height:20px;width:20px}.portal-chat-icon svg,.portal-chat-report-button svg,.portal-chat-help-actions svg:not(.is-brand){fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.9}.portal-chat-conversation-actions .portal-chat-report-button{align-items:center;background:#fff1f2;border-color:#fecdd3;color:#be123c;display:inline-flex;gap:.38rem}.portal-chat-conversation-actions .portal-chat-report-button svg{height:18px;width:18px}.portal-chat-help-hub{align-content:center;display:grid;justify-items:center;margin:auto;max-width:620px;min-height:100%;padding:2rem;text-align:center}.portal-chat-help-symbol{align-items:center;background:linear-gradient(135deg,#e8f4ff,#dcfce7);border-radius:22px;color:#075da8;display:inline-flex;height:70px;justify-content:center;margin-bottom:1rem;width:70px}.portal-chat-help-symbol svg{fill:none;height:34px;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:34px}.portal-chat-help-hub>small{color:#0872cf;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.portal-chat-help-hub h3{color:#18364d;font-size:clamp(1.25rem,3vw,1.75rem);margin:.55rem 0}.portal-chat-help-hub>p{color:#687e90;line-height:1.55;margin:0 auto 1.4rem;max-width:520px}.portal-chat-help-actions{display:grid;gap:.7rem;grid-template-columns:repeat(3,minmax(0,1fr));width:100%}.portal-chat-help-actions a,.portal-chat-help-actions button{align-items:center;background:#fff;border:1px solid #d8e4f0;border-radius:16px;color:#075da8;cursor:pointer;display:flex;font:inherit;gap:.65rem;min-height:72px;padding:.8rem;text-align:left;text-decoration:none}.portal-chat-help-actions .is-whatsapp{color:#128c4d}.portal-chat-help-actions span{display:grid;gap:.16rem}.portal-chat-help-actions small{color:#687e90;font-size:.68rem}.portal-chat-support-entry{align-items:center;display:flex!important;gap:.6rem;width:100%}

.portal-chat-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 0;
}

.portal-chat-list {
  background: #f3f8fc;
  border-right: 1px solid #d8e4f0;
  overflow: auto;
  padding: 0.6rem;
}

.portal-chat-group {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.portal-chat-list .portal-chat-group-toggle {
  align-items: center;
  background: #e8f1f8;
  border: 1px solid #d3e1ec;
  display: grid;
  gap: 0.45rem;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin: 0;
}

.portal-chat-group-toggle > span:first-child {
  display: grid;
  gap: 0.14rem;
}

.portal-chat-group-toggle small {
  font-size: 0.62rem;
}

.portal-chat-group-badge {
  align-items: center;
  background: #e92662;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 0.64rem;
  font-weight: 900;
  justify-content: center;
  min-height: 21px;
  min-width: 21px;
  padding: 0 0.32rem;
}

.portal-chat-group-list {
  display: grid;
  gap: 0.2rem;
}

.portal-chat-list button {
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: #18364d;
  cursor: pointer;
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
  padding: 0.7rem;
  text-align: left;
  width: 100%;
}

.portal-chat-list button:hover,
.portal-chat-list button.is-active {
  background: #fff;
  box-shadow: 0 7px 18px rgba(5, 35, 58, 0.08);
}

.portal-chat-list button.is-unread strong::after {
  background: #ff356f;
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 8px;
  margin-left: 7px;
  width: 8px;
}

.portal-chat-list small {
  color: #6b7f8f;
}

.portal-chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.portal-chat-conversation-header {
  align-items: center;
  border-bottom: 1px solid #d8e4f0;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  min-height: 62px;
  padding: 0.7rem 0.85rem;
}

.portal-chat-conversation-actions {
  display: flex;
  gap: 0.4rem;
}

.portal-chat-conversation-actions button {
  background: #f5f8fc;
  border-color: #d8e4f0;
  color: #29465d;
  font-weight: 800;
}

.portal-chat-messages {
  background:
    radial-gradient(circle at top right, rgba(32, 208, 164, 0.08), transparent 30%),
    #fbfdff;
  overflow: auto;
  padding: 1rem;
}

.portal-chat-message {
  background: #fff;
  border: 1px solid #d8e4f0;
  border-radius: 6px 16px 16px 16px;
  box-shadow: 0 7px 18px rgba(5, 35, 58, 0.06);
  display: grid;
  gap: 0.35rem;
  margin: 0 0 0.7rem;
  max-width: 86%;
  padding: 0.7rem 0.8rem;
  width: fit-content;
}

.portal-chat-message.is-own {
  background: #e9f5ff;
  border-radius: 16px 6px 16px 16px;
  margin-left: auto;
}

.portal-chat-message.is-system {
  background: #f1f5f8;
  border-radius: 12px;
  color: #5d7384;
  margin-inline: auto;
  max-width: 96%;
  text-align: center;
}

.portal-chat-document.is-change-request {
  border-color: #f6b9cb;
  background: linear-gradient(155deg, #fff 0%, #fff5f8 100%);
  text-align: left;
}

.portal-chat-change-request {
  border-left: 4px solid #e92662;
  display: grid;
  gap: 0.35rem;
  padding: 0.2rem 0 0.2rem 0.75rem;
}

.portal-chat-change-request > span {
  color: #be174a;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-chat-change-request strong {
  color: #1f2d3d;
  font-size: 0.9rem;
}

.portal-chat-change-request p {
  color: #263d50;
  font-size: 0.92rem;
  line-height: 1.55;
}

.portal-chat-document-validity {
  align-items: center;
  background: #fff6e9;
  border-radius: 10px;
  color: #8a470f;
  display: flex;
  font-size: 0.7rem;
  justify-content: space-between;
  margin: 0;
  padding: 0.55rem 0.7rem;
}

.portal-chat-document-validity strong {
  font-size: 0.82rem;
}

.portal-chat-message p {
  margin: 0;
  white-space: pre-wrap;
}

.portal-chat-message time {
  color: #718596;
  font-size: 0.64rem;
}

.portal-chat-document {
  background: #fff;
  border: 1px solid #cbdbe8;
  border-radius: 14px;
  display: grid;
  gap: 0.6rem;
  margin-top: 0.35rem;
  min-width: min(340px, 70vw);
  padding: 0.8rem;
}

.portal-chat-document header,
.portal-chat-document-total,
.portal-chat-document-actions {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
}

.portal-chat-document header span {
  background: #edf5ff;
  border-radius: 999px;
  color: #075da8;
  font-size: 0.64rem;
  font-weight: 850;
  padding: 0.35rem 0.5rem;
}

.portal-chat-document-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.portal-chat-document-actions button,
.portal-chat-document-actions a,
.portal-chat-document-actions label {
  background: #edf5ff;
  border: 1px solid #cbdbe8;
  border-radius: 9px;
  color: #075da8;
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  min-height: 38px;
  padding: 0.48rem 0.62rem;
  text-decoration: none;
}

.portal-chat-document-actions .is-positive {
  background: #ddf8e9;
  border-color: #9fddb9;
  color: #08713c;
}

.portal-chat-attachment-card {
  align-items: center;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid #cbdbe8;
  border-radius: 12px;
  color: #18364d;
  display: flex;
  gap: 0.65rem;
  max-width: min(330px, 68vw);
  overflow: hidden;
  padding: 0.55rem;
  text-decoration: none;
}

.portal-chat-attachment-card img {
  border-radius: 8px;
  height: 76px;
  object-fit: cover;
  width: 92px;
}

.portal-chat-attachment-card > span:last-child {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.portal-chat-attachment-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-chat-attachment-card small {
  color: #718596;
}

.portal-chat-attachment-icon {
  align-items: center;
  background: #fee2e2;
  border-radius: 8px;
  color: #b91c1c;
  display: flex;
  font-size: 0.68rem;
  font-weight: 900;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.portal-chat-composer {
  align-items: end;
  border-top: 1px solid #d8e4f0;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 0.75rem;
}

.portal-chat-attach {
  align-items: center;
  background: #edf5ff;
  border: 1px solid #cbdbe8;
  border-radius: 11px;
  color: #075da8;
  cursor: pointer;
  display: flex;
  font-size: 1.15rem;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.portal-chat-upload-progress {
  color: #476074;
  grid-column: 1 / -1;
  min-height: 1em;
}

.portal-chat-composer textarea {
  border: 1px solid #cbdbe8;
  border-radius: 12px;
  color: #18364d;
  font: inherit;
  min-height: 46px;
  padding: 0.7rem;
  resize: vertical;
}

.portal-chat-composer button {
  background: #075da8;
  border: 0;
  border-radius: 11px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  min-height: 46px;
  padding: 0.65rem 0.85rem;
}

.portal-chat-empty,
.portal-chat-loading {
  color: #6b7f8f;
  padding: 1.5rem;
  text-align: center;
}

.portal-chat-dialog-backdrop {
  align-items: center;
  background: rgba(3, 20, 34, 0.66);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1rem;
  position: fixed;
  z-index: 9400;
}

.portal-chat-dialog {
  background: #fff;
  border-radius: 18px;
  color: #18364d;
  max-height: 88vh;
  max-width: 620px;
  overflow: auto;
  padding: 1rem;
  width: 100%;
}

.portal-chat-dialog form,
.portal-chat-dialog label {
  display: grid;
  gap: 0.55rem;
}

.portal-chat-dialog select,
.portal-chat-dialog textarea,
.portal-chat-dialog input[type="file"] {
  border: 1px solid #cbdbe8;
  border-radius: 11px;
  color: inherit;
  font: inherit;
  padding: 0.7rem;
}

.portal-chat-dialog label small {
  color: #6b7f8f;
  font-size: 0.76rem;
  line-height: 1.4;
}

.portal-chat-dialog-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.85rem;
}

.portal-chat-dialog-actions button,
.portal-chat-dialog-actions a {
  background: #edf5ff;
  border: 1px solid #cbdbe8;
  border-radius: 10px;
  color: #075da8;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  text-decoration: none;
}

.portal-chat-dialog-actions .is-primary {
  background: #075da8;
  color: #fff;
}

html[data-theme="dark"] .portal-chat-shell,
body.platform-dark-mode .portal-chat-shell,
body.admin-dark-mode .portal-chat-shell,
body.platform-dark-mode .portal-chat-shell,
body.platform-dark-mode .portal-chat-shell {
  background: #101e38;
  border-color: rgba(148, 163, 184, 0.24);
  color: #f8fafc;
}

html[data-theme="dark"] .portal-chat-list,
body.platform-dark-mode .portal-chat-list,
body.admin-dark-mode .portal-chat-list,
body.platform-dark-mode .portal-chat-list,
body.platform-dark-mode .portal-chat-list {
  background: #0b1730;
  border-color: rgba(148, 163, 184, 0.24);
}

html[data-theme="dark"] .portal-chat-list button,
body.platform-dark-mode .portal-chat-list button,
body.admin-dark-mode .portal-chat-list button,
body.platform-dark-mode .portal-chat-list button,
body.platform-dark-mode .portal-chat-list button {
  color: #f8fafc;
}

html[data-theme="dark"] .portal-chat-list button:hover,
body.platform-dark-mode .portal-chat-list button:hover,
html[data-theme="dark"] .portal-chat-list button.is-active,
body.platform-dark-mode .portal-chat-list button.is-active,
body.admin-dark-mode .portal-chat-list button:hover,
body.platform-dark-mode .portal-chat-list button:hover,
body.admin-dark-mode .portal-chat-list button.is-active,
body.platform-dark-mode .portal-chat-list button.is-active {
  background: #172945;
}

html[data-theme="dark"] .portal-chat-list .portal-chat-group-toggle,
body.platform-dark-mode .portal-chat-list .portal-chat-group-toggle,
body.admin-dark-mode .portal-chat-list .portal-chat-group-toggle,
body.platform-dark-mode .portal-chat-list .portal-chat-group-toggle,
body.platform-dark-mode .portal-chat-list .portal-chat-group-toggle {
  background: #132640;
  border-color: rgba(148, 163, 184, 0.24);
}

html[data-theme="dark"] .portal-chat-conversation-header,
body.platform-dark-mode .portal-chat-conversation-header,
html[data-theme="dark"] .portal-chat-composer,
body.platform-dark-mode .portal-chat-composer,
body.admin-dark-mode .portal-chat-conversation-header,
body.platform-dark-mode .portal-chat-conversation-header,
body.admin-dark-mode .portal-chat-composer,
body.platform-dark-mode .portal-chat-composer {
  border-color: rgba(148, 163, 184, 0.24);
}

html[data-theme="dark"] .portal-chat-messages,
body.platform-dark-mode .portal-chat-messages,
body.admin-dark-mode .portal-chat-messages,
body.platform-dark-mode .portal-chat-messages {
  background: #0c192e;
}

html[data-theme="dark"] .portal-chat-message,
body.platform-dark-mode .portal-chat-message,
body.admin-dark-mode .portal-chat-message,
body.platform-dark-mode .portal-chat-message {
  background: #172945;
  border-color: rgba(148, 163, 184, 0.24);
}

html[data-theme="dark"] .portal-chat-message.is-own,
body.platform-dark-mode .portal-chat-message.is-own,
body.admin-dark-mode .portal-chat-message.is-own,
body.platform-dark-mode .portal-chat-message.is-own {
  background: #123d60;
}

html[data-theme="dark"] .portal-chat-document,
body.platform-dark-mode .portal-chat-document,
body.admin-dark-mode .portal-chat-document,
body.platform-dark-mode .portal-chat-document,
html[data-theme="dark"] .portal-chat-dialog,
body.platform-dark-mode .portal-chat-dialog,
body.admin-dark-mode .portal-chat-dialog,
body.platform-dark-mode .portal-chat-dialog {
  background: #101e38;
  border-color: rgba(148, 163, 184, 0.24);
  color: #f8fafc;
}

html[data-theme="dark"] .portal-chat-composer textarea,
body.platform-dark-mode .portal-chat-composer textarea,
html[data-theme="dark"] .portal-chat-dialog select,
body.platform-dark-mode .portal-chat-dialog select,
html[data-theme="dark"] .portal-chat-dialog textarea,
body.platform-dark-mode .portal-chat-dialog textarea,
html[data-theme="dark"] .portal-chat-dialog input[type="file"],
body.platform-dark-mode .portal-chat-dialog input[type="file"],
body.admin-dark-mode .portal-chat-composer textarea,
body.platform-dark-mode .portal-chat-composer textarea,
body.admin-dark-mode .portal-chat-dialog select,
body.platform-dark-mode .portal-chat-dialog select,
body.admin-dark-mode .portal-chat-dialog textarea,
body.platform-dark-mode .portal-chat-dialog textarea,
body.admin-dark-mode .portal-chat-dialog input[type="file"],
body.platform-dark-mode .portal-chat-dialog input[type="file"] {
  background: #0b1730;
  border-color: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
}

html[data-theme="dark"] .portal-chat-dialog label small,
body.platform-dark-mode .portal-chat-dialog label small,
body.admin-dark-mode .portal-chat-dialog label small,
body.platform-dark-mode .portal-chat-dialog label small {
  color: #b8c8dc;
}

html[data-theme="dark"] .portal-chat-conversation-actions button,
body.platform-dark-mode .portal-chat-conversation-actions button,
body.admin-dark-mode .portal-chat-conversation-actions button,
body.platform-dark-mode .portal-chat-conversation-actions button,
body.platform-dark-mode .portal-chat-conversation-actions button {
  background: #1b3150;
  border-color: rgba(148, 163, 184, 0.34);
  color: #eef6ff;
}

@media (max-width: 680px) {
  .portal-chat-launcher {
    bottom: 14px;
    right: 14px;
  }

  .portal-chat-shell {
    width: 100%;
  }

  .portal-chat-layout {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .portal-chat-list button {
    padding: 0.55rem;
  }

  .portal-chat-list button small {
    display: none;
  }

  .portal-chat-document {
    min-width: 0;
    width: 100%;
  }

  .portal-chat-message {
    max-width: 96%;
  }
}

/* Tema escuro: todos os seletores apontam para o conteúdo do chat, nunca para o body isolado. */
html[data-theme="dark"] .portal-chat-shell,body.admin-dark-mode .portal-chat-shell,body.platform-dark-mode .portal-chat-shell{background:#101e38;border-color:#2b4364;color:#f8fafc}
html[data-theme="dark"] .portal-chat-list,body.admin-dark-mode .portal-chat-list,body.platform-dark-mode .portal-chat-list{background:#0b1730;border-color:#2b4364}
html[data-theme="dark"] .portal-chat-list button,body.admin-dark-mode .portal-chat-list button,body.platform-dark-mode .portal-chat-list button{color:#f8fafc}
html[data-theme="dark"] .portal-chat-list button:hover,html[data-theme="dark"] .portal-chat-list button.is-active,body.admin-dark-mode .portal-chat-list button:hover,body.admin-dark-mode .portal-chat-list button.is-active,body.platform-dark-mode .portal-chat-list button:hover,body.platform-dark-mode .portal-chat-list button.is-active{background:#172945}
html[data-theme="dark"] .portal-chat-group-toggle,body.admin-dark-mode .portal-chat-group-toggle,body.platform-dark-mode .portal-chat-group-toggle{background:#132640;border-color:#2b4364}
html[data-theme="dark"] .portal-chat-conversation-header,html[data-theme="dark"] .portal-chat-composer,body.admin-dark-mode .portal-chat-conversation-header,body.admin-dark-mode .portal-chat-composer,body.platform-dark-mode .portal-chat-conversation-header,body.platform-dark-mode .portal-chat-composer{background:#101e38;border-color:#2b4364;color:#f8fafc}
html[data-theme="dark"] .portal-chat-messages,body.admin-dark-mode .portal-chat-messages,body.platform-dark-mode .portal-chat-messages{background:#0c192e}
html[data-theme="dark"] .portal-chat-message,body.admin-dark-mode .portal-chat-message,body.platform-dark-mode .portal-chat-message{background:#172945;border-color:#2b4364;color:#f8fafc}
html[data-theme="dark"] .portal-chat-message.is-own,body.admin-dark-mode .portal-chat-message.is-own,body.platform-dark-mode .portal-chat-message.is-own{background:#123d60}
html[data-theme="dark"] .portal-chat-document,html[data-theme="dark"] .portal-chat-dialog,body.admin-dark-mode .portal-chat-document,body.admin-dark-mode .portal-chat-dialog,body.platform-dark-mode .portal-chat-document,body.platform-dark-mode .portal-chat-dialog{background:#101e38;border-color:#2b4364;color:#f8fafc}
html[data-theme="dark"] .portal-chat-composer textarea,html[data-theme="dark"] .portal-chat-dialog select,html[data-theme="dark"] .portal-chat-dialog textarea,body.admin-dark-mode .portal-chat-composer textarea,body.admin-dark-mode .portal-chat-dialog select,body.admin-dark-mode .portal-chat-dialog textarea,body.platform-dark-mode .portal-chat-composer textarea,body.platform-dark-mode .portal-chat-dialog select,body.platform-dark-mode .portal-chat-dialog textarea{background:#0b1730;border-color:#2b4364;color:#f8fafc}
html[data-theme="dark"] .portal-chat-help-hub h3,body.admin-dark-mode .portal-chat-help-hub h3,body.platform-dark-mode .portal-chat-help-hub h3{color:#f8fafc}
html[data-theme="dark"] .portal-chat-help-hub>p,html[data-theme="dark"] .portal-chat-help-actions small,body.admin-dark-mode .portal-chat-help-hub>p,body.admin-dark-mode .portal-chat-help-actions small,body.platform-dark-mode .portal-chat-help-hub>p,body.platform-dark-mode .portal-chat-help-actions small{color:#aebdd1}
html[data-theme="dark"] .portal-chat-help-actions a,html[data-theme="dark"] .portal-chat-help-actions button,body.admin-dark-mode .portal-chat-help-actions a,body.admin-dark-mode .portal-chat-help-actions button,body.platform-dark-mode .portal-chat-help-actions a,body.platform-dark-mode .portal-chat-help-actions button{background:#142945;border-color:#2b4364}
@media(max-width:680px){.portal-chat-help-actions{grid-template-columns:1fr}}

/* Pack de estabilização: identidade, documentos e ações do chat. */
.portal-chat-list button {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  column-gap: 0.65rem;
}

.portal-chat-list-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.portal-chat-list-copy strong,
.portal-chat-list-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-chat-identity-avatar {
  align-items: center;
  background: linear-gradient(135deg, #0052cc, #20d0a4);
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(11, 23, 48, 0.16);
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.74rem;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  overflow: hidden;
  width: 42px;
}

.portal-chat-identity-avatar img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.portal-chat-identity-avatar.is-header {
  border-radius: 15px;
  height: 48px;
  width: 48px;
}

.portal-chat-conversation-header {
  min-height: 68px;
  padding: 0.62rem 0.78rem;
}

.portal-chat-conversation-identity {
  align-items: center;
  display: flex;
  gap: 0.7rem;
  min-width: 0;
}

.portal-chat-conversation-copy {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
}

.portal-chat-conversation-copy strong,
.portal-chat-conversation-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-chat-conversation-copy small {
  color: #61758b;
  font-size: 0.68rem;
  max-width: 330px;
}

.portal-chat-conversation-actions {
  align-items: center;
}

.portal-chat-company-tag {
  background: rgba(0, 82, 204, 0.09);
  border: 1px solid rgba(0, 82, 204, 0.18);
  border-radius: 999px;
  color: #075da8;
  font-size: 0.63rem;
  font-weight: 850;
  max-width: 150px;
  overflow: hidden;
  padding: 0.38rem 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-chat-document {
  gap: 0.7rem;
  overflow: hidden;
  padding: 0.78rem;
}

.portal-chat-document .portal-chat-document-meta {
  align-items: center;
  border: 0;
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
}

.portal-chat-document-meta small {
  color: #6b7f8f;
  font-size: 0.61rem;
  font-weight: 850;
  letter-spacing: 0.035em;
}

.portal-chat-document-meta time {
  color: #7a8da0;
  font-size: 0.59rem;
}

.portal-chat-document-heading {
  align-items: center;
  display: flex;
  gap: 0.65rem;
  justify-content: space-between;
}

.portal-chat-document-heading > strong {
  color: #152f48;
  font-size: 0.88rem;
}

.portal-chat-document-heading > span {
  background: #edf5ff;
  border-radius: 999px;
  color: #075da8;
  flex: 0 0 auto;
  font-size: 0.6rem;
  font-weight: 850;
  padding: 0.32rem 0.48rem;
}

.portal-chat-document-validity {
  color: #687d91;
  font-size: 0.66rem;
  margin: -0.15rem 0 0 !important;
}

.portal-chat-document-footer {
  align-items: end;
  border-top: 1px solid #e1eaf3;
  display: flex;
  gap: 0.65rem;
  justify-content: space-between;
  padding-top: 0.7rem;
}

.portal-chat-document-total {
  display: grid;
  flex: 0 0 auto;
  gap: 0.06rem;
  text-align: right;
}

.portal-chat-document-total span {
  color: #708499;
  font-size: 0.59rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.portal-chat-document-total strong {
  color: #102b45;
  font-size: 0.92rem;
  white-space: nowrap;
}

.portal-chat-document-actions {
  display: flex;
  flex: 1 1 auto;
  gap: 0.4rem;
  justify-content: flex-start;
}

.portal-chat-document-actions button,
.portal-chat-document-actions a,
.portal-chat-document-actions label {
  border-radius: 10px;
  min-height: 34px;
  padding: 0.4rem 0.55rem;
}

.portal-chat-document-actions .is-document {
  background: #eaf3ff;
  border-color: #b8d2f1;
  color: #075da8;
}

.portal-chat-document-actions .is-warning {
  background: #fff4e7;
  border-color: #ffd1a5;
  color: #a74d0c;
}

.portal-chat-document-actions .is-danger {
  background: #fff0f3;
  border-color: #f6bec9;
  color: #b51f40;
}

.portal-chat-document.is-change-request {
  border-color: rgba(255, 138, 42, 0.48);
  background: linear-gradient(155deg, #fff 0%, #fffaf4 100%);
}

.portal-chat-change-request {
  border: 1px solid rgba(255, 138, 42, 0.34);
  border-radius: 13px;
  background: linear-gradient(135deg, #fff7ec, #fff2df);
  display: grid;
  gap: 0.25rem;
  padding: 0.72rem;
}

.portal-chat-change-request > span {
  color: #b85a13;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-chat-change-request > strong {
  color: #713309;
  font-size: 0.78rem;
}

.portal-chat-change-request p {
  color: #8b4a1d;
  font-size: 0.72rem;
  margin: 0;
}

.portal-chat-dialog {
  max-width: 560px;
  padding: 1.2rem;
  position: relative;
}

.portal-chat-dialog.is-compact {
  max-width: 500px;
}

.portal-chat-dialog-content {
  padding: 0.15rem 2.35rem 0.15rem 0.1rem;
}

.portal-chat-dialog-close {
  align-items: center;
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.2);
  border-radius: 10px;
  color: #d52a4f;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  height: 34px;
  justify-content: center;
  position: absolute;
  right: 0.8rem;
  top: 0.8rem;
  width: 34px;
}

.portal-chat-dialog-close:hover,
.portal-chat-dialog-close:focus-visible {
  background: rgba(225, 29, 72, 0.14);
  border-color: rgba(225, 29, 72, 0.36);
}

.portal-chat-dialog-actions {
  justify-content: flex-end;
}

.portal-chat-attach {
  background: #edf5ff !important;
  border: 1px solid #cbdbe8 !important;
  color: #075da8 !important;
  flex: 0 0 46px;
  font-size: 1.2rem !important;
  min-height: 46px;
  overflow: hidden;
  padding: 0 !important;
}

.portal-chat-attach .sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

html[data-theme="dark"] .portal-chat-conversation-copy small,
body.platform-dark-mode .portal-chat-conversation-copy small,
body.admin-dark-mode .portal-chat-conversation-copy small,
body.platform-dark-mode .portal-chat-conversation-copy small,
body.platform-dark-mode .portal-chat-conversation-copy small {
  color: #a9bbd0;
}

html[data-theme="dark"] .portal-chat-company-tag,
body.platform-dark-mode .portal-chat-company-tag,
body.admin-dark-mode .portal-chat-company-tag,
body.platform-dark-mode .portal-chat-company-tag,
body.platform-dark-mode .portal-chat-company-tag {
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(96, 165, 250, 0.3);
  color: #bfdbfe;
}

html[data-theme="dark"] .portal-chat-document-heading > strong,
body.platform-dark-mode .portal-chat-document-heading > strong,
html[data-theme="dark"] .portal-chat-document-total strong,
body.platform-dark-mode .portal-chat-document-total strong,
body.admin-dark-mode .portal-chat-document-heading > strong,
body.platform-dark-mode .portal-chat-document-heading > strong,
body.admin-dark-mode .portal-chat-document-total strong,
body.platform-dark-mode .portal-chat-document-total strong {
  color: #f8fafc;
}

html[data-theme="dark"] .portal-chat-document-footer,
body.platform-dark-mode .portal-chat-document-footer,
body.admin-dark-mode .portal-chat-document-footer,
body.platform-dark-mode .portal-chat-document-footer {
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .portal-chat-document.is-change-request,
body.platform-dark-mode .portal-chat-document.is-change-request,
body.admin-dark-mode .portal-chat-document.is-change-request,
body.platform-dark-mode .portal-chat-document.is-change-request {
  background: linear-gradient(155deg, #101e38 0%, #271b18 100%);
  border-color: rgba(251, 146, 60, 0.42);
}

html[data-theme="dark"] .portal-chat-change-request,
body.platform-dark-mode .portal-chat-change-request,
body.admin-dark-mode .portal-chat-change-request,
body.platform-dark-mode .portal-chat-change-request {
  background: rgba(154, 74, 18, 0.2);
  border-color: rgba(251, 146, 60, 0.32);
}

html[data-theme="dark"] .portal-chat-change-request > strong,
body.platform-dark-mode .portal-chat-change-request > strong,
body.admin-dark-mode .portal-chat-change-request > strong,
body.platform-dark-mode .portal-chat-change-request > strong {
  color: #fed7aa;
}

html[data-theme="dark"] .portal-chat-change-request p,
body.platform-dark-mode .portal-chat-change-request p,
body.admin-dark-mode .portal-chat-change-request p,
body.platform-dark-mode .portal-chat-change-request p {
  color: #fdba74;
}

@media (max-width: 680px) {
  .portal-chat-conversation-copy small,
  .portal-chat-company-tag {
    display: none;
  }

  .portal-chat-document-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .portal-chat-document-total {
    text-align: left;
  }

  .portal-chat-document-actions button {
    flex: 1 1 120px;
  }

  .portal-chat-dialog-content {
    padding-right: 2rem;
  }
}
/* Central única de conversas: os grupos ficam recolhidos por padrão. */
.portal-chat-list .portal-chat-group-toggle {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

/* Keep long contact addresses inside their support card. */
.portal-chat-help-actions a,
.portal-chat-help-actions button { min-width: 0; overflow: hidden; }
.portal-chat-help-actions span { min-width: 0; }
.portal-chat-help-actions small { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
