.chat-section { overflow: hidden; }
.chat-section .dashboard-section-head { align-items: center; flex-wrap: wrap; }
.chat-section .dashboard-section-head > div:first-child { min-width: 0; }
.chat-section .dashboard-section-head h2 { word-break: keep-all; }
.chat-connection { color: #7a808c; font-size: 11px; white-space: nowrap; }
.chat-connection.is-live { color: #24704a; }
.chat-connection.is-error { color: #a32838; }
.chat-delivery-status { color: #7a808c; font-size: 11px; line-height: 1.4; white-space: nowrap; word-break: keep-all; }
.chat-delivery-status[data-sync-status="synced"] { color: #24704a; }
.chat-delivery-status[data-sync-status="failed"] { color: #a32838; }
.chat-delivery-retry { flex: 0 0 auto; min-height: 26px; padding: 0 8px; border: 1px solid #d9ddec; border-radius: 7px; color: var(--member-blue); background: #fff; font-size: 10px; font-weight: 800; line-height: 1; white-space: nowrap; word-break: keep-all; }
.chat-delivery-retry:hover { border-color: var(--member-blue); }
.chat-delivery-retry:disabled { opacity: .55; cursor: not-allowed; }
.chat-intro { margin: -7px 0 22px; color: var(--member-muted); font-size: 13px; line-height: 1.7; }
.chat-layout { display: grid; grid-template-columns: minmax(170px, .4fr) minmax(0, 1fr); min-height: 390px; border: 1px solid var(--member-line); border-radius: 12px; overflow: hidden; }
.chat-thread-panel { padding: 15px; border-right: 1px solid var(--member-line); background: #fbfcff; }
.chat-thread-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--member-line); font-size: 12px; }
.chat-thread-head button { min-height: 30px; padding: 0 9px; border: 1px solid #d9ddec; border-radius: 7px; color: var(--member-blue); background: #fff; font-size: 11px; font-weight: 800; }
.chat-thread-head button:hover { border-color: var(--member-blue); }
.chat-thread-list { display: grid; gap: 6px; padding-top: 10px; }
.chat-thread-item { display: block; width: 100%; padding: 10px; border: 1px solid transparent; border-radius: 8px; color: var(--member-ink); background: transparent; cursor: pointer; text-align: left; }
.chat-thread-item:hover, .chat-thread-item.is-active { border-color: #dce1ff; background: var(--member-blue-soft); }
.chat-thread-item strong, .chat-thread-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread-item strong { font-size: 12px; }
.chat-thread-item small { margin-top: 5px; color: var(--member-muted); font-size: 10px; }
.chat-thread-empty { padding: 14px 2px; color: var(--member-muted); font-size: 11px; line-height: 1.6; }
.chat-conversation { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; background: #fff; }
.chat-messages { display: flex; flex-direction: column; gap: 10px; min-height: 260px; max-height: 420px; padding: 20px; overflow: auto; }
.chat-empty { margin: auto; color: var(--member-muted); font-size: 12px; line-height: 1.6; text-align: center; }
.chat-message { max-width: min(78%, 460px); padding: 11px 13px; border-radius: 11px; background: #f3f5fb; }
.chat-message.is-visitor { align-self: flex-end; color: #fff; background: var(--member-blue); }
.chat-message.is-admin { align-self: flex-start; }
.chat-message-author { font-size: 10px; font-weight: 800; opacity: .72; }
.chat-message-body { margin: 5px 0 0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message-time { display: block; margin-top: 6px; font-size: 10px; opacity: .65; }
.chat-message-attachments { margin: 8px 0 0; font-size: 10px; opacity: .75; }
.chat-form { padding: 13px 15px 15px; border-top: 1px solid var(--member-line); }
.chat-form textarea { display: block; width: 100%; min-height: 76px; resize: vertical; padding: 11px 12px; border: 1px solid #d9dce5; border-radius: 9px; color: var(--member-ink); background: #fff; font-size: 13px; line-height: 1.55; }
.chat-form textarea:focus { outline: 0; border-color: var(--member-blue); box-shadow: 0 0 0 3px #dfe4ff; }
.chat-form-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-top: 10px; }
.chat-form-bottom small { flex: 1 1 180px; min-width: 0; color: var(--member-muted); font-size: 10px; line-height: 1.5; }
.chat-form-bottom button { flex: 0 0 auto; min-height: 42px; padding: 0 14px; border-radius: 8px; color: #fff; background: var(--member-blue); font-size: 12px; font-weight: 800; white-space: nowrap; word-break: keep-all; }
.chat-form-bottom button:hover { background: var(--member-blue-dark); }
.chat-form-bottom button:disabled { opacity: .55; cursor: not-allowed; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-thread-panel { border-right: 0; border-bottom: 1px solid var(--member-line); }
  .chat-thread-list { display: flex; overflow-x: auto; }
  .chat-thread-item { min-width: 150px; }
  .chat-message { max-width: 88%; }
}
@media (max-width: 560px) {
  .chat-section .dashboard-section-head { column-gap: 9px; row-gap: 8px; }
  .chat-section .dashboard-section-head > div:first-child { flex: 1 1 100%; width: 100%; }
  .chat-section .dashboard-section-head h2 { white-space: nowrap; }
  .chat-form-bottom small { flex-basis: 150px; }
}
