.home-hero-row:has(#chat-panel:not([hidden])) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--chat-width, 270px);
  gap: 16px;
  margin-right: var(--chat-right-offset, 0px);
}
#chat-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(100px,1fr) auto;
  height: 380px;
  padding: 12px;
  gap: 6px;
  background: white;
  border: 1px solid #dce6f1;
  border-radius: 16px;
  box-shadow: 0 8px 25px #17395b09;
  font-size: 13px;
}
#chat-panel[hidden], #chat-panel [hidden] { display: none !important; }
#chat-panel header, .chat-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
#chat-title { font-size: 16px; margin: 0; }
#chat-unread:empty, #chat-status:empty { display: none; }
#chat-panel header { grid-row: 1; }
.chat-contact-label { grid-row: 2; display: grid; gap: 4px; }
#chat-status { grid-row: 3; margin: 0; color: #8f2630; overflow-wrap: anywhere; }
#chat-older { grid-row: 4; justify-self: center; }
#chat-messages { grid-row: 5; overflow: auto; background: #f3f7fb; border-radius: 8px; padding: 8px; }
#chat-form { grid-row: 6; display: grid; gap: 5px; }
#chat-contact, #chat-form textarea { padding: 6px 8px; }
#chat-form textarea { resize: vertical; min-height: 42px; max-height: 76px; }
.chat-actions label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#chat-file { flex: 1; min-width: 0; padding: 3px; font-size: 11px; }
.chat-actions button { flex: none; }
#chat-unread { color: #fff; background: #1c64b7; border-radius: 12px; padding: 2px 7px; white-space: nowrap; }
.chat-message { width: fit-content; max-width: 92%; background: #fff; border: 1px solid #e2eaf4; border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; overflow-wrap: anywhere; }
.chat-message.chat-mine { margin-left: auto; background: #e0edff; border-color: #d0e3fc; }
.chat-message small { display: block; margin-bottom: 3px; color: #4e647e; }
.chat-message p { margin: 0; white-space: pre-wrap; }
@media (max-width: 760px) {
  .home-hero-row:has(#chat-panel:not([hidden])) { grid-template-columns: minmax(0,1fr); margin-right: 0; }
}
