[data-elv-presence] {
    border-radius: 50% !important;
    box-shadow: 0 0 0 3px var(--elv-status-color), 0 0 0 5px var(--cpd-color-bg-canvas-default, white) !important;
}
[data-elv-presence="online"] { --elv-status-color: var(--elv-online, #16a34a); }
[data-elv-presence="busy"] { --elv-status-color: #d9343a; }
[data-elv-presence="in_call"] { --elv-status-color: #ea580c; }
[data-elv-presence="offline"] { --elv-status-color: #92979f; }
.elv-company-panel { flex: 0 0 auto; margin: 4px 12px 12px; color: var(--cpd-color-text-primary, #202329); }
.elv-company-panel button, .elv-company-panel select, .elv-directory-dialog button, .elv-directory-dialog input {
    font: inherit; color: inherit; border: 1px solid var(--cpd-color-border-interactive-primary, #bbc1c9);
    border-radius: 8px; padding: 6px 9px; background: var(--cpd-color-bg-canvas-default, white);
}
.elv-company-panel button, .elv-directory-dialog button { cursor: pointer; }
.elv-company-panel button:focus-visible, .elv-company-panel select:focus-visible { outline: 2px solid #3b70ee; outline-offset: 3px; }
.elv-frank-avatar { display: inline-flex; justify-content: center; align-items: center; flex: 0 0 32px; width: 32px; height: 32px; margin: 3px; border-radius: 50%; background: #e5e9ff; color: #5242c6; font-weight: 700; }
.elv-frank-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.elv-directory-dialog { width: min(520px, 80vw); max-height: 75vh; border: 1px solid #bbc1c9; border-radius: 16px; padding: 24px; color: var(--cpd-color-text-primary, #202329); background: var(--cpd-color-bg-canvas-default, white); }
.elv-directory-dialog::backdrop { background: #0007; }
.elv-directory-dialog header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; font-size: 20px; font-weight: 600; }
.elv-directory-dialog input { box-sizing: border-box; width: 100%; margin-bottom: 14px; }
.elv-directory-row { display: flex; align-items: center; width: 100%; text-align: start; margin: 8px 0; gap: 12px; }
.elv-directory-row img { width: 32px; height: 32px; object-fit: cover; border-radius: 50%; margin: 3px; }
.elv-company-error { font-size: 12px; margin-top: 6px; }
.elv-frank-plain-original { display: none !important; }
.elv-frank-message { line-height: 1.55; overflow-wrap: anywhere; color: inherit; background: transparent; }
.elv-frank-message p { margin: 0 0 0.8em; }
.elv-frank-message :is(h1,h2,h3,h4,h5,h6) { margin: 1.15em 0 0.45em; line-height: 1.3; border: 0; padding: 0; }
.elv-frank-message :is(h1,h2) { font-size: 1.2em; }
.elv-frank-message :is(h3,h4,h5,h6) { font-size: 1.06em; }
.elv-frank-message > :first-child { margin-top: 0; }
.elv-frank-message > :last-child { margin-bottom: 0; }
.elv-frank-message :is(ul,ol) { margin: 0.4em 0 1em; padding-inline-start: 1.55em; }
.elv-frank-message li { margin: 0.35em 0; padding-inline-start: 0.15em; }
.elv-frank-message li > p { margin-bottom: 0.35em; }
.elv-frank-message a { color: var(--cpd-color-text-link-external, #2466c2); text-decoration: underline; text-underline-offset: 2px; }
.elv-frank-message pre { max-width: 100%; overflow: auto; padding: 12px; border-radius: 8px; background: var(--cpd-color-bg-subtle-secondary, #eceef2); }
.elv-frank-message pre code { white-space: pre; overflow-wrap: normal; }
.elv-frank-message blockquote { margin-inline: 0; padding-inline-start: 1em; border-inline-start: 3px solid var(--cpd-color-border-interactive-primary, #bbc1c9); }
.elv-frank-message table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0.6em 0 1em; }
.elv-frank-message :is(th,td) { border: 1px solid var(--cpd-color-border-interactive-primary, #bbc1c9); padding: 0.45em 0.7em; }
.elv-copy-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 6px; padding: 5px 9px; font: inherit; font-size: 12px; color: var(--cpd-color-text-secondary, #656d77); background: transparent; cursor: pointer; }
.elv-copy-button:hover { background: var(--cpd-color-bg-subtle-secondary, #eceef2); color: var(--cpd-color-text-primary, #202329); }
.elv-copy-button:focus-visible { outline: 2px solid #3b70ee; outline-offset: 2px; }
.elv-copy-button[data-copy-status="copied"] { color: #198754; }
.elv-copy-button[data-copy-status="failed"] { color: #d9343a; }
.elv-copy-action { width: 32px; height: 32px; padding: 5px; }
.elv-copy-block-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 5px 9px; border: 1px solid var(--cpd-color-border-interactive-primary, #bbc1c9); border-radius: 8px 8px 0 0; background: var(--cpd-color-bg-subtle-secondary, #eceef2); font-size: 12px; color: var(--cpd-color-text-secondary, #656d77); }
.elv-frank-message .elv-copy-block { margin-top: 0; border-radius: 0 0 8px 8px; border: 1px solid var(--cpd-color-border-interactive-primary, #bbc1c9); }
.elv-frank-message .elv-copy-block th { background: var(--cpd-color-bg-subtle-secondary, #eceef2); text-align: start; }
/* ELV rail: fixed-width navigation, so Element's expand toggle and inline space names are not shown. */
.mx_SpacePanel > .mx_SpacePanel_toggleCollapse { display: none; }
.mx_SpacePanel .mx_SpaceButton_name { display: none; }
.elv-rail-item .elv-rail-badge:empty { display: none; }
/* The ELV Send control stands in for Element's, which only mounts once the composer has content. */
.mx_MessageComposer_actions:has(.elv-send-button) > .mx_MessageComposer_sendMessage { display: none; }
/* The rail scrolls as one column on short windows; its scrollbar stays hidden. */
.mx_SpacePanel::-webkit-scrollbar { display: none; }
/* Matrix IDs carry the homeserver name (192.168.53.236), which is not where a person is; Messenger shows people by name. */
.mx_InviteDialog_tile_nameStack_userId, .mx_InviteDialog_helpText, .mx_InviteDialog_identityServer, .mx_InviteDialog_footer,
.mx_DisambiguatedProfile_mxid, .mx_UserInfo_profile_mxid, .mx_SpotlightDialog_result_details { display: none; }
/* The user menu prints the raw MXID under the display name. Hashed CSS-module class names are
   unstable across upstream builds, so bind to the stable mx_UserMenu wrapper and the component's
   data-testid. Collapse the section when the ID is all it carries, so its margin leaves no gap. */
.mx_UserMenu [data-testid="userId"] { display: none; }
.mx_UserMenu section:has(> [data-testid="userId"]):not(:has(a, button)) { display: none; }

.elv-about-dialog { width: min(720px, 92vw); max-height: 88vh; display: flex; flex-direction: column; gap: 10px; }
.elv-about-dialog[open] { display: flex; }
.elv-about-dialog header { display: flex; justify-content: space-between; align-items: center; }
.elv-about-dialog h2 { margin: 0; font-size: 20px; }
.elv-about-dialog iframe { width: 100%; height: min(640px, 70vh); border: 0; border-radius: 12px; }
/* Mac app: while a call window is open and another conversation shows, bring it forward. */
.elv_MacCallReturnBar {
    position: fixed; right: 24px; bottom: 96px; z-index: 50;
    display: flex; align-items: center; gap: 12px; max-width: min(360px, calc(100vw - 48px));
    padding: 10px 10px 10px 16px; border-radius: 16px;
    color: #fff; background: #10151d; box-shadow: 0 10px 30px rgb(0 0 0 / 28%);
    font: 14px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.elv_MacCallReturnBar_dot { flex: 0 0 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgb(34 197 94 / 22%); }
.elv_MacCallReturnBar_text { display: grid; min-width: 0; }
.elv_MacCallReturnBar_text span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #c8d1dc; }
.elv_MacCallReturnBar button {
    flex: 0 0 auto; min-height: 36px; padding: 8px 14px; border: 0; border-radius: 18px;
    color: #fff; background: #19844b; font: 600 14px -apple-system, BlinkMacSystemFont, sans-serif; cursor: pointer;
}
.elv_MacCallReturnBar button:focus-visible { outline: 2px solid #b8d5ff; outline-offset: 3px; }
