/* Cax user avatars: enforce round clipping even when legacy themes override border-radius. */
img.avatar, img.cax-user-avatar-image,
.cax-presence-avatar > img.avatar,
.cax-decorated-avatar > img.avatar,
.cax-profile-actions .cax-presence-avatar > img.avatar,
.memberlist .cax-presence-avatar > img.avatar,
.sidebar .cax-presence-avatar > img.avatar,
.dm-chat .cax-presence-avatar > img.avatar,
.messages .cax-presence-avatar > img.avatar,
.ss-body img.avatar,
.cax-mutual-picture > img,
.cax-friend-identity img.avatar {
 border-radius:50% !important;
 clip-path:circle(50% at 50% 50%) !important;
 object-fit:cover !important;
 object-position:center !important;
 aspect-ratio:1 / 1;
}
/* Keep letter avatars round too. Do not clip their status indicators. */
.cax-presence-avatar > .avatar:not(img),
span.avatar, .cax-mutual-picture {border-radius:50% !important;}
.cax-presence-avatar,.cax-decorated-avatar {overflow:visible !important;}


/* 2026-11-03: Profile popup photo must be circular even when an avatar
   is rendered as a nested image, a background-image, or a picture element.
   Only clip the actual photo, never the decoration/status overlay. */
.cax-profile .cax-profile-actions :is(.avatar, .cax-user-avatar-image, .cax-preview-pfp),
.profile .profile-inner :is(.avatar, .cax-user-avatar-image),
.cax-profile .cax-profile-actions picture,
.cax-profile .cax-profile-actions picture > img,
.cax-profile .cax-profile-actions .avatar > img,
.cax-profile .cax-profile-actions .cax-presence-avatar > .avatar,
.cax-profile .cax-profile-actions .cax-decor-avatar > .avatar,
.cax-profile .cax-profile-actions .cax-decorated-avatar > .avatar {
  border-radius: 50% !important;
  object-fit: cover !important;
  background-size: cover !important;
  background-position: center !important;
}
.cax-profile .cax-profile-actions :is(img.avatar, .avatar > img, picture > img, .cax-user-avatar-image),
.profile .profile-inner :is(img.avatar, .avatar > img, picture > img) {
  clip-path: circle(50% at 50% 50%) !important;
  object-fit: cover !important;
}
.cax-profile .cax-profile-actions .avatar > img,
.profile .profile-inner .avatar > img {
  width: 100%;
  height: 100%;
  display: block;
}
.cax-profile .cax-profile-actions :is(.cax-presence-avatar, .cax-decor-avatar, .cax-decorated-avatar) {
  overflow: visible !important;
}

/* Profile popup: clip the photo itself, not only the avatar frame.
   Keep the presence dot and decoration outside the clipped photo. */
.cax-profile .cax-profile-actions .cax-decor-avatar > .cax-presence-avatar {
  width:100px !important; height:100px !important;
  min-width:100px !important; min-height:100px !important;
  border-radius:50% !important; overflow:visible !important;
  position:relative !important;
}
.cax-profile .cax-profile-actions .cax-decor-avatar > .cax-presence-avatar > img.avatar.cax-user-avatar-image {
  display:block !important; box-sizing:border-box !important;
  width:100% !important; height:100% !important;
  min-width:0 !important; min-height:0 !important;
  margin:0 !important; padding:0 !important; border:0 !important;
  border-radius:50% !important; clip-path:circle(50% at 50% 50%) !important;
  object-fit:cover !important; object-position:center !important;
  aspect-ratio:1/1 !important; overflow:hidden !important;
}
/* The visible circular rim is on the photo, never a square border. */
.cax-profile .cax-profile-actions .cax-decor-avatar > .cax-presence-avatar > img.avatar.cax-user-avatar-image {
  outline:0 !important; box-shadow:0 0 0 5px #18191d;
}
.cax-profile .cax-profile-actions .cax-decor-overlay,
.cax-profile .cax-profile-actions .cax-small-decor-overlay,
.cax-profile .cax-profile-actions .cax-presence-dot {
  clip-path:none !important; overflow:visible !important;
}


/* Profile cards: clip the photo to the circular border, including images
   rendered as a nested element or CSS background. Never clip the status dot. */
:is(.cax-profile,.profile,.profile-inner,.cax-profile-actions)
  :is(.cax-decor-avatar,.cax-decorated-avatar,.cax-presence-avatar) > :is(img.avatar,.avatar,.cax-user-avatar-image,picture) {
  border-radius: 50% !important;
  overflow: hidden !important;
  aspect-ratio: 1 / 1 !important;
}
:is(.cax-profile,.profile,.profile-inner,.cax-profile-actions)
  :is(.cax-decor-avatar,.cax-decorated-avatar,.cax-presence-avatar) > :is(img.avatar,.avatar,.cax-user-avatar-image,picture) > img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
}
:is(.cax-profile,.profile,.profile-inner,.cax-profile-actions)
  :is(.cax-decor-avatar,.cax-decorated-avatar,.cax-presence-avatar) > img {
  border-radius: 50% !important;
  clip-path: circle(50% at 50% 50%) !important;
  object-fit: cover !important;
}


/* Profile popup: put the PHOTO INSIDE the circular PFP BORDER.
   Legacy .cax-profile-actions .avatar puts a 6px border and -65px
   margin on the image; transfer both to the outer avatar holder. */
.cax-profile .cax-profile-actions > .cax-decor-avatar {
  width: 100px !important;
  height: 100px !important;
  min-width: 100px !important;
  min-height: 100px !important;
  margin-top: -65px !important;
  box-sizing: border-box !important;
  border: 6px solid #18191d !important;
  border-radius: 50% !important;
  position: relative !important;
  overflow: visible !important;
  display: inline-flex !important;
  flex-shrink: 0 !important;
}
.cax-profile .cax-profile-actions > .cax-decor-avatar > .cax-presence-avatar {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  position: relative !important;
}
.cax-profile .cax-profile-actions > .cax-decor-avatar > .cax-presence-avatar > :is(img.avatar,.avatar,.cax-user-avatar-image) {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 50% !important;
  clip-path: circle(50% at 50% 50%) !important;
  object-fit: cover !important;
  object-position: center !important;
  box-sizing: border-box !important;
}

/* Identify server-generated slash-command replies without impersonating a user. */
.cax-bot-badge{display:inline-flex;vertical-align:middle;align-items:center;margin-left:5px;padding:2px 5px;border-radius:4px;background:#5865f2;color:#fff;font-size:10px;font-weight:800;letter-spacing:.035em;line-height:1.2}

/* Discovery: dark-only responsive dialog */
#caxDiscoveryBackdrop{--dis-bg:#151923;--dis-card:#222838;--dis-text:#f4f6fc;--dis-muted:#b6c0d4;--dis-border:#3a4459;--dis-field:#111621;--dis-accent:#a1adff;color:var(--dis-text);background:rgba(3,6,13,.78)!important;backdrop-filter:blur(6px)}
#caxDiscoveryBackdrop>.modal{background:var(--dis-bg)!important;color:var(--dis-text)!important;border:1px solid var(--dis-border)!important;border-radius:16px!important;box-shadow:0 20px 80px #000a;box-sizing:border-box;max-width:850px;width:min(850px,95vw);max-height:90dvh;overflow:auto}
#caxDiscoveryBackdrop :is(h2,b){color:var(--dis-text)!important}
#caxDiscoveryBackdrop .muted{color:var(--dis-muted)!important}
#caxDiscoveryBackdrop #caxDiscoverySearch{background:var(--dis-field)!important;color:var(--dis-text)!important;border:1px solid var(--dis-border)!important;border-radius:10px;padding:12px 14px;box-sizing:border-box}
#caxDiscoveryBackdrop #caxDiscoverySearch::placeholder{color:var(--dis-muted)}
#caxDiscoveryBackdrop #caxDiscoveryResults{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr));gap:14px;align-items:stretch}
#caxDiscoveryBackdrop .cax-discovery-card{min-width:0;background:var(--dis-card)!important;border:1px solid var(--dis-border)!important;border-radius:13px;overflow:hidden;color:var(--dis-text);transition:border-color .15s,background .15s}
#caxDiscoveryBackdrop .cax-discovery-card:hover{border-color:#7986b2!important;background:#293146!important}
#caxDiscoveryBackdrop .cax-discovery-banner{height:110px;background:linear-gradient(115deg,#4a5277,#252b3f);background-position:center;background-size:cover}
#caxDiscoveryBackdrop .cax-discovery-card>.row{display:flex;min-width:0;flex-wrap:wrap;gap:10px!important}
#caxDiscoveryBackdrop .cax-discovery-card>.row>.grow{flex:1 1 110px;overflow:hidden}
#caxDiscoveryBackdrop .cax-discovery-card b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#caxDiscoveryBackdrop .cax-discovery-icon{width:48px;height:48px;min-width:48px;border-radius:14px;overflow:hidden;display:grid;place-items:center;background:var(--dis-field);border:1px solid var(--dis-border)}
#caxDiscoveryBackdrop .cax-discovery-icon img{width:100%;height:100%;object-fit:cover}
#caxDiscoveryBackdrop .primary{background:#8f9eff!important;color:#101523!important;border:0!important;border-radius:9px;padding:9px 13px;white-space:nowrap}
#caxDiscoveryBackdrop .primary:disabled{opacity:.58;cursor:default}
#caxDiscoveryBackdrop #caxDiscoveryClose{color:var(--dis-text)!important;background:#252c3d!important;border:1px solid var(--dis-border)!important;border-radius:8px;padding:8px 11px}
#caxDiscoveryBackdrop :is(button,input):focus-visible{outline:2px solid var(--dis-accent);outline-offset:2px}
@media(max-width:600px){#caxDiscoveryBackdrop>.modal{width:96vw!important;max-height:92dvh!important;padding:16px!important}#caxDiscoveryBackdrop #caxDiscoveryResults{grid-template-columns:minmax(0,1fr)}}


/* Equipped nameplates in member and direct-message sidebars. */
.memberlist .cax-nameplate-row,
#friendsSidebar .cax-nameplate-row{
 position:relative;isolation:isolate;overflow:hidden;border-radius:10px;
 min-height:40px;padding:5px 8px;gap:9px;
}
.memberlist .cax-nameplate-row.cax-has-nameplate,
#friendsSidebar .cax-nameplate-row.cax-has-nameplate{
 background-image:linear-gradient(90deg,rgba(10,12,22,.28),rgba(10,12,22,.08)),var(--cax-nameplate-image);
 background-position:center;background-repeat:no-repeat;background-size:cover;
 border:1px solid rgba(255,255,255,.13);
}
.memberlist .cax-nameplate-row.cax-has-nameplate:hover,
#friendsSidebar .cax-nameplate-row.cax-has-nameplate:hover{
 filter:brightness(1.12);
}
.memberlist .cax-nameplate-row > *,
#friendsSidebar .cax-nameplate-row > *{position:relative;z-index:1}
.memberlist .cax-nameplate-row .truncate,
#friendsSidebar .cax-nameplate-row .truncate{
 min-width:0;text-shadow:0 1px 4px rgba(0,0,0,.85);
}
.cax-nameplate-option{display:inline-flex;flex-direction:column;gap:5px;max-width:230px}
.cax-nameplate-option-preview{
 display:block;min-width:155px;padding:9px 15px;border-radius:8px;
 background-size:cover;background-position:center;color:#fff;
 text-shadow:0 1px 4px #000;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}


/* Compact social profile inspired by the supplied annotated reference. */
#profileRoot .cax-profile{width:min(460px,calc(100vw - 24px));max-height:min(92vh,920px);overflow-y:auto;border-radius:17px;background:var(--panel,#25232e);box-shadow:0 18px 70px #0009}
#profileRoot .cax-profile-banner{height:145px;background-size:cover;background-position:center}
#profileRoot .cax-profile .profile-inner{padding:0 16px 16px}
#profileRoot .cax-profile-actions{margin-top:-33px;min-height:72px;position:relative;z-index:2;display:flex;align-items:center;gap:7px}
#profileRoot .cax-profile-actions .spacer{flex:1}
#profileRoot .cax-profile-actions .primary{white-space:nowrap}
#profileRoot .cax-profile-name{font-size:23px;font-weight:750;line-height:1.25;margin-top:2px}
#profileRoot .cax-profile-handle{font-size:13px;opacity:.78;margin:3px 0 8px}
#profileRoot .cax-profile-badges{display:flex;align-items:center;flex-wrap:wrap;gap:5px;margin:8px 0}
#profileRoot .cax-profile-section{padding:12px 0;border-bottom:1px solid rgba(255,255,255,.1)}
#profileRoot .cax-profile-section .label{font-size:11px;letter-spacing:.05em;font-weight:750}
#profileRoot .cax-profile-section-head{display:flex;justify-content:space-between;font-size:12px;font-weight:750;margin-bottom:8px}
#profileRoot .cax-profile-comment{display:flex;align-items:flex-start;gap:8px;padding:7px 0;font-size:12px}
#profileRoot .cax-profile-comment-avatar{width:27px;height:27px;border-radius:50%;background:#555;flex:none;overflow:hidden;display:grid;place-items:center}
#profileRoot .cax-profile-comment-avatar img{width:100%;height:100%;object-fit:cover}
#profileRoot .cax-profile-comment small{font-size:10px;opacity:.65}
#profileRoot .cax-profile-comment-form,#profileRoot #caxProfileQuickMessage{display:flex;gap:6px;margin-top:8px}
#profileRoot .cax-profile-comment-form input,#profileRoot #caxProfileQuickMessage input{min-width:0;flex:1}
#profileRoot #caxProfilePrivateNote{width:100%;min-height:40px;resize:vertical;font-size:12px;margin-top:7px}
#profileRoot .cax-profile-id{font-size:11px;opacity:.72;margin-top:8px}
#profileRoot .cax-mutual-trigger{display:flex;align-items:center;flex-wrap:wrap;gap:8px}


/* Roomier profile content: inset panels instead of edge-to-edge compact cards. */
#profileRoot .cax-profile{width:min(520px,calc(100vw - 20px));}
#profileRoot .cax-profile .profile-inner{padding:0 24px 24px;box-sizing:border-box;}
#profileRoot .cax-profile-section{
 margin:12px 0 16px;padding:16px 18px;
 border:1px solid rgba(255,255,255,.09);
 border-radius:14px;background:rgba(255,255,255,.018);
 box-sizing:border-box;min-width:0;
}
#profileRoot .cax-profile-section .label,
#profileRoot .cax-profile-section-head{margin-bottom:10px;line-height:1.5;}
#profileRoot .cax-profile-comment{padding:10px 0;line-height:1.5;}
#profileRoot .cax-profile-comment-form,
#profileRoot #caxProfileQuickMessage{gap:10px;margin-top:12px;align-items:stretch;}
#profileRoot .cax-profile-comment-form input,
#profileRoot #caxProfileQuickMessage input{min-width:0;width:0;flex:1;padding:11px 13px;}
#profileRoot .cax-profile-comment-form button,
#profileRoot #caxProfileQuickMessage button{flex:none;min-width:48px;padding:9px 14px;}
#profileRoot #caxProfilePrivateNote{
 display:block;width:100%;min-height:66px;box-sizing:border-box;
 padding:12px 13px;line-height:1.5;margin-top:10px;
}
#profileRoot .cax-profile-quick-message{margin-bottom:8px;}
@media(max-width:480px){
 #profileRoot .cax-profile .profile-inner{padding:0 16px 20px;}
 #profileRoot .cax-profile-section{margin:10px 0 14px;padding:14px 12px;}
}


#profileRoot .cax-profile-comment{display:block;}
#profileRoot .cax-comment-author{display:flex;align-items:center;gap:9px;border:0;background:transparent;color:inherit;padding:2px 0;text-align:left;cursor:pointer;max-width:100%;}
#profileRoot .cax-comment-author:hover b{text-decoration:underline;}
#profileRoot .cax-comment-author:focus-visible{outline:2px solid currentColor;outline-offset:3px;border-radius:5px;}
#profileRoot .cax-comment-content{margin:5px 0 0 36px;overflow-wrap:anywhere;white-space:pre-wrap;}
#profileRoot .cax-comment-actions{display:flex;gap:7px;margin:8px 0 0 36px;}
#profileRoot .cax-comment-actions button{font-size:11px;padding:5px 9px;}


#profileRoot .cax-profile-identity-line{display:flex;align-items:center;flex-wrap:wrap;gap:5px;line-height:1.6;}
#profileRoot .cax-profile-identity-line .cax-profile-identity-divider{opacity:.7;}
#profileRoot .cax-profile-identity-line .cax-profile-badges{display:inline-flex;align-items:center;flex-wrap:wrap;gap:5px;margin:0;vertical-align:middle;}
#profileRoot .cax-profile-identity-line .cax-badge{vertical-align:middle;}


.cax-nameplate-template-guide{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:12px;border:1px solid rgba(255,255,255,.12);border-radius:12px;}
.cax-nameplate-template-guide img{width:min(100%,600px);height:auto;aspect-ratio:5/1;object-fit:contain;border-radius:8px;background:#111;}
.cax-nameplate-template-guide a.outline{display:inline-flex;align-items:center;gap:8px;text-decoration:none;padding:9px 12px;}

/* Custom server partnership and verification artwork */
.cax-server-status-icon{display:inline-block;width:18px;height:18px;object-fit:contain;vertical-align:middle;flex-shrink:0}
.cax-server-status-menu .cax-server-status-icon{width:22px;height:22px;margin-right:7px}
.cax-partner-mark .cax-server-status-icon,.cax-verified-mark .cax-server-status-icon{width:19px;height:19px}

/* Server title keeps its status badges visible while truncating only the name. */
#caxSidebar>.header{display:flex;align-items:center;min-width:0;position:relative}
#caxSidebar>.header .cax-server-title-row{display:flex;align-items:center;gap:5px;flex:1 1 0;min-width:0;overflow:hidden;white-space:nowrap}
.cax-server-title-text{min-width:0;flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cax-server-title-row .cax-partner-mark,.cax-server-title-row .cax-verified-mark{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;padding:0}
.cax-server-actions{position:relative;flex:0 0 auto}
.cax-server-more{display:flex;align-items:center;justify-content:center;min-width:30px;height:32px}
.cax-server-actions-menu{position:absolute;right:0;top:calc(100% + 7px);min-width:205px;padding:6px;background:#18191f;color:#f4f4f6;border:1px solid #393a44;border-radius:10px;box-shadow:0 12px 30px #0007;z-index:1000}
.cax-server-actions-menu[hidden],.cax-server-actions-legacy[hidden]{display:none!important}
.cax-server-actions-menu button{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border:0;border-radius:6px;background:transparent;color:inherit;text-align:left;white-space:nowrap;cursor:pointer}
.cax-server-actions-menu button:hover,.cax-server-actions-menu button:focus-visible{background:#343641}
.cax-server-actions-menu button.danger{color:#ff9898}

/* Public policies on auth and in Settings > Concerns */
.cax-auth-policy-links{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:6px 12px;margin-top:12px;font-size:12px;color:#a9a9b6;text-align:center}.cax-auth-policy-links span{flex-basis:100%}.cax-auth-policy-links a{color:var(--accent,#a8b5ff);text-decoration:underline;text-underline-offset:3px}.cax-policy-link{display:flex;flex-direction:column;gap:3px;padding:13px 14px;border:1px solid #353641;border-radius:9px;text-decoration:none;color:inherit}.cax-policy-link:hover{background:#ffffff0b}.cax-policy-link small{color:#a8a8b4}

/* Profile badges have their own section, ordered by power. */
.cax-profile-badges-section .cax-profile-badges{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px}
.cax-profile-badges-section .cax-badge{flex:0 0 auto}

/* Cax mobile: accessible navigation, member drawer, composer and staff pages */
.cax-mobile-header-btn{display:none}
@media(max-width:760px){
 .layout,.layout>.main,.workspace,.chat,.dm-workspace{min-width:0!important;max-width:100%}
 .main>.header{display:flex!important;align-items:center;gap:8px;padding:8px 10px;min-height:52px}
 .main>.header #mainTitle{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .cax-mobile-header-btn{display:inline-flex!important;align-items:center;justify-content:center;flex:none;min-width:42px;min-height:42px;border-radius:10px;background:var(--bg-secondary,#24242c);color:inherit;cursor:pointer}
 .cax-mobile-header-btn:focus-visible{outline:2px solid var(--accent,#9eaaff);outline-offset:2px}
 .layout>.sidebar{position:fixed!important;top:0;bottom:0;left:0;width:min(320px,88vw)!important;z-index:105!important;transform:translateX(-105%);transition:transform .2s ease;visibility:hidden;box-shadow:12px 0 40px #0009}
 body.cax-mobile-nav-open .layout>.sidebar{transform:translateX(0);visibility:visible}
 body.cax-mobile-nav-open .cax-mobile-backdrop,body.cax-mobile-members-open .cax-mobile-backdrop{display:block!important;position:fixed;inset:0;background:#0009;z-index:100}
 .layout>.rail{width:52px!important;min-width:52px!important;flex:none}
 .layout>.main{flex:1;min-width:0}
 .memberlist{position:fixed!important;right:0;top:0;bottom:0;width:min(320px,88vw)!important;z-index:105;transform:translateX(105%);transition:transform .2s ease;visibility:hidden;overflow:auto!important;box-shadow:-12px 0 40px #0008}
 body.cax-mobile-members-open .memberlist{transform:translateX(0);visibility:visible}
 .chat{min-height:0}
 .messages{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:10px 8px!important}
 .composer{flex-shrink:0;display:flex!important;align-items:center;gap:6px!important;padding:8px!important;padding-bottom:max(8px,env(safe-area-inset-bottom))!important;min-width:0}
 .composer #messageInput,.composer input[type=text]{flex:1 1 0!important;min-width:0!important;width:0!important;font-size:16px!important;min-height:44px}
 .composer button{flex:0 0 auto;min-width:40px;min-height:44px;padding:8px!important}
 .settings{width:100%!important;min-width:0!important;max-width:100%!important;padding:12px!important;overflow-x:hidden;overflow-y:auto}
 .settings .pane,.settings form,.settings input,.settings textarea,.settings select{max-width:100%;min-width:0}
 .settings .row{flex-wrap:wrap}
 .settings table{display:block;max-width:100%;overflow-x:auto}
 .modal{max-width:calc(100vw - 20px)!important;max-height:calc(100dvh - 24px)!important;overflow-y:auto}
}
@media(max-width:560px){
 .layout>.sidebar{left:0!important;width:min(320px,88vw)!important;transform:translateX(-105%)}
 body.cax-mobile-nav-open .layout>.sidebar{transform:translateX(0)}
}
@media(prefers-reduced-motion:reduce){.layout>.sidebar,.memberlist{transition:none!important}}

/* Multiline channel and direct-message composer */
.composer textarea{flex:1 1 0;min-width:0;width:100%;height:44px;min-height:44px;max-height:180px;resize:none;overflow-y:auto;padding:11px 12px;font:inherit;font-size:14px;line-height:1.4;border-radius:10px;box-sizing:border-box;white-space:pre-wrap}
.composer textarea:focus{outline-offset:1px}
.cax-code-wrap,.cax-table-scroll{max-width:100%;overflow-x:auto}
.message .body{white-space:normal;overflow-wrap:anywhere}
@media(max-width:760px){.composer textarea{font-size:16px!important;min-height:44px;flex:1 1 0!important;width:0!important;min-width:0!important}}
