.discussion-chat-page { margin: 0; }
.discussion-chat-page > .skip-link, .discussion-chat-page > .site-header, .discussion-chat-page > footer { display: none; }
.discussion-chat-page .site-main { padding: 0; }
.chat-shell { display: flex; flex-direction: column; height: var(--chat-visible-height, 100dvh); background: #f5f7f9; color: #202c38; }
.chat-header { flex: none; padding: .6rem max(1rem, calc((100% - 70rem) / 2)); background: #fff; border-bottom: 1px solid #dce3e9; }
.chat-header nav { display: flex; gap: 1.25rem; font-size: .85rem; }
.chat-header h1 { font-size: clamp(1.1rem, 2vw, 1.45rem); margin: .25rem 0 0; overflow-wrap: anywhere; line-height: 1.2; }
.chat-history { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding: 1rem max(1rem, calc((100% - 64rem) / 2)); overscroll-behavior: contain; }
.chat-topic, .chat-message { background: white; border: 1px solid #dce3e9; border-radius: .7rem; padding: .8rem 1rem; margin: 0 0 .75rem; overflow-wrap: anywhere; }
.chat-topic { color: #455464; font-size: .94rem; }
.chat-topic p { margin: .5rem 0; }
.chat-message { max-width: 52rem; }
.chat-message header { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; }
.chat-message time { color: #61717d; font-size: .78rem; }
.chat-message__text { margin: .45rem 0; white-space: normal; }
.chat-message__parent { display: block; margin-top: .4rem; padding-left: .6rem; border-left: 3px solid #a9c6df; font-size: .85rem; }
.chat-message footer { display: flex; align-items: center; gap: 1rem; font-size: .8rem; }
.chat-message footer button, [data-cancel-reply] { background: none; border: 0; color: #145b96; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.chat-reply-button { display: none; }
.chat-enhanced .chat-reply-button { display: inline; }
.chat-compose-wrap { flex: none; background: #fff; border-top: 1px solid #dce3e9; padding: .5rem max(1rem, calc((100% - 64rem) / 2)) max(.5rem, env(safe-area-inset-bottom)); }
.chat-compose textarea { display: block; width: 100%; resize: vertical; min-height: 3rem; max-height: 25vh; padding: .6rem; border: 1px solid #b6c6d2; border-radius: .5rem; font: inherit; }
.chat-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .4rem; }
.chat-actions button { margin-left: auto; }
.chat-actions small { color: #61717d; }
.chat-attachment { font-size: .85rem; }
.chat-attachment input { max-width: 15rem; font-size: .8rem; }
.chat-status { margin: 0; color: #35546b; font-size: .85rem; }
.chat-status:not(:empty) { margin-bottom: .35rem; }
.chat-guest { font-size: .95rem; }
.chat-load { display: inline-block; margin-bottom: .75rem; }
.chat-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 600px) { .chat-header { padding: .45rem .75rem; } .chat-history { padding: .75rem; } .chat-compose-wrap { padding-inline: .75rem; } .chat-actions small { display: none; } .chat-actions button { font-size: .85rem; } .chat-attachment input { max-width: 11rem; } }
/* Compact chat layout */
.chat-header h1 { max-width: none; width: auto; }
[data-messages] { display: flex; flex-direction: column; align-items: flex-start; }
.chat-message { width: fit-content; max-width: min(80%, 42rem); min-width: 10rem; margin-bottom: .5rem; }
.chat-message--own { align-self: flex-end; background: #e9f4ff; border-color: #cee4f5; }
.chat-message footer { justify-content: flex-end; }
.chat-message__menu { position: relative; }
.chat-message__menu summary { cursor: pointer; list-style: none; font-size: 1.1rem; line-height: 1; padding: .2rem .45rem; }
.chat-message__menu summary::-webkit-details-marker { display: none; }
.chat-message__menu[open] { background: white; border: 1px solid #cbd8e2; border-radius: .4rem; padding: .2rem .4rem; }
.chat-message__menu a { display: inline-block; padding: .3rem; }
.chat-compose-wrap { padding-top: .35rem; padding-bottom: max(.35rem, env(safe-area-inset-bottom)); }
.chat-compose textarea { min-height: 2.7rem; height: 2.7rem; max-height: 20vh; padding: .45rem .6rem; }
.chat-actions { flex-wrap: nowrap; margin-top: .2rem; }
.chat-actions button { margin-left: auto; padding: .4rem .8rem; min-height: 2.2rem; }
.chat-actions small { display: inline; font-size: .73rem; white-space: nowrap; }
.chat-attachment { flex: none; display: inline-grid; place-items: center; position: relative; cursor: pointer; width: 2rem; height: 2rem; font-size: 1.2rem; border-radius: .4rem; }
.chat-attachment:focus-within { outline: 2px solid #145b96; }
.chat-enhanced .chat-attachment input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.chat-file-name { min-width: 0; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }
.chat-compose .checkbox-field { display: flex; align-items: center; gap: .35rem; margin: .25rem 0 0; font-size: .78rem; line-height: 1.2; }
.chat-compose .checkbox-field input { flex: none; width: 1rem; height: 1rem; margin: 0; }
@media (max-width: 600px) {
  .chat-message { max-width: 90%; }
  .chat-header h1 { font-size: 1rem; }
  .chat-actions small { display: inline; font-size: .68rem; }
  .chat-file-name { max-width: 5rem; }
}

.chat-shell:not(.chat-enhanced) .chat-attachment { width: auto; display: inline-block; }
.chat-shell:not(.chat-enhanced) .chat-attachment input { max-width: 12rem; }
.chat-newest { margin: 0 0 .75rem .75rem; cursor: pointer; color: #145b96; background: transparent; border: 0; text-decoration: underline; }
