.chat-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}.chat-heading h3{margin:0}.chat-status{font-size:12px;opacity:.8}.chat-room-list{display:grid;gap:8px}.chat-room-list button{display:flex;flex-direction:column;align-items:flex-start;gap:5px;padding:12px}.chat-room-list small{text-transform:capitalize}.chat-admin form,.chat-members form,.chat-compose{display:grid;gap:10px;margin:16px 0}.chat-admin label,.chat-compose label{display:grid;gap:6px}.chat-messages{max-height:48vh;overflow:auto;display:grid;gap:10px}.chat-messages article{padding:12px;background:#ffffff10;border:1px solid #71868055;border-radius:7px;display:grid;gap:6px}.chat-messages p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.chat-messages small{opacity:.8;font-size:12px}.chat-messages button{justify-self:start;font-size:11px}.chat-compose textarea{width:100%;box-sizing:border-box;font:inherit}.chat-room-list button,.chat-admin button,.chat-conversation button,.chat-heading button{border:1px solid #68887e;border-radius:5px;background:#315c55;color:white;padding:8px;cursor:pointer}.chat-admin select,.chat-members select{max-width:100%;width:100%;font:inherit}.chat-conversation[hidden],.chat-room-list[hidden],.chat-admin[hidden],.chat-compose[hidden]{display:none}

.chat-rooms-only [data-chat-direct]{display:none}

/* Compact, flat room rows and a radio-style conversation for the command map. */
#mapChatPanel .chat-heading{padding:8px 0;border-bottom:1px solid #ffffff26;margin-bottom:0;min-height:42px}
#mapChatPanel .chat-heading h3{font-size:16px;letter-spacing:.03em}
#mapChatPanel .chat-heading button{background:transparent;border:0;color:#c6d8dc;font-size:12px;padding:7px}
#mapChatPanel .chat-status{margin:7px 0 12px;color:#aebfc3;font-size:11px}
#mapChatPanel .chat-room-list{display:block;border-top:1px solid #ffffff26}
#mapChatPanel .chat-room-list[hidden]{display:none}
#mapChatPanel .chat-room-list button{width:100%;display:flex;flex-direction:row;align-items:center;gap:12px;min-height:62px;padding:10px 8px;background:transparent;border:0;border-bottom:1px solid #ffffff26;border-radius:0;text-align:left;color:#edf3f4}
#mapChatPanel .chat-room-list button:hover,#mapChatPanel .chat-room-list button:focus-visible{background:#ffffff0d;outline:1px solid #9cc7ca;outline-offset:-1px}
.chat-room-icon{width:26px;height:26px;flex-shrink:0;color:#d7e3e5}
.chat-room-copy{display:grid;gap:4px;flex:1;min-width:0}
.chat-room-copy strong{font-size:14px;overflow-wrap:anywhere}
.chat-room-copy small{font-size:11px;color:#a8b9be;text-transform:none}
.chat-room-chevron{font-size:24px;color:#9badb1}
.chat-room-unread{min-width:21px;height:21px;padding:0 5px;border-radius:10px;background:#f4cd55;color:#142023;display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:750}
#mapChatPanel .chat-admin{margin-top:14px;font-size:12px;color:#bdcdd0}
#mapChatPanel .chat-admin summary,#mapChatPanel .chat-members summary{cursor:pointer;padding:8px 0}
#mapChatPanel .chat-room-title{font-size:14px;overflow-wrap:anywhere}
#mapChatPanel .chat-conversation>.chat-heading{justify-content:flex-start;gap:12px}
#mapChatPanel .chat-messages{gap:0;max-height:52vh;padding:0 8px;background:#10191d}
#mapChatPanel .chat-messages article{padding:12px 2px;background:transparent;border:0;border-bottom:1px solid #ffffff1c;border-radius:0;gap:6px}
.chat-message-heading{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 10px;align-items:baseline}
#mapChatPanel .chat-message-heading strong{font-size:12px;color:#f0d16a}
#mapChatPanel .chat-message-heading small{font-size:10px;color:#a5b6bb}
#mapChatPanel .chat-messages p{font-size:13px;line-height:1.5;color:#e8eef0}
#mapChatPanel .chat-messages article>small{font-size:10px;color:#98acb2}
#mapChatPanel .chat-messages button{background:transparent;border:0;padding:2px 0;color:#a9c6cf;font-size:10px}
#mapChatPanel .chat-compose{display:flex;align-items:flex-end;gap:8px;margin:0;padding:10px 0;border-top:1px solid #ffffff26}
#mapChatPanel .chat-compose[hidden]{display:none}
#mapChatPanel .chat-compose label{flex:1;min-width:0;margin:0}
#mapChatPanel .chat-compose-label{font-size:11px;color:#aebfc3}
#mapChatPanel .chat-compose textarea{background:#10191d;color:#fff;border:1px solid #506168;border-radius:3px;padding:9px;font-size:13px;resize:vertical;min-height:56px}
#mapChatPanel .chat-compose button{background:#293b41;border:1px solid #607780;border-radius:3px;min-height:56px;padding:10px;color:#f0d16a}
#mapChatPanel .chat-compose button:disabled{opacity:.5;cursor:wait}

/* Phone-style conversation: identity, not name matching, determines the side. */
.chat-messages,#mapChatPanel .chat-messages{display:flex;flex-direction:column;gap:12px;padding:12px 6px;background:transparent}
.chat-messages article.chat-message,#mapChatPanel .chat-messages article.chat-message{box-sizing:border-box;flex:none;align-self:flex-start;width:fit-content;max-width:86%;min-width:80px;display:grid;gap:5px;padding:10px 12px;border:1px solid #52636b;border-radius:14px 14px 14px 3px;background:#28363d;color:#edf3f4}
.chat-messages article.chat-message-own,#mapChatPanel .chat-messages article.chat-message-own{align-self:flex-end;background:#23594e;border-color:#3e8071;border-radius:14px 14px 3px 14px}
.chat-messages article.chat-message-pending,#mapChatPanel .chat-messages article.chat-message-pending{border-style:dashed}
.chat-message .chat-message-heading strong,#mapChatPanel .chat-message-heading strong{font-size:11px;color:#d2e1e8;line-height:1.3}
.chat-message-own .chat-message-heading strong,#mapChatPanel .chat-message-own .chat-message-heading strong{color:#bce9d9}
.chat-message p,#mapChatPanel .chat-messages .chat-message p{font-size:13px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere;min-width:0}
.chat-message .chat-message-meta,#mapChatPanel .chat-messages .chat-message-meta{font-size:10px;color:#c0cdd1;justify-self:end}
.chat-message button,#mapChatPanel .chat-messages .chat-message button{font-size:10px;color:#c4d9de;background:transparent;border:0;padding:2px 0;opacity:.85}

/* Keep the composer anchored; only the conversation scrolls. */
.map-workspace:not(.map-sidebar-closed)>.map-sidebar:has(#mapChatPanel:not([hidden])){display:flex;flex-direction:column;min-height:0;overflow:hidden}
.map-workspace:not(.map-sidebar-closed)>.map-sidebar:has(#mapChatPanel:not([hidden]))>.map-sidebar-close-row{flex:none;position:static}
#mapChatPanel:not([hidden]){display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
#mapChatPanel>.chat-heading,#mapChatPanel>.chat-status{flex:none}
#mapChatPanel>.chat-status:empty{display:none}
#mapChatPanel>.chat-room-list:not([hidden]){flex:1;min-height:0;overflow:auto}
#mapChatPanel>.chat-admin:not([hidden]){flex:none;max-height:35%;overflow:auto}
#mapChatPanel .chat-conversation:not([hidden]){display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
#mapChatPanel .chat-conversation>.chat-heading,#mapChatPanel [data-chat-older]{flex:none}
#mapChatPanel .chat-conversation>.chat-messages{flex:1;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain}
#mapChatPanel .chat-compose{flex:none;margin:auto 0 0;padding:10px 0 0;background:#172426}
#mapChatPanel .chat-compose textarea{min-height:42px;max-height:180px;resize:none;line-height:20px;border-radius:12px}
#mapChatPanel .chat-compose button{min-height:42px;border-radius:10px}
#mapChatPanel .chat-members{order:-1;flex:none;max-height:30%;overflow:auto}
.chat-attachment{display:flex;align-items:center;gap:10px;padding:8px;border-top:1px solid #506168;flex:none;font-size:12px}.chat-attachment[hidden]{display:none}.chat-attachment img{width:64px;height:64px;object-fit:contain;border-radius:6px}.chat-attachment span{flex:1}.chat-photo-button img,.chat-pending-photo{display:block;max-width:100%;width:240px;max-height:220px;object-fit:contain;border-radius:8px}.chat-photo-button{cursor:zoom-in}.chat-photo-dialog{max-width:90vw;max-height:90vh;padding:16px;border:1px solid #52636b;border-radius:12px;background:#172426;color:white}.chat-photo-dialog::backdrop{background:#000b}.chat-photo-dialog>button{display:block;margin:0 0 10px auto;padding:10px;cursor:pointer}.chat-photo-dialog>img{display:block;max-width:85vw;max-height:75vh;object-fit:contain}.chat-compose input[hidden]{display:none}

/* Quiet, rounded scrollbars with a stable gutter for chat content. */
.chat-messages,.chat-room-list,.chat-admin,.chat-members,.chat-compose textarea{scrollbar-width:thin;scrollbar-color:#64877e #ffffff08;scrollbar-gutter:stable}
:is(.chat-messages,.chat-room-list,.chat-admin,.chat-members,.chat-compose textarea)::-webkit-scrollbar{width:8px;height:8px}
:is(.chat-messages,.chat-room-list,.chat-admin,.chat-members,.chat-compose textarea)::-webkit-scrollbar-track{background:#ffffff08;border-radius:10px}
:is(.chat-messages,.chat-room-list,.chat-admin,.chat-members,.chat-compose textarea)::-webkit-scrollbar-thumb{background:#64877e;border:2px solid transparent;background-clip:padding-box;border-radius:10px}
:is(.chat-messages,.chat-room-list,.chat-admin,.chat-members,.chat-compose textarea)::-webkit-scrollbar-thumb:hover{background-color:#92b6aa}
@media (forced-colors:active){.chat-messages,.chat-room-list,.chat-admin,.chat-members,.chat-compose textarea{scrollbar-color:auto}}
.chat-file-card,#mapChatPanel .chat-messages .chat-message .chat-file-card{display:flex;align-items:center;gap:10px;text-align:left;padding:10px;border:1px solid #85a99b66;border-radius:9px;color:#e8f3ee;max-width:100%;opacity:1}.chat-file-icon{display:inline-flex;align-items:center;justify-content:center;flex:none;width:42px;height:48px;border:1px solid #a1bdb0;border-radius:5px;font-size:11px;font-weight:750;color:#d7ede2;background:#ffffff0a}.chat-file-card>span:last-child{min-width:0;display:grid;gap:5px}.chat-file-card strong{overflow-wrap:anywhere;font-size:13px}.chat-file-card small{font-size:11px}.chat-photo-dialog a{color:#b8e7d6}
.chat-member-picker{min-width:0;margin:0;padding:0;border:0}.chat-member-picker legend{font-size:12px;font-weight:650;margin-bottom:7px;color:inherit}.chat-member-options{max-height:220px;overflow:auto;scrollbar-width:thin;scrollbar-color:#64877e transparent;border:1px solid #52636b;border-radius:9px;background:#ffffff04}
.chat-admin .chat-member-option,.chat-members .chat-member-option{display:flex;align-items:center;gap:10px;min-height:46px;padding:9px 10px;cursor:pointer;border-bottom:1px solid #ffffff12;margin:0}.chat-member-option:last-child{border-bottom:0}.chat-member-option:hover{background:#ffffff08}.chat-member-option:has(input:checked){background:#528e7526}.chat-member-option:focus-within{outline:2px solid #9cc7ca;outline-offset:-2px}.chat-member-option input[type=checkbox]{appearance:auto;width:18px;height:18px;min-width:18px;margin:0;accent-color:#79b69e;cursor:pointer}.chat-member-option>span{display:grid;gap:3px;min-width:0}.chat-member-option strong{font-size:13px;color:#edf3f4;overflow-wrap:anywhere}.chat-member-option small{font-size:11px;color:#b3c6c0}
.chat-member-actions{display:flex;flex-wrap:wrap;gap:8px}.chat-member-actions button{flex:1;min-height:36px}.chat-member-actions button[aria-expanded=true]{background:#416e60;border-color:#9cc7b6}.chat-members form>p{font-size:12px;line-height:1.4;margin:2px 0}.chat-members{padding:8px 0}.chat-members .chat-member-options{max-height:180px}

/* Room creation owns the sidebar; the member list uses the remaining height. */
.chat-create-panel[hidden],.chat-admin [data-chat-create-open][hidden]{display:none}
#mapChatPanel>.chat-admin[data-creating=true]:not([hidden]){display:flex;flex-direction:column;flex:1;min-height:0;max-height:none;overflow:hidden;margin-top:0}
#mapChatPanel:has(.chat-create-panel:not([hidden]))>.chat-heading{display:none}
.chat-admin[data-creating=true]>[data-chat-direct]{display:none}
.chat-create-panel:not([hidden]){display:flex;flex-direction:column;flex:1;min-height:0}
.chat-create-panel>.chat-heading{flex:none}
.chat-admin .chat-create-panel form[data-chat-create]{display:flex;flex-direction:column;flex:1;min-height:0;gap:12px;margin:12px 0 0}
.chat-create-name,.chat-create-footer{flex:none}.chat-create-footer{padding-top:10px;border-top:1px solid #ffffff26}.chat-create-footer>button{width:100%;min-height:42px}
.chat-create-panel .chat-member-picker{display:flex;flex-direction:column;flex:1;min-height:0}
.chat-create-panel .chat-member-options{flex:1;min-height:0;max-height:none;overflow:auto}
.chat-admin .chat-member-option,.chat-members .chat-member-option{min-height:36px;padding:6px 9px;box-sizing:border-box}
.chat-member-option>span{display:flex;align-items:baseline;gap:8px;flex:1;min-width:0;white-space:nowrap;overflow:hidden}
.chat-member-option strong{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-member-option small{flex:none;max-width:55%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.chat-sections{display:flex;gap:8px;margin:8px 0 12px}.chat-sections button{flex:1;padding:10px;border:1px solid #68887e;border-radius:6px;background:transparent;color:inherit;cursor:pointer}.chat-sections button[aria-pressed=true]{background:#315c55;color:white}.chat-sections[hidden],.chat-admin form[hidden]{display:none}

[data-chat-direct][hidden]{display:none}.chat-person-results{display:grid;gap:6px;max-height:320px;overflow:auto;margin-top:8px}.chat-person-results button{display:flex;align-items:baseline;justify-content:space-between;gap:10px;text-align:left;padding:10px}.chat-person-results small{opacity:.75}.chat-person-results button:disabled{opacity:.5}

.chat-safety-dialog{max-width:min(440px,92vw);max-height:85vh;overflow:auto;background:#172426;color:#edf5f2;border:1px solid #415852;border-radius:12px;padding:18px}.chat-safety-dialog::backdrop{background:#0008}.chat-safety-dialog label{display:grid;gap:6px;margin:12px 0}.chat-safety-dialog textarea,.chat-safety-dialog select{width:100%;box-sizing:border-box}.chat-safety-dialog article{padding:12px 0;border-bottom:1px solid #415852}.chat-message-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}.chat-message-meta [data-chat-report]{padding:2px 8px;background:transparent;border:0;color:inherit;opacity:.65}.chat-safety-dialog details{margin-top:16px}

.chat-message-meta [data-chat-report]{display:inline;padding:0 6px;margin-left:4px;line-height:inherit;font-size:inherit;vertical-align:baseline;min-height:0}
