/**
 * Suite Chat — component styles.
 *
 * Ported from WH Style Guide Appendix A8 (the kynd-notes team-chat CSS),
 * generalized and re-prefixed `.sc-*`. Tokens live on the wrapper (never :root),
 * per Style Guide §8. Icons are Tabler outline. No drop shadows on bubbles/cards
 * beyond the modal. iMessage-style 2/3-width bubbles; the offset carries meaning.
 */

.sc-chat {
	--sc-navy: #1D3040;
	--sc-blue800: #1D4A60;
	--sc-blue600: #347EA0;
	--sc-primary: #439BC0;
	--sc-blue200: #B3DDE9;
	--sc-blue100: #D9EFF5;
	--sc-bluelight: #F4FBFC;
	--sc-body: #5A6A7A;
	--sc-meta: #8A9BAB;
	--sc-border: #D0DCE6;
	--sc-alt: #F7FAFB;
	--sc-red: #E24B4A;
	--sc-teal: #1EC1A1;
	--sc-blue600: #347EA0;
	--sc-scope: #439BC0; /* overridden inline per object type */

	margin-top: 22px;
	border-top: 1px solid var(--sc-border);
	padding-top: 14px;
	font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
	color: var(--sc-body);
}

.sc-ico { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.sc-chat-eyebrow {
	display: flex; align-items: center; gap: 6px;
	font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
	color: var(--sc-meta); margin-bottom: 10px;
}
.sc-chat-eyebrow .sc-ico { width: 13px; height: 13px; }

.sc-chat-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; padding: 2px 0; }

.sc-msg {
	position: relative;
	/* Others' messages: neutral. Mine (below): blue tint. The color encodes sender. */
	background: var(--sc-alt); border: 1px solid var(--sc-border);
	border-radius: 10px; padding: 10px 12px;
	width: 66.666%; max-width: 66.666%; align-self: flex-start;
}
.sc-msg.is-mine { align-self: flex-end; background: var(--sc-bluelight); border-color: var(--sc-blue200); }

.sc-msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.sc-avatar {
	width: 24px; height: 24px; border-radius: 999px; flex: none;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--sc-blue100); color: var(--sc-blue800); font-size: 11px; font-weight: 700;
}
.sc-avatar-img { object-fit: cover; }
.sc-msg-name { font-size: 13px; font-weight: 700; color: var(--sc-navy); }
.sc-msg-time { font-size: 12px; color: var(--sc-meta); flex: 1; }
.sc-msg-x, .sc-msg-edit {
	border: 0; background: none; color: var(--sc-meta); cursor: pointer; padding: 2px;
	border-radius: 6px; display: inline-flex; opacity: 0; transition: opacity .15s ease;
}
.sc-msg:hover .sc-msg-x, .sc-msg:focus-within .sc-msg-x,
.sc-msg:hover .sc-msg-edit, .sc-msg:focus-within .sc-msg-edit { opacity: 1; }
.sc-msg-x:hover { color: var(--sc-red); background: #fdf1f1; }
.sc-msg-edit:hover { color: var(--sc-blue600); background: var(--sc-bluelight); }
@media (hover: none) { .sc-msg-x, .sc-msg-edit { opacity: 1; } }

.sc-msg-body { font-size: 14px; color: var(--sc-body); overflow-wrap: break-word; line-height: 1.42; }
.sc-mention { background: var(--sc-blue100); color: var(--sc-blue800); border-radius: 6px; padding: 1px 5px; font-weight: 700; }

/* Inline edit (roadmap #8) — the body becomes a small editor. */
.sc-msg-editinput {
	width: 100%; box-sizing: border-box; border: 1px solid var(--sc-border); background: #fff;
	border-radius: 8px; resize: vertical; outline: none;
	font-family: inherit; font-size: 14px; color: var(--sc-navy);
	padding: 8px 10px; min-height: 40px; line-height: 1.4;
}
.sc-msg-editinput:focus { border-color: var(--sc-primary); }
.sc-msg-editrow { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.sc-msg-editrow .sc-btn { height: 30px; padding: 0 12px; font-size: 12px; }

/* Reactions (roadmap #5) — a chip bar under each bubble. The bar reserves NO space
   when empty; the add-react button floats (absolute) so it never pads the bubble. */
.sc-reactions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
/* Snug to the text above; a little breathing room around the reaction below. */
.sc-reactions.has-reactions { margin-top: 3px; margin-bottom: 3px; }
.sc-reaction {
	display: inline-flex; align-items: center; gap: 2px; cursor: pointer;
	border: 1px solid var(--sc-border); background: #fff; border-radius: 999px;
	padding: 1px 6px 1px 5px; font-family: inherit; font-size: 8.5px; line-height: 1.5; color: var(--sc-body);
}
.sc-reaction:hover { background: var(--sc-alt); }
.sc-reaction.mine { background: var(--sc-blue100); border-color: var(--sc-blue200); color: var(--sc-blue800); font-weight: 700; }
.sc-reaction-emo { font-size: 9px; display: inline-flex; align-items: center; }
.sc-reaction-n { font-size: 8.5px; }
/* WP/BuddyBoss replaces the emoji glyph with an <img class="emoji"> (24×24), so
   font-size can't shrink it — size the image directly, beating the theme's
   global `img.emoji { width:24px }` rule. */
.sc-reaction-emo img.emoji { width: 16px !important; height: 16px !important; margin: 0 !important; vertical-align: middle; }
/* Same substitution happens in the picker; keep those a touch larger. */
.sc-react-opt img.emoji { width: 18px !important; height: 18px !important; margin: 0 !important; vertical-align: middle; }
/* Hover tool strip — a Slack-style floating toolbar that straddles the bubble's
   bottom-right edge. Out of flow (a reaction-less message has no trailing gap).
   Holds the add-react button today; more per-message actions can drop in later. */
.sc-msg-tools {
	position: absolute; bottom: 6px; right: 8px; z-index: 3;
	display: flex; align-items: center; gap: 1px; padding: 2px;
	background: #fff; border: 1px solid var(--sc-border); border-radius: 999px;
	box-shadow: 0 2px 8px rgba(29,48,64,.16);
	opacity: 0; transition: opacity .12s ease;
}
.sc-msg:hover .sc-msg-tools, .sc-msg:focus-within .sc-msg-tools { opacity: 1; }
@media (hover: none) { .sc-msg-tools { opacity: 1; } }
.sc-react-add {
	display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
	width: 22px; height: 22px; padding: 0; border: 0; border-radius: 999px;
	background: none; color: var(--sc-meta);
}
.sc-react-add .sc-ico { width: 15px; height: 15px; }
.sc-react-add:hover { color: var(--sc-blue600); background: var(--sc-bluelight); }

/* Emoji palette — fixed menu, like the mention/actions menus. */
.sc-react-palette {
	position: fixed; z-index: 100000; display: flex; gap: 2px;
	background: #fff; border: 1px solid var(--sc-border); border-radius: 999px;
	box-shadow: 0 8px 24px rgba(29,48,64,.16); padding: 4px 6px;
}
.sc-react-opt {
	border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1;
	padding: 4px 5px; border-radius: 8px;
}
.sc-react-opt:hover { background: var(--sc-bluelight); }

.sc-chat-empty {
	font-size: 13px; color: var(--sc-meta);
	background: var(--sc-alt); border: 1px solid var(--sc-border);
	border-radius: 10px; padding: 12px 14px;
}

/* Merged read-only history: one continuous thread, not a separate chat. */
.sc-chat-histcap { align-self: center; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sc-meta); padding: 2px 0 4px; }
.sc-chat-divider { align-self: stretch; height: 1px; background: var(--sc-border); margin: 6px 8%; }
.sc-msg.is-history { opacity: .9; }

/* Composer — always open (Appendix A3). Clean white field, no tint. */
.sc-chat-composer {
	display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; position: relative;
}
.sc-chat-input {
	flex: 1; box-sizing: border-box; border: 1px solid var(--sc-border); background: #fff;
	border-radius: 10px; resize: none; outline: none;
	font-family: inherit; font-size: 14px; color: var(--sc-navy);
	padding: 10px 46px 10px 12px; min-height: 42px; max-height: 120px; line-height: 1.4;
}
.sc-chat-input:focus { border-color: var(--sc-primary); }
.sc-post {
	display: inline-flex; align-items: center; gap: 6px; flex: none;
	height: 42px; padding: 0 14px; border: 0; border-radius: 8px; cursor: pointer;
	background: var(--sc-primary); color: #fff; font-family: inherit; font-size: 12.5px; font-weight: 700;
}
.sc-post .sc-ico { width: 15px; height: 15px; stroke: #fff; }
.sc-post:disabled { opacity: .45; cursor: default; }
/* Icon-only variant (roadmap #2), embedded INSIDE the input (iMessage-style): a
 * borderless send tucked into the field's bottom-right — quiet until you type, and
 * clearly not a matching block next to the New-message button. */
.sc-post--icon {
	position: absolute; right: 6px; bottom: 6px; width: 32px; height: 32px;
	padding: 0; gap: 0; justify-content: center; border-radius: 8px;
	background: transparent; color: var(--sc-primary);
}
.sc-post--icon .sc-ico { width: 18px; height: 18px; stroke: var(--sc-primary); }
.sc-post--icon:hover:not(:disabled) { background: var(--sc-blue100); }
.sc-post--icon:disabled { opacity: 1; }
.sc-post--icon:disabled .sc-ico { stroke: var(--sc-meta); }

/* @mention autocomplete — fixed-position menu above the composer (Appendix A4). */
.sc-mention-menu {
	position: fixed; z-index: 100000; min-width: 220px; max-width: 300px;
	background: #fff; border: 1px solid var(--sc-border); border-radius: 12px;
	box-shadow: 0 8px 24px rgba(29,48,64,.16); overflow: hidden; padding: 4px;
}
.sc-mention-item {
	display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; cursor: pointer;
	font-size: 13px; color: var(--sc-navy);
}
.sc-mention-item.is-active, .sc-mention-item:hover { background: var(--sc-bluelight); }
.sc-mention-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* People who can't view this record sort last and read muted, with a tag. */
.sc-mention-item.sc-mention-noaccess { color: var(--sc-meta); }
.sc-mention-item.sc-mention-noaccess .sc-avatar { opacity: .55; }
.sc-mention-tag { flex: none; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--sc-meta); border: 1px solid var(--sc-border); border-radius: 999px; padding: 1px 6px; }

/* Native (in-app) delete confirm modal — never window.confirm(). */
.sc-modal-overlay {
	position: fixed; inset: 0; z-index: 100001;
	background: rgba(29,48,64,.38); display: flex; align-items: center; justify-content: center; padding: 20px;
}
.sc-modal {
	background: #fff; border-radius: 16px; border: 1px solid var(--sc-border);
	box-shadow: 0 20px 50px rgba(29,48,64,.24);
	width: 100%; max-width: 380px; padding: 22px;
}
.sc-modal h3 { margin: 0 0 6px; font-size: 17px; font-weight: 800; color: var(--sc-navy); }
.sc-modal p { margin: 0 0 18px; font-size: 13.5px; color: var(--sc-body); line-height: 1.5; }
.sc-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sc-btn {
	height: 38px; padding: 0 16px; border-radius: 8px; cursor: pointer;
	font-family: inherit; font-size: 13px; font-weight: 700; border: 1px solid transparent;
}
.sc-btn--ghost { background: #fff; color: var(--sc-body); border-color: var(--sc-border); }
.sc-btn--danger { background: var(--sc-red); color: #fff; }

/* Header row: eyebrow + Start Huddle button */
.sc-chat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sc-chat-head .sc-chat-eyebrow { margin-bottom: 0; }
.sc-huddle-btn {
	margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
	height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer;
	background: var(--sc-primary); color: #fff; border: 0;
	font-family: inherit; font-size: 12px; font-weight: 700;
}
.sc-huddle-btn .sc-ico { stroke: #fff; width: 15px; height: 15px; }
.sc-huddle-btn:disabled { opacity: .5; cursor: default; }

/* Huddle "Join my huddle" card */
.sc-callcard {
	align-self: center; width: 78%; max-width: 78%;
	display: flex; align-items: center; gap: 12px;
	background: var(--sc-bluelight); border: 1px solid var(--sc-blue200);
	border-radius: 12px; padding: 12px 14px;
}
.sc-callcard-ic {
	width: 38px; height: 38px; border-radius: 10px; flex: none;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--sc-blue100); color: var(--sc-blue600);
}
.sc-callcard-ic .sc-ico { width: 20px; height: 20px; }
.sc-callcard-t { flex: 1; min-width: 0; }
.sc-callcard-title { font-size: 13.5px; font-weight: 700; color: var(--sc-navy); }
.sc-callcard-sub { font-size: 12px; color: var(--sc-meta); margin-top: 1px; }
.sc-join {
	flex: none; display: inline-flex; align-items: center;
	height: 34px; padding: 0 16px; border-radius: 8px;
	background: var(--sc-teal); color: #fff; text-decoration: none;
	font-size: 12.5px; font-weight: 700;
}

/* Actions button (header) — outline, sits with the Huddle button. */
.sc-actions-btn {
	margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
	height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer;
	background: #fff; color: var(--sc-blue600); border: 1px solid var(--sc-blue200);
	font-family: inherit; font-size: 12px; font-weight: 700;
}
.sc-actions-btn .sc-ico { width: 15px; height: 15px; }
.sc-actions-btn:hover { background: var(--sc-bluelight); }
/* When Actions is followed by Huddle, only the first (Actions) claims the auto margin. */
.sc-actions-btn + .sc-huddle-btn { margin-left: 8px; }

/* Actions dropdown menu (fixed, like the mention menu). */
.sc-actions-menu {
	position: fixed; z-index: 100000; min-width: 200px;
	background: #fff; border: 1px solid var(--sc-border); border-radius: 12px;
	box-shadow: 0 8px 24px rgba(29,48,64,.16); overflow: hidden; padding: 4px;
}
.sc-actions-item {
	display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
	cursor: pointer; font-size: 13px; font-weight: 600; color: var(--sc-navy);
}
.sc-actions-item:hover { background: var(--sc-bluelight); }
.sc-actions-item-ic {
	width: 26px; height: 26px; border-radius: 7px; flex: none;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--sc-blue100); color: var(--sc-blue600);
}
.sc-actions-item-ic .sc-ico { width: 15px; height: 15px; }

/* Create-window (email-style form modal) — reuses .sc-modal shell. */
.sc-form { max-width: 440px; text-align: left; }
.sc-form-field { margin-bottom: 14px; }
.sc-form-label { display: block; font-size: 12px; font-weight: 700; color: var(--sc-navy); margin-bottom: 5px; }
.sc-form-input {
	width: 100%; box-sizing: border-box; border: 1px solid var(--sc-border); border-radius: 8px;
	padding: 9px 11px; font-family: inherit; font-size: 14px; color: var(--sc-navy);
	background: #fff; outline: none; resize: vertical;
}
.sc-form-input:focus { border-color: var(--sc-primary); }
select.sc-form-input { height: 38px; }
.sc-form-err { font-size: 12.5px; font-weight: 600; color: var(--sc-red); margin: -4px 0 12px; }
.sc-btn--primary { background: var(--sc-primary); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.sc-form-ok { width: 46px; height: 46px; border-radius: 999px; background: var(--sc-blue100); color: var(--sc-blue600); display: flex; align-items: center; justify-content: center; margin: 4px auto 10px; }
.sc-form-ok .sc-ico { width: 24px; height: 24px; stroke-width: 2.2; }
.sc-form-oktitle { text-align: center; }

/* Action confirmation card (like the huddle card, teal "Open"). */
.sc-actioncard {
	align-self: center; width: 78%; max-width: 78%;
	display: flex; align-items: center; gap: 12px;
	background: var(--sc-bluelight); border: 1px solid var(--sc-blue200);
	border-radius: 12px; padding: 12px 14px;
}
.sc-actioncard-ic {
	width: 38px; height: 38px; border-radius: 10px; flex: none;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--sc-blue100); color: var(--sc-blue600);
}
.sc-actioncard-ic .sc-ico { width: 20px; height: 20px; }
.sc-open {
	flex: none; display: inline-flex; align-items: center; gap: 6px;
	height: 34px; padding: 0 14px; border-radius: 8px;
	background: var(--sc-teal); color: #fff; text-decoration: none;
	font-size: 12.5px; font-weight: 700;
}
.sc-open .sc-ico { width: 15px; height: 15px; stroke: #fff; }

@media (max-width: 640px) {
	.sc-msg { width: 82%; max-width: 82%; }
	.sc-callcard { width: 100%; max-width: 100%; }
	.sc-actioncard { width: 100%; max-width: 100%; }
}

/* ==================================================================
 * Huddle "ring" popup — a non-blocking bottom-right card that rings
 * when a huddle starts. Rendered on document.body (not inside .sc-chat),
 * so it carries its own tokens. Full card → collapses to a pill at ~10s.
 * ================================================================== */
.sc-ring {
	--r-navy: #1D3040; --r-blue800: #1D4A60; --r-blue600: #347EA0;
	--r-blue100: #D9EFF5; --r-body: #5A6A7A; --r-meta: #8A9BAB;
	--r-border: #D0DCE6; --r-alt: #F7FAFB; --r-teal: #1EC1A1;
	position: fixed; right: 18px; bottom: 18px; width: 320px; z-index: 2147483000;
	background: #fff; border: 1px solid var(--r-border); border-radius: 16px;
	box-shadow: 0 16px 40px rgba(29,48,64,.24); padding: 16px;
	font-family: 'DM Sans', system-ui, -apple-system, sans-serif; color: var(--r-body);
	animation: sc-ring-pop .28s cubic-bezier(.2,.8,.2,1.2), sc-ring-nudge 2.2s ease-in-out .4s infinite;
}
@keyframes sc-ring-pop { from { transform: translateY(14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sc-ring-nudge { 0%,92%,100% { transform: none; } 94% { transform: translateX(-2px); } 96% { transform: translateX(2px); } 98% { transform: translateX(-1px); } }
.sc-ring.is-out { animation: none; opacity: 0; transform: translateY(10px); transition: opacity .18s, transform .18s; }

.sc-ring svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }

.sc-ring-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sc-ring-ic { width: 26px; height: 26px; border-radius: 8px; flex: none; background: var(--r-blue100); color: var(--r-blue600); display: inline-flex; align-items: center; justify-content: center; }
.sc-ring-ic svg { width: 15px; height: 15px; stroke-width: 1.8; }
.sc-ring-label { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--r-meta); }
.sc-ring-mute, .sc-ring-x { border: 0; background: none; color: var(--r-meta); cursor: pointer; border-radius: 6px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.sc-ring-mute { margin-left: auto; }
.sc-ring-mute svg { width: 16px; height: 16px; stroke-width: 1.7; }
.sc-ring-x svg { width: 15px; height: 15px; stroke-width: 1.9; }
.sc-ring-x .sc-ico { width: 15px; height: 15px; }
.sc-ring-mute:hover, .sc-ring-x:hover { background: var(--r-alt); color: var(--r-navy); }
.sc-ring-mute.is-muted { color: var(--r-navy); }

.sc-ring-mid { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sc-ring-av-wrap { position: relative; flex: none; width: 46px; height: 46px; }
.sc-ring-av { width: 46px; height: 46px; border-radius: 999px; background: var(--r-blue100); color: var(--r-blue800); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; position: relative; z-index: 2; }
.sc-ring-av-img { object-fit: cover; }
.sc-ring-pulse, .sc-ring-pulse2 { position: absolute; inset: 0; border-radius: 999px; border: 2px solid var(--r-teal); opacity: .7; z-index: 1; }
.sc-ring-pulse { animation: sc-ring-ripple 1.6s ease-out infinite; }
.sc-ring-pulse2 { animation: sc-ring-ripple 1.6s ease-out infinite .8s; }
@keyframes sc-ring-ripple { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.85); opacity: 0; } }
.sc-ring-who { min-width: 0; }
.sc-ring-name { font-size: 15px; font-weight: 800; color: var(--r-navy); }
.sc-ring-desc { font-size: 12.5px; color: var(--r-body); margin-top: 2px; }
.sc-ring-thread { font-size: 12px; color: var(--r-meta); margin-top: 1px; display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-ring-thread svg { width: 12px; height: 12px; stroke-width: 1.8; flex: none; }

.sc-ring-actions { display: flex; gap: 8px; }
.sc-ring-btn { height: 40px; border-radius: 10px; border: 0; cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.sc-ring-join { flex: 1; background: var(--r-teal); color: #fff; }
.sc-ring-join svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 1.9; }
.sc-ring-dismiss { flex: none; width: 96px; background: #fff; color: var(--r-body); border: 1px solid var(--r-border); }
.sc-ring-dismiss:hover { background: var(--r-alt); }

/* Collapsed pill (after ~10s): a compact horizontal row — icon · name · Join. */
.sc-ring.is-min { width: auto; max-width: 320px; padding: 7px 8px 7px 10px; border-radius: 999px; animation: none; display: flex; flex-direction: row; align-items: center; gap: 9px; }
.sc-ring.is-min .sc-ring-label, .sc-ring.is-min .sc-ring-mute, .sc-ring.is-min .sc-ring-x, .sc-ring.is-min .sc-ring-desc, .sc-ring.is-min .sc-ring-thread, .sc-ring.is-min .sc-ring-dismiss { display: none; }
.sc-ring.is-min .sc-ring-head { margin: 0; order: 1; }
.sc-ring.is-min .sc-ring-ic { width: 22px; height: 22px; }
.sc-ring.is-min .sc-ring-ic svg { width: 13px; height: 13px; }
.sc-ring.is-min .sc-ring-mid { margin: 0; order: 2; gap: 0; }
.sc-ring.is-min .sc-ring-av-wrap { display: none; }
.sc-ring.is-min .sc-ring-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.sc-ring.is-min .sc-ring-actions { order: 3; }
.sc-ring.is-min .sc-ring-join { height: 30px; padding: 0 15px; font-size: 12.5px; border-radius: 999px; }

@media (max-width: 480px) {
	.sc-ring { left: 12px; right: 12px; width: auto; }
}

/* ==================================================================
 * Presence dots + the status setter popover (owned by the component so
 * they render on any page, like the huddle ring). The setter mounts on
 * document.body, so it carries its own tokens.
 * ================================================================== */

/* Presence dot — colour by availability; sits on an avatar's corner. State class
 * (sc-pdot--active/away/dnd/offline) is rewritten live; size uses a single dash. */
.sc-pdot {
	position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px;
	border-radius: 999px; border: 2px solid #fff; box-sizing: border-box; flex: none;
}
.sc-pdot--active { background: #1EC1A1; }
.sc-pdot--away   { background: #F5C842; }
.sc-pdot--dnd    { background: #E24B4A; }
.sc-pdot--offline{ background: #B7C3CE; }
.sc-pdot-sm { width: 9px; height: 9px; border-width: 2px; }
.sc-pdot-md { width: 11px; height: 11px; border-width: 2.5px; }

/* Avatar wrapper so a dot can hang on the corner of a bubble avatar. */
.sc-av-wrap { position: relative; display: inline-flex; flex: none; }

/* ----- the status setter popover ----- */
.sc-status-pop {
	--s-navy:#1D3040; --s-blue800:#1D4A60; --s-blue600:#347EA0; --s-primary:#439BC0;
	--s-blue100:#D9EFF5; --s-body:#5A6A7A; --s-meta:#8A9BAB; --s-border:#D0DCE6;
	--s-alt:#F7FAFB; --s-line:#E4EAEF;
	position: fixed; width: 340px; max-width: calc(100vw - 24px); z-index: 2147483000;
	background: #fff; border: 1px solid var(--s-border); border-radius: 16px;
	box-shadow: 0 18px 44px rgba(29,48,64,.26); padding: 16px;
	font-family: 'DM Sans', system-ui, -apple-system, sans-serif; color: var(--s-body);
	animation: sc-status-pop .2s cubic-bezier(.2,.8,.2,1.2);
}
@keyframes sc-status-pop { from { transform: translateY(-8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

.sc-status-id { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.sc-status-idav-wrap { position: relative; width: 44px; height: 44px; flex: none; display: inline-flex; }
.sc-status-idav { width: 44px; height: 44px; border-radius: 999px; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--s-blue100); color: var(--s-blue800); font-weight: 700; font-size: 16px; }
.sc-status-iddot { right: 0; bottom: 0; }
.sc-status-name { font-size: 15px; font-weight: 800; color: var(--s-navy); }
.sc-status-sub { font-size: 12px; color: var(--s-meta); }

.sc-status-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--s-meta); margin: 0 0 7px; }

.sc-status-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--s-border); border-radius: 10px; padding: 7px 9px; margin-bottom: 10px; }
.sc-status-emo { width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--s-alt); border: 1px solid var(--s-line); font-size: 16px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.sc-status-txt { border: 0; outline: 0; font-family: inherit; font-size: 13.5px; color: var(--s-navy); width: 100%; background: none; }
.sc-status-clrx { border: 0; background: none; color: var(--s-meta); cursor: pointer; padding: 2px; display: inline-flex; flex: none; }
.sc-status-clrx .sc-ico { width: 15px; height: 15px; }

.sc-status-tray { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; }
.sc-status-trayemo { width: 34px; height: 34px; border: 1px solid var(--s-line); background: #fff; border-radius: 9px; font-size: 17px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.sc-status-trayemo:hover { background: var(--s-alt); }

.sc-status-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sc-status-preset { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--s-border); background: #fff; border-radius: 999px; padding: 5px 11px; font-family: inherit; font-size: 12px; color: var(--s-navy); cursor: pointer; }
.sc-status-preset:hover { background: var(--s-alt); }
.sc-status-preset-emo { font-size: 13px; line-height: 1; }

.sc-status-avail { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.sc-status-avrow { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; cursor: pointer; }
.sc-status-avrow:hover { background: var(--s-alt); }
.sc-status-avrow.sel { background: var(--s-blue100); }
/* dots inside rows sit inline, not corner-anchored */
.sc-status-avdot { position: static; border: 0; width: 11px; height: 11px; }
/* Label + helper stacked, each on one line (label like "Do Not Disturb" no longer wraps). */
.sc-status-avtext { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.sc-status-avlbl { font-size: 13px; color: var(--s-navy); font-weight: 600; white-space: nowrap; }
.sc-status-avdesc { font-size: 11.5px; color: var(--s-meta); white-space: nowrap; margin-top: 1px; }
.sc-status-avchk { width: 16px; height: 16px; color: var(--s-blue600); flex: none; opacity: 0; display: inline-flex; }
.sc-status-avrow.sel .sc-status-avchk { opacity: 1; }
.sc-status-avrow:not(.sel) .sc-status-avdesc + .sc-status-avchk,
.sc-status-avrow:not(.sel) .sc-status-avchk { opacity: 0; }
.sc-status-avrow .sc-status-avchk .sc-ico { width: 16px; height: 16px; stroke-width: 2.2; }
.sc-status-avrow.sel:not(:has(.sc-status-avdesc)) .sc-status-avlbl { margin-right: auto; }

.sc-status-clearafter { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--s-border); border-radius: 10px; padding: 7px 12px; margin-bottom: 16px; }
.sc-status-ca-lbl { font-size: 12.5px; color: var(--s-body); }
.sc-status-ca-sel { border: 0; background: none; font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--s-navy); cursor: pointer; text-align: right; }
.sc-status-ca-sel:focus { outline: none; }

.sc-status-actions { display: flex; gap: 8px; }
/* The popover lives on document.body, outside .sc-chat, so the .sc-btn variants'
 * --sc-* tokens are undefined here (that made "Set status" white-on-white). Give the
 * buttons explicit colours from the popover's own --s-* tokens. */
.sc-status-actions .sc-btn { flex: 1; height: 40px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.sc-status-actions .sc-btn--primary { background: var(--s-primary); color: #fff; border: 0; }
.sc-status-actions .sc-btn--primary:hover { background: var(--s-blue600); }
.sc-status-actions .sc-btn--ghost { flex: none; width: 92px; background: #fff; color: var(--s-body); border: 1px solid var(--s-border); }
.sc-status-actions .sc-btn--ghost:hover { background: var(--s-alt); }
.sc-status-foot { font-size: 11px; color: var(--s-meta); margin-top: 11px; line-height: 1.45; }

/* ==================================================================
 * Composer add-ons — rich-text toolbar (#4), emoji + GIF pickers, and
 * file attachments (#6). The toolbar + pending box are inserted ABOVE the
 * existing .sc-chat-composer (which the app + mini re-style), so that row
 * is never disturbed. Pickers mount on document.body, so they carry tokens.
 * ================================================================== */

/* Rich-text body rendering (server emits a safe HTML subset). */
.sc-msg-body strong { font-weight: 800; color: var(--sc-navy); }
.sc-msg-body em { font-style: italic; }
.sc-msg-body del { text-decoration: line-through; color: var(--sc-meta); }
.sc-msg-body code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px;
	background: var(--sc-blue100); border: 1px solid var(--sc-blue200); border-radius: 5px; padding: 0 4px;
}
.sc-msg-body pre {
	background: var(--sc-navy); color: #EAF2F7; border-radius: 9px; padding: 9px 11px; margin: 5px 0;
	overflow-x: auto; font-size: 12.5px; line-height: 1.5;
}
.sc-msg-body pre code { background: none; border: 0; padding: 0; color: inherit; font-size: 12.5px; }
.sc-msg-body ul, .sc-msg-body ol { margin: 4px 0; padding-left: 20px; }
.sc-msg-body li { margin: 1px 0; }
.sc-msg-body blockquote {
	margin: 4px 0; padding: 2px 10px; border-left: 3px solid var(--sc-blue200); color: var(--sc-body);
}
.sc-msg-body a { color: var(--sc-blue600); text-decoration: none; font-weight: 600; }
.sc-msg-body a:hover { text-decoration: underline; }

/* Tools group wrapper — owns the divider ABOVE the toolbar (matches the wireframe).
 * In the Chat app the composer field draws its own top border; suppress that when a
 * toolbar precedes it so the divider isn't doubled below the toolbar. */
/* flex:none so the tools group always reserves its full height in the app/mini flex
 * column — otherwise it can shrink and the message stream overlaps it (last message
 * hidden behind the toolbar/composer). */
.sc-compose-toolbar-wrap { border-top: 1px solid var(--sc-border); margin-top: 12px; padding-top: 8px; flex: none; }
.sc-compose-preview { flex: none; }
.sc-compose-toolbar-wrap + .sc-chat-composer { margin-top: 6px; }
.sc-app-dbody .sc-compose-toolbar-wrap + .sc-chat-composer,
.sc-mini-wbody .sc-compose-toolbar-wrap + .sc-chat-composer { border-top: 0; padding-top: 4px; margin-top: 2px; }

/* The format toolbar row. */
.sc-compose-tools {
	display: flex; align-items: center; gap: 1px; flex-wrap: wrap; margin: 0;
}
/* GIF button — a small text badge (no clean outline glyph exists for "GIF"). */
.sc-tb-gif { padding: 0 5px; }
.sc-tb-gifbadge {
	display: inline-flex; align-items: center; justify-content: center;
	font-size: 9px; font-weight: 800; letter-spacing: .03em; line-height: 1;
	padding: 3px 4px; border: 1.5px solid currentColor; border-radius: 5px; color: inherit;
}

/* Live rich-text preview (below the toolbar, above the field). */
.sc-compose-preview { margin-top: 8px; padding: 8px 11px; border: 1px solid var(--sc-border); border-radius: 10px; background: var(--sc-alt); }
.sc-compose-preview-lbl { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--sc-meta); margin-bottom: 4px; }
.sc-compose-preview-body { font-size: 13.5px; color: var(--sc-body); line-height: 1.42; overflow-wrap: break-word; }
.sc-compose-preview-body > :first-child { margin-top: 0; }
.sc-compose-preview-body > :last-child { margin-bottom: 0; }
.sc-tb {
	display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
	min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid transparent; border-radius: 7px;
	background: none; color: var(--sc-body); font-family: inherit; font-size: 13px; line-height: 1;
}
.sc-tb:hover { background: var(--sc-alt); color: var(--sc-navy); }
.sc-tb[aria-expanded="true"] { background: var(--sc-blue100); color: var(--sc-blue800); border-color: var(--sc-blue200); }
.sc-tb .sc-ico { width: 17px; height: 17px; }
.sc-tb-strong { font-weight: 800; }
.sc-tb-em { font-style: italic; font-family: Georgia, 'Times New Roman', serif; }
.sc-tb-strike { text-decoration: line-through; }
.sc-tb-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.sc-tb-quote { font-size: 18px; }
.sc-tb-sep { width: 1px; height: 18px; background: var(--sc-border); margin: 0 5px; flex: none; }
.sc-tb-attach { margin-left: 2px; }

/* Pending-upload chips (above the toolbar, inside the tools wrapper). */
.sc-compose-pending { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.sc-att-chip {
	display: flex; align-items: center; gap: 8px; max-width: 230px;
	background: var(--sc-alt); border: 1px solid var(--sc-border); border-radius: 9px; padding: 5px 8px;
}
.sc-att-chip-th {
	width: 30px; height: 30px; border-radius: 6px; flex: none; overflow: hidden;
	background: var(--sc-blue100); display: inline-flex; align-items: center; justify-content: center;
	color: var(--sc-blue800); font-size: 9px; font-weight: 800;
}
.sc-att-chip-th img { width: 100%; height: 100%; object-fit: cover; }
.sc-att-chip-th.is-file { background: var(--sc-blue100); }
.sc-att-chip-meta { min-width: 0; display: flex; flex-direction: column; }
.sc-att-chip-name { font-size: 12px; font-weight: 700; color: var(--sc-navy); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-att-chip-size { font-size: 10.5px; color: var(--sc-meta); }
.sc-att-chip-x { border: 0; background: none; color: var(--sc-meta); cursor: pointer; padding: 2px; display: inline-flex; flex: none; border-radius: 5px; }
.sc-att-chip-x:hover { color: var(--sc-red); background: #fdf1f1; }
.sc-att-chip-x .sc-ico { width: 13px; height: 13px; }
.sc-att-chip.is-loading .sc-att-chip-th { background: var(--sc-blue100); animation: sc-att-pulse 1s ease-in-out infinite; }
@keyframes sc-att-pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

/* Drag-over affordance on the whole thread. */
.sc-chat.sc-dragover { outline: 2px dashed var(--sc-primary); outline-offset: 4px; border-radius: 12px; }

/* Sent attachments in bubbles. */
.sc-atts { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.sc-att-img { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--sc-border); max-width: 260px; }
.sc-att-img img { display: block; width: 100%; height: auto; }
.sc-att-file {
	display: flex; align-items: center; gap: 9px; max-width: 280px; text-decoration: none;
	background: #fff; border: 1px solid var(--sc-border); border-radius: 10px; padding: 8px 11px;
}
.sc-att-file:hover { background: var(--sc-alt); }
.sc-att-file-ic {
	width: 30px; height: 34px; border-radius: 5px; flex: none; background: var(--sc-blue100);
	border: 1px solid var(--sc-blue200); display: inline-flex; align-items: center; justify-content: center;
	color: var(--sc-blue800); font-size: 8.5px; font-weight: 800; letter-spacing: .02em;
}
.sc-att-file-meta { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.sc-att-file-name { font-size: 12.5px; font-weight: 700; color: var(--sc-navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-att-file-size { font-size: 11px; color: var(--sc-meta); }
.sc-att-file-dl { color: var(--sc-meta); flex: none; display: inline-flex; }
.sc-att-file:hover .sc-att-file-dl { color: var(--sc-blue600); }

/* GIF message media (in a bubble). */
.sc-msg.is-gif { padding: 6px; }
.sc-gif-media { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--sc-border); }
.sc-gif-media img, .sc-gif-media video { display: block; width: 100%; height: auto; }
.sc-gif-mediamark {
	position: absolute; left: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px;
	background: rgba(29,48,64,.72); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .02em;
	padding: 2px 6px; border-radius: 4px;
}
.sc-gif-mark { color: #1EC1A1; font-size: 8px; }

/* ----- shared compose popover (emoji + gif), body-mounted ----- */
.sc-cpop {
	--sc-navy: #1D3040; --sc-blue800: #1D4A60; --sc-blue600: #347EA0; --sc-primary: #439BC0;
	--sc-blue200: #B3DDE9; --sc-blue100: #D9EFF5; --sc-bluelight: #F4FBFC; --sc-body: #5A6A7A;
	--sc-meta: #8A9BAB; --sc-border: #D0DCE6; --sc-alt: #F7FAFB;
	position: fixed; z-index: 2147483000; background: #fff; border: 1px solid var(--sc-border);
	border-radius: 14px; box-shadow: 0 14px 40px rgba(29,48,64,.20); padding: 10px;
	font-family: 'DM Sans', system-ui, -apple-system, sans-serif; color: var(--sc-body);
	animation: sc-cpop-in .16s cubic-bezier(.2,.8,.2,1.2);
}
@keyframes sc-cpop-in { from { transform: translateY(6px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.sc-cpop-search {
	width: 100%; box-sizing: border-box; border: 1px solid var(--sc-border); background: var(--sc-alt);
	border-radius: 8px; padding: 7px 10px; font-family: inherit; font-size: 13px; color: var(--sc-navy);
	outline: none; margin-bottom: 8px;
}
.sc-cpop-search:focus { border-color: var(--sc-primary); background: #fff; }
.sc-cpop-empty, .sc-cpop-loading { font-size: 12.5px; color: var(--sc-meta); text-align: center; padding: 18px 0; }

/* emoji picker */
.sc-emoji-pop { width: 300px; }
.sc-emoji-scroll { max-height: 250px; overflow-y: auto; }
.sc-emoji-cat { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--sc-meta); padding: 6px 2px 3px; }
.sc-emoji-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.sc-emoji-cell { border: 0; background: none; cursor: pointer; font-size: 20px; line-height: 1; padding: 5px 0; border-radius: 7px; }
.sc-emoji-cell:hover { background: var(--sc-bluelight); }
.sc-emoji-cell img.emoji { width: 20px !important; height: 20px !important; margin: 0 !important; vertical-align: middle; }

/* gif picker */
.sc-gif-pop { width: 300px; }
.sc-gif-scroll { max-height: 280px; overflow-y: auto; }
.sc-gif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sc-gif-cell { border: 0; padding: 0; cursor: pointer; border-radius: 8px; overflow: hidden; background: var(--sc-alt); min-height: 70px; }
.sc-gif-cell img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sc-gif-cell:hover { outline: 2px solid var(--sc-primary); }
.sc-gif-attrib { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 10px; color: var(--sc-meta); padding: 7px 0 2px; letter-spacing: .02em; }
.sc-gif-attrib .sc-gif-mark { color: #1EC1A1; }

/* ==================================================================
 * Mobile: the body-mounted popovers (status setter + the shared emoji/
 * GIF compose popovers) dock to the bottom as sheets. The component's JS
 * still sets inline position:fixed + top/left; the !important rules here
 * override that inline positioning at the phone breakpoint. Reaction
 * palette stays anchored (a 6-emoji pill doesn't warrant a sheet).
 * ================================================================== */
@media (max-width: 720px) {
	.sc-status-pop, .sc-cpop {
		left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
		width: 100% !important; max-width: none !important;
		border-radius: 18px 18px 0 0 !important;
		padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
		box-shadow: 0 -14px 44px rgba(29, 48, 64, .26) !important;
		animation: sc-sheet-up-c .28s cubic-bezier(.2, .8, .2, 1) !important;
	}
	/* Drag grip above the sheet content. */
	.sc-status-pop::before, .sc-cpop::before {
		content: ""; display: block; width: 40px; height: 4px; border-radius: 999px;
		background: #D0DCE6; margin: 0 auto 12px;
	}
	/* Give the pickers more room on a phone. */
	.sc-emoji-scroll { max-height: 46vh; }
	.sc-emoji-grid { grid-template-columns: repeat(8, 1fr); }
	.sc-gif-scroll { max-height: 50vh; }
	.sc-emoji-pop, .sc-gif-pop { width: auto; }
	/* Inputs ≥16px so iOS doesn't zoom on focus. */
	.sc-status-pop input, .sc-status-pop textarea, .sc-cpop input, .sc-cpop textarea { font-size: 16px; }
}
@keyframes sc-sheet-up-c { from { transform: translateY(100%); } to { transform: none; } }
