.workspace-chat { height:100dvh; display:flex; flex-direction:column; overflow:hidden; }
.workspace-chat .topbar { flex-shrink:0; }
.workspace-chat footer { display:none; }
.workspace-chat .app-layout { flex:1; min-height:0; overflow:hidden; }
.workspace-chat .sidebar { overflow-y:auto; }
main.messaging { overflow:hidden; max-width: none; padding: 0; height:100%; min-height:0; display: flex; flex-direction: column; }
.messaging > h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.connection-state { font-size:11px; color:var(--muted); margin:0; padding:7px 20px; background:var(--secondary); border-bottom: 1px solid var(--border); }
.messaging-layout { flex: 1; min-height: 0; display: grid; grid-template-columns:clamp(240px,25vw,280px) minmax(0,1fr); }
.conversation-list { min-width:0; min-height:0; padding:20px 16px; border-right: 1px solid var(--border); background: var(--secondary); overflow-y: auto; }
.conversation-list > label { margin-top: 0; }
.new-conversation { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 14px 0; margin: 16px 0; font-size: 14px; }
.conversation-filter label { font-size: 12px; margin-top: 12px; }
.conversation-count { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:0.7px; margin: 18px 0 8px; }
.conversation-links { padding:0; margin:0 -8px; list-style: none; }
.conversation-link { display: flex; gap: 10px; padding:12px 10px; margin:3px 0; border-radius:7px; border-left:3px solid transparent; align-items: center; text-decoration: none; }
.conversation-link:hover { background:var(--hover); }
.conversation-link[aria-current] { background:var(--selected); border-left-color:var(--muted); }
.conversation-name { display:block; text-decoration:none; overflow-wrap: anywhere; font-size: 14px; }
.conversation-link[aria-current] .conversation-name { font-weight: bold; }
.conversation-description { min-width: 0; }
.conversation-meta { color:var(--muted); }
.conversation-meta,.unread-count { display: block; font-size: 12px; margin-top: 3px; }
.unread-count { font-weight: bold; }
.conversation-empty { padding: 16px; }
.manage-groups-link { display: block; margin-top: 24px; font-size: 13px; }
.conversation-placeholder { padding:48px 36px; align-self:center; justify-self:center; max-width:480px; text-align:center; color:var(--muted); }
.conversation-placeholder h2 { color:var(--text); font-size:24px; }
.empty-symbol { display:grid; place-items:center; width:76px; height:76px; border:1px solid var(--border); border-radius:22px; margin:0 auto 24px; background:var(--secondary); }
.empty-symbol .icon { width:34px; height:34px; }
.conversation-placeholder button { margin-top:18px; }
.conversation-placeholder h2 { margin-top: 0; }
.conversation-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.thread-header { flex-shrink:0; min-width:0; min-height: 76px; border-bottom: 1px solid var(--border); padding: 14px 20px; background:var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.thread-identity > div { min-width:0; }
.thread-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.thread-header h2 { margin: 0 0 4px; font-size: 18px; }
.thread-info { margin: 0; font-size:12px; color:var(--muted); }
.members-toggle { flex-shrink: 0; font-size: 13px; padding: 7px 10px; }
.thread-body { display: grid; grid-template-columns: minmax(0,1fr); flex: 1; min-height: 0; }
.thread-body.members-open { grid-template-columns: minmax(0,1fr) 210px; }
.thread-stream { overflow-y:auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; padding:12px 24px 20px; }
.member-panel { background: var(--secondary); border-left: 1px solid var(--border); min-height: 0; overflow-y: auto; padding: 18px 14px; }
.member-panel h3 { font-size: 13px; margin: 0 0 16px; }
.chat-person { padding: 10px 0; overflow-wrap: anywhere; }
.chat-person .person-identity { align-items: flex-start; }
.chat-person .presence { font-size: 12px; display: block; margin: 6px 0 0 50px; white-space: normal; }
.chat-person p { font-size: 12px; margin: 8px 0; }
.thread-toolbar { flex-shrink:0; display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; padding: 0 0 10px; }
.thread-toolbar button { font-size: 12px; padding: 5px 8px; min-height: 30px; }
.thread-stream > div:last-child { flex-shrink:0; }
.chat-history { flex:1; min-height:96px; list-style: none; padding: 0; margin: 0 0 14px; overflow-y: auto; }
.chat-history .message-day { display: flex; align-items: center; gap: 14px; font-size:11px; color:var(--muted); margin:24px 0 18px; }
.message-day::before,.message-day::after { content: ''; border-top: 1px solid var(--border); flex: 1; }
.message-row { display: flex; gap: 12px; padding: 10px 4px; }
.message-row:hover { background: var(--secondary); }
.message-content { min-width: 0; flex: 1; }
.message-meta { display: flex; gap: 6px 10px; align-items: baseline; flex-wrap: wrap; }
.message-meta strong { font-size: 14px; overflow-wrap: anywhere; }
.message-meta time,.message-handle { color:var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.message-text { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-history:empty::before { content: 'Aucun message dans cette conversation.'; display: block; padding: 24px 4px; }
.chat-compose { display:grid; grid-template-columns:minmax(0,1fr) auto; max-width:none; align-items:end; background:var(--hover); padding:14px 16px; border:1px solid var(--border); border-radius:8px; gap:8px 12px; }
.chat-compose label { grid-column: 1 / -1; margin: 0; font-size: 13px; }
.chat-compose textarea { border:0; background:transparent; padding:2px; min-height:44px; max-height:160px; }
.chat-compose button[type="submit"] { margin:0; min-height:44px; }
.message-length { grid-column:1 / -1; font-size:10px; color:var(--muted); text-align:right; }
.chat-notice { margin:10px 0 0; font-size:11px; color:var(--muted); }
.thread-stream > div:last-child > a { font-size:11px; color:var(--muted); }
.presence { white-space: nowrap; }
.presence-square { display: inline-block; width: 10px; height: 10px; margin-right: 6px; }
.presence-square.online { background: var(--success); }
.presence-square.dnd { background: var(--error); }
.presence-square.offline { background: var(--border); }
.back-conversations { flex-shrink:0; display: none; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.groups-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 24px; align-items: start; }
.groups-catalog { min-width: 0; }
.group-create { border-radius:8px; background: var(--secondary); border: 1px solid var(--border); padding: 20px; }
.group-create h2 { margin-top: 0; }
.catalog-summary { margin-top: 0; border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.catalog-search { max-width: none; }
.catalog-search label { margin-top: 0; }
.groups-table { min-width: 580px; table-layout: fixed; }
.groups-table th:nth-child(1) { width: 27%; }
.groups-table th:nth-child(2) { width: 39%; }
.groups-table th:nth-child(3) { width: 34%; }
.member-total { margin-top: 0; font-weight: bold; }
.group-people { display: grid; gap: 12px; margin-top: 12px; }
.group-people .avatar { width: 32px; height: 32px; }
.group-editor > h2 { margin-top: 0; }
.group-members-list { list-style: none; padding: 0; margin: 24px 0; border-top: 1px solid var(--border); }
.group-members-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding: 12px 0; }
.group-members-list span { overflow-wrap: anywhere; }
.member-picker { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); background: var(--surface); padding: 8px 12px; margin-top: 14px; }
.member-picker label { margin: 12px 0; align-items: center; }
.member-picker .avatar { width: 30px; height: 30px; }
@media (max-width: 1100px) {
 .groups-layout { grid-template-columns: minmax(0,1fr); }
 .group-create { max-width: 600px; }
}
@media (max-width: 1199px) {
 .thread-body.members-open { grid-template-columns: minmax(0,1fr); }
 .thread-body.members-open .thread-stream { display: none; }
 .member-panel { border-left: 0; }
}
@media (max-width: 799px) {
 .workspace-chat .app-layout { min-height: 0; }
 .workspace-chat .app-layout { display:flex; flex-direction:column; }
 main.messaging { flex:1; height:auto; min-height:0; }
 .messaging-layout { display: block; overflow-y: auto; }
 .conversation-list { border-right: 0; min-height: 100%; }
 .conversation-pane { height: 100%; }
 .conversation-placeholder { display: none; }
 .messaging-layout.has-conversation .conversation-list { display: none; }
 .back-conversations { display: block; }
 .thread-header { padding: 12px; gap: 8px; }
 .thread-header h2 { font-size: 16px; }
 .thread-identity { gap: 8px; }
 .thread-stream { padding: 10px 12px; }
 .message-row { gap: 10px; }
 .message-row .avatar { width: 32px; height: 32px; }
 .chat-compose button { padding: 8px 10px; }
}
.thread-header .name-trigger { font-size:inherit; }
.chat-person { display:grid; grid-template-columns:40px minmax(0,1fr); column-gap:10px; }
.chat-person > .photo-trigger { grid-row:1 / 3; }
.chat-person .presence { margin:4px 0; grid-column:2; }
.chat-person p { grid-column:1 / -1; }
.conversation-heading { font-size:17px; margin:0 0 16px; }
.thread-toolbar { align-items:center; border-bottom:1px solid var(--border); margin-bottom:10px; }
.message-row { position:relative; padding:10px 62px 10px 6px; gap:12px; }
.message-row > .id-actions { position:absolute; top:8px; right:4px; }
.id-actions { background:transparent; color:var(--text); border:1px solid transparent; min-height:28px; font-size:11px; padding:3px 5px; }
.id-actions:hover,.id-actions:focus-visible { border-color:var(--border); background:var(--surface); }
.message-continuation { padding-top:2px; padding-bottom:2px; min-height:32px; }
.message-continuation > .photo-trigger { visibility:hidden; height:0; }
.message-continuation .message-meta { display:none; }
.message-continuation .message-text { margin-top:0; }
.message-continuation > .id-actions { top:0; }
.continuation-time { position:absolute; left:0; top:5px; width:46px; text-align:center; font-size:10px; }
.chat-person { border-bottom:1px solid var(--border); padding:14px 0; }
.chat-person:last-child { border-bottom:0; }
@media(max-width:799px) {
 .message-row { padding-right:55px; }
 .continuation-time { width:34px; }
 .chat-compose { padding:10px; }
 .conversation-heading { margin-top:4px; }
}

/* Short windows and mobile landscape keep the composer within reach. */
@media(max-height:650px) {
 .workspace-chat .topbar { min-height:48px; padding:6px 10px; gap:6px; }
 .workspace-chat .topbar button { min-height:30px; padding:4px 8px; }
 .workspace-chat .theme-picker select { min-height:30px; }
 .workspace-chat .account-identity .avatar { width:26px; height:26px; }
 .connection-state { padding:4px 12px; }
 .back-conversations { padding:6px 12px; }
 .thread-header { min-height:56px; padding:8px 12px; }
 .thread-toolbar { padding-bottom:6px; margin-bottom:6px; }
 .chat-history { min-height:64px; margin-bottom:8px; }
 .chat-compose { padding:8px; gap:4px 8px; }
 .chat-compose label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
 .chat-compose textarea { height:38px; min-height:38px; max-height:70px; }
 .chat-compose button[type="submit"] { min-height:38px; }
 .chat-notice { margin-top:6px; font-size:10px; }
}
