/* Chat workspaces must stay inside the main content panel; the application shell's
   generic fixed `aside` rule is intentionally neutralized for topic navigation. */
.messages-shell{padding:0;overflow:hidden}
.messages-shell .message-toolbar{margin:0;padding:20px 22px;border-bottom:1px solid var(--line);background:#fff}
.messages-shell .message-workspace{border:0;border-radius:0;box-shadow:none}
.message-workspace{position:relative;display:grid;grid-template-columns:minmax(250px,320px) minmax(0,1fr);align-items:stretch;width:100%;min-width:0;max-width:100%;max-height:80dvh;margin:0;padding:0;overflow:hidden;background:#fff}
.message-workspace>.message-topics{position:static!important;z-index:auto!important;inset:auto!important;width:auto!important;height:auto;min-width:0;max-height:none;margin:0!important;padding:18px;align-self:stretch;justify-content:flex-start;overflow:hidden;border:0;border-right:1px solid var(--line);background:#f7f8fc}
.message-topics .new-topic-form{flex:0 0 auto}
.message-topics h2{flex:0 0 auto;margin:0}
.message-topic-list{flex:1 1 auto;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.message-topic{flex:0 0 auto}
.message-workspace>.conversation-main{display:flex;min-width:0;min-height:560px;max-height:80dvh;overflow:hidden;flex-direction:column;background:#fff}
.conversation-main>.chat-thread{flex:1 1 auto;min-height:300px;max-height:none;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.conversation-main>.chat-compose-panel,.rental-chat>.chat-compose-panel{flex:0 0 auto;width:100%;margin:0;padding:16px 18px;border-top:1px solid var(--line);background:#fff}
.chat-compose-form{display:grid!important;width:100%;min-width:0;grid-template-columns:minmax(0,1fr) auto!important;gap:12px;align-items:end}
.chat-compose-form>.chat-message-input{grid-column:1/-1;width:100%;min-width:0}
.chat-compose-form>.chat-message-input textarea{display:block;width:100%;min-height:108px;resize:vertical}
.chat-compose-form>.chat-attachment{grid-column:1;min-width:0;width:100%}
.chat-compose-form>.chat-attachment input{width:100%}
.chat-compose-form>button{grid-column:2;min-height:46px;white-space:nowrap}
.property-chat-compose>.chat-tenancy-input{grid-column:1/-1;width:100%}
.rental-chat>.chat-thread{max-height:80dvh;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}

/* A short collection keeps its natural height. Once a data-heavy region would
   exceed 80% of the viewport, it scrolls internally instead of stretching the page. */
.table-wrap,.data-scroll-region{max-height:80dvh;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.table-wrap>table thead{position:sticky;z-index:1;top:0;background:#fff}

@media(max-width:860px){
  .message-workspace{grid-template-columns:1fr;max-height:none}
  .message-workspace>.message-topics{max-height:36dvh;border-right:0;border-bottom:1px solid var(--line)}
  .message-workspace>.conversation-main{min-height:520px;max-height:80dvh}
  .chat-compose-form{grid-template-columns:1fr!important}
  .chat-compose-form>.chat-message-input,.chat-compose-form>.chat-attachment,.chat-compose-form>button,.property-chat-compose>.chat-tenancy-input{grid-column:1}
  .chat-compose-form>button{width:100%}
}
