/**
 * BuddyPress Contact Me: public styles.
 *
 * Token-based, BEM-ish. Loads on the Contact tab, BP Settings and pages
 * with the [buddypress-contact-me] shortcode. Colours chain to the BuddyX /
 * Reign tokens with literal fallbacks for any other theme.
 */

:root {
	--bcm-radius: 10px;
	--bcm-radius-sm: 6px;
	--bcm-gap: 16px;
	--bcm-gap-sm: 8px;
	--bcm-gap-lg: 24px;

	/* Semantic colours — adopt the host theme's own tokens first (BuddyX 5.1
	 * --bx-color-*, then Reign --reign-*), falling back to the plugin's
	 * literal palette so unstyled / classic themes still look right. */
	--bcm-color-border: var(--bx-color-border, var(--reign-site-border-color, #e1e5ea ) );
	--bcm-color-border-strong: var(--bx-color-border, var(--reign-site-border-color, #c7ced6 ) );
	--bcm-color-bg: var(--bx-color-bg-page, var(--reign-site-body-bg-color, #ffffff ) );
	--bcm-color-bg-soft: var(--bx-color-bg-subtle, var(--reign-site-secondary-bg-color, #f6f7f9 ) );
	--bcm-color-surface: var(--bx-color-bg-elevated, var(--reign-site-sections-bg-color, #ffffff ) );
	--bcm-color-text: var(--bx-color-fg, var(--reign-site-body-text-color, #1e2327 ) );
	--bcm-color-text-muted: var(--bx-color-fg-muted, var(--reign-site-alternate-text-color, #5f6b77 ) );
	--bcm-color-link: var(--bx-color-link, var(--reign-site-link-color, #2271b1 ) );
	/* Primary fills use the theme's button pair so the label colour always
	 * matches the fill (BuddyX dark: light-coral fill, near-black text). */
	--bcm-color-primary: var(--bx-color-button-bg, var(--bx-color-accent, var(--reign-colors-theme, #2271b1 ) ) );
	--bcm-color-primary-hover: var(--bx-color-button-bg-hover, var(--bx-color-link-hover, var(--reign-site-link-hover-color, #135e96 ) ) );
	--bcm-color-on-primary: var(--bx-color-button-fg, #ffffff );
	/* Inverted chip (toast, tooltip): page text colour as the fill. */
	--bcm-color-inverse-bg: var(--bx-color-fg, var(--reign-site-body-text-color, #1e2327 ) );
	--bcm-color-inverse-fg: var(--bx-color-fg-inverse, #ffffff );

	/* Faint accent wash for "unread"/selected surfaces. Derived from the live
	 * accent so it follows a customised theme instead of a baked-in blue. The
	 * rgba line is the fallback for browsers without color-mix(). */
	--bcm-color-primary-soft: rgba( 34, 113, 177, 0.08 );
	--bcm-color-primary-soft: color-mix( in srgb, var( --bcm-color-primary ) 8%, transparent );

	/* Semantic status colours keep their own literal value — never chain these
	 * to the theme accent, or a red-accent theme makes "success" look like an
	 * error to non-technical users. */
	--bcm-color-danger: #d63638;
	--bcm-color-danger-hover: #b32d2e;
	--bcm-color-success: #00a32a;
	--bcm-color-warning: #dba617;
	--bcm-color-focus: var(--bx-color-accent, var(--reign-colors-theme, #2271b1 ) );
	--bcm-color-on-danger: #ffffff;

	/* Status tints for banners and hover washes, derived from the status
	 * colour so they flip with it. rgba lines are the no-color-mix fallback. */
	--bcm-color-success-soft: rgba( 0, 163, 42, 0.1 );
	--bcm-color-success-soft: color-mix( in srgb, var( --bcm-color-success ) 12%, transparent );
	--bcm-color-danger-soft: rgba( 214, 54, 56, 0.1 );
	--bcm-color-danger-soft: color-mix( in srgb, var( --bcm-color-danger ) 12%, transparent );
	--bcm-color-warning-soft: rgba( 219, 166, 23, 0.12 );
	--bcm-color-warning-soft: color-mix( in srgb, var( --bcm-color-warning ) 14%, transparent );
	--bcm-color-info-soft: rgba( 34, 113, 177, 0.1 );
	--bcm-color-info-soft: color-mix( in srgb, var( --bcm-color-primary ) 12%, transparent );

	/* QA-canonical aliases (surface / page / text) used by the dark contract. */
	--bcm-bg: var( --bcm-color-bg );
	--bcm-card-bg: var( --bcm-color-surface );
	--bcm-text: var( --bcm-color-text );

	/* Focus rings and the confirm-dialog backdrop, derived from tokens above. */
	--bcm-color-focus-ring: color-mix( in srgb, var( --bcm-color-focus ) 22%, transparent );
	--bcm-color-danger-ring: color-mix( in srgb, var( --bcm-color-danger ) 18%, transparent );
	--bcm-color-hover-wash: color-mix( in srgb, var( --bcm-color-text ) 6%, transparent );
	--bcm-color-chip: color-mix( in srgb, var( --bcm-color-text ) 10%, transparent );
	--bcm-color-overlay: rgba( 16, 24, 40, 0.55 );

	--bcm-shadow-sm: 0 1px 2px rgba( 16, 24, 40, 0.06 );
	--bcm-shadow-md: 0 8px 24px rgba( 16, 24, 40, 0.12 );
	--bcm-shadow-lg: 0 20px 50px rgba( 16, 24, 40, 0.18 );
}

/* ---------- Notices ---------- *
 *
 * Notices and toasts are BuddyPress `.bp-feedback` markup, so Nouveau and the
 * theme paint them like every other BuddyPress notice. The rules below are a
 * zero-specificity fallback for pages where nothing styles `.bp-feedback`
 * (a shortcode on a plain page).
 */
:where( .bcm-alert ) {
	display: flex;
	align-items: center;
	gap: var( --bcm-gap-sm );
	margin: 0 0 var( --bcm-gap );
	padding: 10px 15px;
	border: 1px solid var( --bcm-color-border );
	border-inline-start-width: 4px;
	border-radius: var( --bcm-radius-sm );
	background: var( --bcm-color-surface );
	color: var( --bcm-color-text );
	font-size: 14px;
	line-height: 1.5;
}

:where( .bcm-alert ) p { margin: 0; }
:where( .bcm-alert.success ) { border-inline-start-color: var( --bcm-color-success ); }
:where( .bcm-alert.error ) { border-inline-start-color: var( --bcm-color-danger ); }
:where( .bcm-alert.warning ) { border-inline-start-color: var( --bcm-color-warning ); }
:where( .bcm-alert.info ) { border-inline-start-color: var( --bcm-color-primary ); }

/* Family action toast: one at a time, bottom centre, closed by its button or Escape. */
.bcm-toast {
	position: fixed;
	inset-inline: var( --bcm-gap );
	inset-block-end: 24px;
	z-index: 100000;
	max-width: 480px;
	margin-inline: auto;
	border-radius: var( --bcm-radius-sm );
	box-shadow: var( --bcm-shadow-md );
}

.bcm-toast .bp-feedback {
	display: flex;
	align-items: center;
	gap: var( --bcm-gap-sm );
	margin: 0;
}

.bcm-toast .bp-feedback p {
	flex: 1;
	min-width: 0;
	margin: 0;
}

/* Beats `.buddypress .buddypress-wrap button` (0,2,1) so the close button is not a filled theme button. */
.bcm-toast .bp-feedback button.bcm-toast__close {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: inherit;
	cursor: pointer;
}

.bcm-toast .bp-feedback button.bcm-toast__close:hover,
.bcm-toast .bp-feedback button.bcm-toast__close:focus-visible {
	background: var( --bcm-color-hover-wash );
	color: inherit;
}

/* Keeps a text label in the accessibility tree while hiding it on screen. */
.bcm-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	clip-path: inset( 50% ) !important;
	white-space: nowrap !important;
}

/* Honeypot: off screen for people, still in the form for bots. */
.bcm-hp {
	position: absolute !important;
	inset-inline-start: -10000px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------- Contact form ---------- */

.bcm-form-wrap {
	/*
	 * Fills the theme's content column. The previous 640px cap left a
	 * big empty right column inside BuddyX / BuddyBoss / Reign profile
	 * pages because their content area is much wider (see basecamp
	 * card 9823543990). Inbox and Preferences on the same tab already
	 * fill the column — this matches that.
	 */
	padding: var( --bcm-gap-lg );
	background: var( --bcm-color-bg );
	border: 1px solid var( --bcm-color-border );
	border-radius: var( --bcm-radius );
	box-shadow: var( --bcm-shadow-sm );
}

.bcm-form__header {
	margin: 0 0 var( --bcm-gap-lg );
	padding-block-end: var( --bcm-gap );
	border-block-end: 1px solid var( --bcm-color-border );
}

.bcm-form__title {
	margin: 0 0 4px;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	color: var( --bcm-color-text );
}

.bcm-form__hint {
	margin: 0;
	font-size: 14px;
	color: var( --bcm-color-text-muted );
}

.bcm-form {
	display: flex;
	flex-direction: column;
	gap: var( --bcm-gap );
}

.bcm-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bcm-field label {
	font-size: 14px;
	font-weight: 600;
	color: var( --bcm-color-text );
}

.bcm-field__required {
	color: var( --bcm-color-danger );
	margin-inline-start: 2px;
}

.bcm-field input,
.bcm-field textarea {
	width: 100%;
	padding: 10px 12px;
	font-size: 16px; /* prevents iOS zoom on focus */
	line-height: 1.45;
	color: var( --bcm-color-text );
	background: var( --bcm-color-bg );
	border: 1px solid var( --bcm-color-border-strong );
	border-radius: var( --bcm-radius-sm );
	box-shadow: none;
	transition: border-color 120ms ease, box-shadow 120ms ease;
	font-family: inherit;
}

.bcm-field textarea { min-height: 160px; resize: vertical; }

.bcm-field input:focus,
.bcm-field textarea:focus {
	border-color: var( --bcm-color-focus );
	box-shadow: 0 0 0 3px var( --bcm-color-focus-ring );
}

.bcm-field input:focus-visible,
.bcm-field textarea:focus-visible {
	outline: 2px solid var( --bcm-color-focus );
	outline-offset: 2px;
}

.bcm-field__input--error,
.bcm-field input.bcm-field__input--error,
.bcm-field textarea.bcm-field__input--error {
	border-color: var( --bcm-color-danger );
	box-shadow: 0 0 0 3px var( --bcm-color-danger-ring );
}

.bcm-field__hint {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: 12px;
	color: var( --bcm-color-text-muted );
}

.bcm-field__counter { font-variant-numeric: tabular-nums; }

.bcm-field__error {
	display: block;
	min-height: 1em;
	font-size: 12px;
	color: var( --bcm-color-danger );
}
.bcm-field__error:empty { display: none; }

.bcm-field--captcha .bcm-captcha {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	background: var( --bcm-color-bg-soft );
	border: 1px solid var( --bcm-color-border );
	border-radius: var( --bcm-radius-sm );
}

.bcm-captcha__sum {
	font-size: 18px;
	font-weight: 600;
	color: var( --bcm-color-text );
	user-select: none;
	letter-spacing: 1px;
}

.bcm-field--captcha input { flex: 1; max-width: 140px; padding: 8px 10px; }

.bcm-form__actions {
	display: flex;
	justify-content: flex-end;
	padding-block-start: 6px;
}

.bcm-submit.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 160px;
	padding: 10px 18px;
	font-size: 15px;
	font-weight: 600;
	color: var( --bcm-color-on-primary );
	background: var( --bcm-color-primary );
	border: 1px solid var( --bcm-color-primary );
	border-radius: var( --bcm-radius-sm );
	cursor: pointer;
	transition: background-color 120ms ease, transform 40ms ease;
}

.bcm-submit.button:hover:not( [disabled] ) { background: var( --bcm-color-primary-hover ); border-color: var( --bcm-color-primary-hover ); }
.bcm-submit.button:active:not( [disabled] ) { transform: translateY( 1px ); }
.bcm-submit.button[disabled], .bcm-submit.button:disabled { opacity: 0.55; cursor: not-allowed; }

.bcm-submit.is-sending .bcm-submit__spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 2px solid currentColor;
	border-top-color: transparent;
	animation: bcm-spin 720ms linear infinite;
}
.bcm-submit__spinner { display: none; }

@keyframes bcm-spin { to { transform: rotate( 360deg ); } }

.bcm-card--closed {
	padding: var( --bcm-gap-lg );
	border: 1px dashed var( --bcm-color-border-strong );
	border-radius: var( --bcm-radius );
	background: var( --bcm-color-bg-soft );
	text-align: center;
}

.bcm-card__title { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.bcm-card__body  { margin: 0 0 var( --bcm-gap ); color: var( --bcm-color-text-muted ); }

/* ---------- Inbox ---------- */

.bcm-inbox { display: flex; flex-direction: column; gap: var( --bcm-gap ); }

.bcm-inbox__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding-block-end: 10px;
	border-block-end: 1px solid var( --bcm-color-border );
}

.bcm-inbox__title { margin: 0; font-size: 18px; font-weight: 600; }

.bcm-inbox__unread {
	padding: 2px 10px;
	background: var( --bcm-color-primary );
	color: var( --bcm-color-on-primary );
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.bcm-inbox__filters {
	display: flex;
	gap: 4px;
	align-items: center;
	background: var( --bcm-color-bg-soft );
	border: 1px solid var( --bcm-color-border );
	border-radius: 999px;
	padding: 3px;
}

.bcm-inbox__filter {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 500;
	color: var( --bcm-color-text-muted );
	text-decoration: none;
	transition: background-color 150ms ease, color 150ms ease;
}

.bcm-inbox__filter:hover { color: var( --bcm-color-text ); background: var( --bcm-color-hover-wash ); }

.bcm-inbox__filter.is-active {
	background: var( --bcm-color-bg );
	color: var( --bcm-color-text );
	box-shadow: var( --bcm-shadow-sm );
}

.bcm-inbox__filter-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 18px;
	padding: 0 6px;
	border-radius: 999px;
	background: var( --bcm-color-chip );
	color: inherit;
	font-size: 11px;
	font-weight: 600;
}

.bcm-inbox__filter.is-active .bcm-inbox__filter-count { background: var( --bcm-color-primary ); color: var( --bcm-color-on-primary ); }

.bcm-empty--inline {
	padding: 24px;
	text-align: center;
	background: var( --bcm-color-bg-soft );
	border: 1px dashed var( --bcm-color-border );
	border-radius: var( --bcm-radius-sm );
}

/* Count pill injected into the BP sub-nav Inbox link via JS. The element also
 * carries BuddyPress's native `count` class, so where the active theme styles
 * `.count` with higher specificity (e.g. BuddyX `.bp-navs ul li .count`) the
 * theme's own nav-count colour wins automatically. For themes/layouts where
 * this rule is the winning one, we source the SAME variable the BuddyX family
 * uses for its counts (`--color-theme-primary`, then Reign's accent) so the
 * bubble still matches the sibling nav counts on a customised theme — rather
 * than the plugin's own accent, which can drift from the theme's count colour.
 * Basecamp 9890995245. */
.bcm-subnav-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 18px;
	margin-inline-start: 6px;
	padding: 0 6px;
	background: var( --bcm-color-primary );
	color: var( --bcm-color-on-primary );
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
}

.bcm-messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.bcm-message {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: flex-start;
	gap: 12px;
	padding: 14px;
	background: var( --bcm-color-bg );
	border: 1px solid var( --bcm-color-border );
	border-radius: var( --bcm-radius );
	transition: background-color 120ms ease, border-color 120ms ease, opacity 200ms ease;
}

.bcm-message:hover { border-color: var( --bcm-color-border-strong ); }

.bcm-message--unread {
	background: var( --bcm-color-primary-soft );
	border-inline-start: 3px solid var( --bcm-color-primary );
	padding-inline-start: 12px;
}

.bcm-message__avatar img { width: 48px; height: 48px; border-radius: 50%; display: block; }

.bcm-message__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.bcm-message__from {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: var( --bcm-color-text );
	display: flex;
	align-items: center;
	gap: 8px;
}

.bcm-message__from a { color: inherit; text-decoration: none; }
.bcm-message__from a:hover { color: var( --bcm-color-primary ); text-decoration: underline; }

.bcm-message__badge {
	display: inline-block;
	padding: 1px 7px;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var( --bcm-color-on-primary );
	background: var( --bcm-color-primary );
	border-radius: 999px;
}

.bcm-badge {
	display: inline-block;
	padding: 1px 7px;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	border-radius: 999px;
	vertical-align: middle;
}

.bcm-badge--guest {
	color: var( --bcm-color-text );
	background: var( --bcm-color-warning-soft );
	border: 1px solid var( --bcm-color-warning );
}

.bcm-message__subject {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: var( --bcm-color-text );
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bcm-message__excerpt {
	margin: 0;
	font-size: 13px;
	color: var( --bcm-color-text-muted );
	line-height: 1.5;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.bcm-message__meta { margin: 4px 0 0; font-size: 12px; color: var( --bcm-color-text-muted ); }

.bcm-message__actions { display: flex; flex-direction: column; gap: 4px; align-self: center; }

.bcm-message__actions .button-link,
.bcm-message__view,
.bcm-message__delete {
	background: none;
	border: 0;
	padding: 6px;
	cursor: pointer;
	color: var( --bcm-color-text-muted );
	border-radius: var( --bcm-radius-sm );
	transition: background-color 120ms ease, color 120ms ease;
	line-height: 1;
}

.bcm-message__view:hover   { color: var( --bcm-color-primary ); background: var( --bcm-color-info-soft ); }
.bcm-message__delete:hover { color: var( --bcm-color-danger );  background: var( --bcm-color-danger-soft ); }

.bcm-pagination { display: flex; justify-content: center; gap: 4px; padding: 16px 0 4px; }

.bcm-pagination .page-numbers {
	padding: 6px 10px;
	font-size: 13px;
	border-radius: var( --bcm-radius-sm );
	text-decoration: none;
	color: var( --bcm-color-text );
	background: var( --bcm-color-bg );
	border: 1px solid var( --bcm-color-border );
}

.bcm-pagination .page-numbers.current,
.bcm-pagination .page-numbers:hover {
	background: var( --bcm-color-primary );
	border-color: var( --bcm-color-primary );
	color: var( --bcm-color-on-primary );
}

/* ---------- Empty state ---------- */

.bcm-empty {
	max-width: 520px;
	margin: 0 auto;
	padding: 40px 24px;
	text-align: center;
	border: 1px dashed var( --bcm-color-border-strong );
	border-radius: var( --bcm-radius );
	background: var( --bcm-color-bg-soft );
}

.bcm-empty__icon   { color: var( --bcm-color-primary ); opacity: 0.75; margin-block-end: 12px; }
.bcm-empty__title  { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var( --bcm-color-text ); }
.bcm-empty__body   { margin: 0 0 var( --bcm-gap ); color: var( --bcm-color-text-muted ); font-size: 14px; }
.bcm-empty__actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 0; }

.bcm-empty__actions .button-link {
	color: var( --bcm-color-primary );
	text-decoration: none;
	font-size: 14px;
	padding: 6px 12px;
	border-radius: var( --bcm-radius-sm );
	background: transparent;
	border: 1px solid transparent;
	cursor: pointer;
}
.bcm-empty__actions .button-link:hover { background: var( --bcm-color-info-soft ); }

/* ---------- Confirm overlay (bcmConfirm) ---------- */

.bcm-confirm-overlay {
	position: fixed;
	inset: 0;
	z-index: 100001;
	background: var( --bcm-color-overlay );
	backdrop-filter: blur( 2px );
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	opacity: 0;
	transition: opacity 150ms ease;
}

.bcm-confirm-overlay--visible { opacity: 1; }

.bcm-confirm {
	width: 100%;
	max-width: 420px;
	padding: 20px;
	background: var( --bcm-color-surface );
	border: 1px solid var( --bcm-color-border );
	border-radius: var( --bcm-radius );
	box-shadow: var( --bcm-shadow-lg );
	transform: translateY( -6px );
	transition: transform 150ms ease;
}

.bcm-confirm-overlay--visible .bcm-confirm { transform: translateY( 0 ); }

.bcm-confirm__title   { margin: 0 0 6px;  font-size: 16px; font-weight: 600; color: var( --bcm-color-text ); }
.bcm-confirm__message { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: var( --bcm-color-text-muted ); }

.bcm-confirm__actions { display: flex; justify-content: flex-end; gap: 8px; }

.bcm-confirm__btn {
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 6px;
	cursor: pointer;
	border: 1px solid var( --bcm-color-border-strong );
	background: var( --bcm-color-surface );
	color: var( --bcm-color-text );
}
.bcm-confirm__btn:hover { background: var( --bcm-color-bg-soft ); }

/* ---------- Info card (intro / how-it-works) ---------- */

.bcm-info {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 14px;
	align-items: flex-start;
	margin: 0 0 var( --bcm-gap );
	padding: 14px 16px;
	background: var( --bcm-color-info-soft );
	border: 1px solid var( --bcm-color-border );
	border-radius: var( --bcm-radius );
	transition: opacity 200ms ease;
}

.bcm-info__icon {
	color: var( --bcm-color-primary );
	padding-block-start: 2px;
}

.bcm-info__body {
	min-width: 0;
}

.bcm-info__title {
	margin: 0 0 2px;
	font-size: 14px;
	font-weight: 600;
	color: var( --bcm-color-text );
}

.bcm-info__text {
	margin: 0 0 6px;
	font-size: 13px;
	line-height: 1.5;
	color: var( --bcm-color-text );
}

.bcm-info__links {
	margin: 0;
	font-size: 13px;
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
	color: var( --bcm-color-text-muted );
}

.bcm-info[data-bcm-info] .bcm-info__links a,
.bcm-info[data-bcm-info] .bcm-info__links button.button-link {
	color: var( --bcm-color-primary );
	text-decoration: none;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	font-size: inherit;
}

.bcm-info[data-bcm-info] .bcm-info__links a:hover,
.bcm-info[data-bcm-info] .bcm-info__links button.button-link:hover {
	text-decoration: underline;
}

.bcm-info[data-bcm-info] button.bcm-info__close {
	background: transparent;
	border: 0;
	padding: 2px;
	cursor: pointer;
	color: var( --bcm-color-text-muted );
	border-radius: var( --bcm-radius-sm );
	align-self: flex-start;
}

.bcm-info[data-bcm-info] button.bcm-info__close:hover {
	background: var( --bcm-color-bg-soft );
	color: var( --bcm-color-text );
}

/* ---------- Message action buttons (icon-only ghost, reveal on hover) ---------- */

.bcm-message__actions {
	display: inline-flex;
	flex-direction: row;
	gap: 2px;
	align-self: center;
	opacity: 0;
	transition: opacity 140ms ease;
}

.bcm-message:hover .bcm-message__actions,
.bcm-message:focus-within .bcm-message__actions {
	opacity: 1;
}

.bcm-message__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 999px;
	color: var( --bcm-color-text-muted );
	cursor: pointer;
	transition: background-color 120ms ease, color 120ms ease, transform 80ms ease;
	line-height: 1;
	position: relative;
}

/* (0,4,0) beats BuddyPress Nouveau's `.buddypress .buddypress-wrap button:focus { outline: 0 }` (0,3,1). */
.bcm-messages .bcm-message .bcm-message__action:focus-visible {
	outline: 2px solid var( --bcm-color-focus );
	outline-offset: 2px;
}

.bcm-message__action .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	line-height: 1;
}

/* Mobile / coarse pointers: always show actions since there is no hover. */
@media ( hover: none ) {
	.bcm-message__actions {
		opacity: 1;
	}
}

/* ---------- Single message view ---------- */

.bcm-message-view {
	max-width: 720px;
	display: flex;
	flex-direction: column;
	gap: var( --bcm-gap );
}

.bcm-message-view__back {
	margin: 0;
}

.bcm-message-view__back a {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	color: var( --bcm-color-text-muted );
	text-decoration: none;
	padding: 4px 8px;
	border-radius: var( --bcm-radius-sm );
	transition: background-color 120ms ease, color 120ms ease;
}

.bcm-message-view__back a:hover {
	background: var( --bcm-color-bg-soft );
	color: var( --bcm-color-text );
}

.bcm-message-view__header {
	display: grid;
	grid-template-columns: 64px 1fr;
	gap: 16px;
	align-items: center;
	padding-block-end: var( --bcm-gap );
	border-block-end: 1px solid var( --bcm-color-border );
}

/* Pin the avatar column so theme rules that force `img { width: 100% }`
   on profile content can't blow it up to a giant square (BuddyBoss /
   BuddyX both ship rules like that). The wrapper enforces the box and
   the inner img is contained. */
.bcm-message-view__avatar,
.bcm-message-view__avatar a {
	display: block;
	width: 64px;
	height: 64px;
	flex: 0 0 64px;
}

.bcm-message-view__avatar img {
	width: 64px !important;
	height: 64px !important;
	max-width: 64px !important;
	border-radius: 50%;
	display: block;
	margin: 0;
	object-fit: cover;
}

.bcm-message-view__meta {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.bcm-message-view__subject {
	margin: 0;
	font-size: 22px;
	font-weight: 600;
	line-height: 1.25;
	color: var( --bcm-color-text );
	word-wrap: break-word;
}

.bcm-message-view__from {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var( --bcm-color-text-muted );
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.bcm-message-view__from a {
	color: var( --bcm-color-primary );
	text-decoration: none;
	font-weight: 600;
}

.bcm-message-view__from a:hover { text-decoration: underline; }

.bcm-message-view__date {
	margin: 0;
	font-size: 12px;
	color: var( --bcm-color-text-muted );
}

.bcm-message-view__body {
	padding: var( --bcm-gap-lg );
	background: var( --bcm-color-bg );
	border: 1px solid var( --bcm-color-border );
	border-radius: var( --bcm-radius );
	font-size: 15px;
	line-height: 1.65;
	color: var( --bcm-color-text );
	word-wrap: break-word;
}

.bcm-message-view__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding-block-start: 6px;
}

.bcm-message-view__action {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	border-radius: var( --bcm-radius-sm );
	text-decoration: none;
	cursor: pointer;
	background: var( --bcm-color-bg );
	border: 1px solid var( --bcm-color-border-strong );
	color: var( --bcm-color-text );
	transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
	font-family: inherit;
}

.bcm-message-view__action .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 1;
}

.bcm-message-view__action:hover,
.bcm-message-view__action:focus-visible {
	background: var( --bcm-color-bg-soft );
	color: var( --bcm-color-text );
	border-color: var( --bcm-color-border-strong );
	text-decoration: none;
}

.bcm-message-view__action--primary {
	color: var( --bcm-color-on-primary );
	background: var( --bcm-color-primary );
	border-color: var( --bcm-color-primary );
}

.bcm-message-view__action--primary:hover,
.bcm-message-view__action--primary:focus-visible {
	background: var( --bcm-color-primary-hover );
	border-color: var( --bcm-color-primary-hover );
	color: var( --bcm-color-on-primary );
}

.bcm-message-view__action--danger {
	margin-inline-start: auto;
	color: var( --bcm-color-danger );
	background: var( --bcm-color-bg );
	border-color: var( --bcm-color-border );
}

.bcm-message-view__action--danger:hover,
.bcm-message-view__action--danger:focus-visible {
	color: var( --bcm-color-on-danger );
	background: var( --bcm-color-danger );
	border-color: var( --bcm-color-danger );
}

@media ( max-width: 600px ) {
	.bcm-message-view__actions { flex-direction: column; align-items: stretch; }
	.bcm-message-view__action { justify-content: center; }
	.bcm-message-view__action--danger { margin-inline-start: 0; }
}

/* ---------- Preferences screen ---------- */

.bcm-preferences {
	display: flex;
	flex-direction: column;
	gap: 18px;
	max-width: 640px;
}

.bcm-preferences__header {
	padding-block-end: 10px;
	border-block-end: 1px solid var( --bcm-color-border );
}

.bcm-preferences__title {
	margin: 0 0 4px;
	font-size: 18px;
	font-weight: 600;
}

.bcm-preferences__intro {
	margin: 0;
	font-size: 14px;
	color: var( --bcm-color-text-muted );
}

.bcm-preferences__form,
.bcm-preferences__panel {
	padding: 16px;
	background: var( --bcm-color-surface );
	border: 1px solid var( --bcm-color-border );
	border-radius: var( --bcm-radius );
}

.bcm-preferences__toggle {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
}

.bcm-preferences__toggle input {
	margin-block-start: 3px;
	width: 18px;
	height: 18px;
}

.bcm-preferences__toggle-label {
	display: block;
	min-width: 0;
}

.bcm-preferences__toggle-title {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var( --bcm-color-text );
}

.bcm-preferences__toggle-hint {
	display: block;
	font-size: 13px;
	color: var( --bcm-color-text-muted );
	line-height: 1.5;
	margin-block-start: 2px;
}

.bcm-preferences__actions {
	margin-block-start: 14px;
	display: flex;
	justify-content: flex-end;
}

.bcm-preferences .bcm-preferences__panel-title {
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 600;
}

.bcm-preferences__panel-body {
	margin: 0 0 10px;
	font-size: 13px;
	color: var( --bcm-color-text-muted );
	line-height: 1.5;
}

.bcm-preferences__linkbox {
	display: flex;
	gap: 8px;
}

.bcm-preferences__linkbox input {
	flex: 1;
	padding: 8px 10px;
	font-size: 13px;
	border: 1px solid var( --bcm-color-border-strong );
	border-radius: var( --bcm-radius-sm );
	background: var( --bcm-color-bg );
	color: var( --bcm-color-text );
	font-family: ui-monospace, Menlo, Consolas, monospace;
}

.bcm-preferences__tips {
	margin: 0;
	padding-inline-start: 20px;
	font-size: 13px;
	color: var( --bcm-color-text-muted );
	line-height: 1.6;
}

.bcm-preferences__tips li { margin-block-end: 4px; }

/* ---------- Responsive ---------- */

@media ( max-width: 600px ) {
	.bcm-form-wrap { padding: 16px; }
	.bcm-message { grid-template-columns: auto 1fr; }
	.bcm-message__avatar { grid-row: 1 / 3; }
	.bcm-message__actions { flex-direction: row; grid-column: 1 / -1; justify-content: flex-end; }
	.bcm-info { grid-template-columns: auto 1fr; }
	.bcm-info__close { grid-column: 2; justify-self: end; }
	.bcm-preferences__linkbox { flex-direction: column; }
}

/* ---------- Dark mode (theme-driven) ---------- *
 *
 * Keyed only on the theme's own dark switch: `html[data-bx-mode="dark"]`
 * (BuddyX 5.1+, BuddyX Pro, Reign 8) and `body.buddyx-dark-theme` (older
 * BuddyX). Never prefers-color-scheme: the site's toggle decides, not the OS.
 *
 * The themes flip their --bx-color-* tokens in dark mode, so every chain is
 * re-declared here (it must resolve where the dark switch sits) with dark
 * fallbacks for a theme that only sets the switch. Status colours keep their
 * own dark values so "error" never borrows the accent.
 */
html[data-bx-mode="dark"],
body.buddyx-dark-theme {
	--bcm-color-border: var(--bx-color-border, var(--reign-site-border-color, #3a4253 ) );
	--bcm-color-border-strong: var(--bx-color-border-strong, var(--bx-color-border, #3c4654 ) );
	--bcm-color-bg: var(--bx-color-bg-page, var(--reign-site-body-bg-color, #16191f ) );
	--bcm-color-bg-soft: var(--bx-color-bg-subtle, var(--reign-site-secondary-bg-color, #262c3a ) );
	--bcm-color-surface: var(--bx-color-bg-elevated, var(--reign-site-sections-bg-color, #1f2430 ) );
	--bcm-color-text: var(--bx-color-fg, var(--reign-site-body-text-color, #e4e4e7 ) );
	--bcm-color-text-muted: var(--bx-color-fg-muted, var(--reign-site-alternate-text-color, #b4b4b8 ) );
	--bcm-color-link: var(--bx-color-link, var(--reign-site-link-color, #72b7ea ) );
	--bcm-color-primary: var(--bx-color-button-bg, var(--bx-color-accent, #4fa3e3 ) );
	--bcm-color-primary-hover: var(--bx-color-button-bg-hover, var(--bx-color-link-hover, #72b7ea ) );
	--bcm-color-on-primary: var(--bx-color-button-fg, #16191f );
	--bcm-color-inverse-bg: var(--bx-color-fg, #e4e4e7 );
	--bcm-color-inverse-fg: var(--bx-color-fg-inverse, #16191f );
	--bcm-color-focus: var(--bx-color-accent, #4fa3e3 );
	--bcm-color-danger: #f26c6e;
	--bcm-color-danger-hover: #f58485;
	--bcm-color-on-danger: #16191f;
	--bcm-color-success: #34c759;
	--bcm-color-warning: #f0b429;
	--bcm-color-primary-soft: color-mix( in srgb, var( --bcm-color-primary ) 12%, transparent );
	--bcm-color-success-soft: color-mix( in srgb, var( --bcm-color-success ) 14%, transparent );
	--bcm-color-danger-soft: color-mix( in srgb, var( --bcm-color-danger ) 16%, transparent );
	--bcm-color-warning-soft: color-mix( in srgb, var( --bcm-color-warning ) 14%, transparent );
	--bcm-color-info-soft: color-mix( in srgb, var( --bcm-color-primary ) 16%, transparent );

	--bcm-bg: var( --bcm-color-bg );
	--bcm-card-bg: var( --bcm-color-surface );
	--bcm-text: var( --bcm-color-text );

	--bcm-shadow-sm: 0 1px 2px rgba( 0, 0, 0, 0.4 );
	--bcm-shadow-md: 0 8px 24px rgba( 0, 0, 0, 0.5 );
	--bcm-shadow-lg: 0 20px 50px rgba( 0, 0, 0, 0.6 );
}

/* ----------------------------------------------------------------------
 * Button colour guards (all modes)
 *
 * BuddyX / BuddyX Pro / Reign all paint generic `<button>` and `<a>`
 * elements inside profile content with their brand accent, which stomps
 * the plugin's token-driven colours — the "Delete" / danger control comes
 * out the theme's pink accent with near-black text, and the confirm
 * buttons lose their intended fill. Pin our control colours at the
 * plugin scope so the theme can't recolour them. These hold in light and
 * dark alike (the danger/primary tokens already carry mode-correct
 * values), so they live outside the dark block.
 * -------------------------------------------------------------------- */

.bcm-message-view__action--primary,
.bcm-message-view__action--primary:hover,
.bcm-message-view__action--primary:focus-visible {
	color: var( --bcm-color-on-primary ) !important;
}
.bcm-message-view__action--danger {
	color: var( --bcm-color-danger ) !important;
	background: var( --bcm-color-bg ) !important;
	border-color: var( --bcm-color-border ) !important;
}
.bcm-message-view__action--danger:hover,
.bcm-message-view__action--danger:focus-visible {
	color: var( --bcm-color-on-danger ) !important;
	background: var( --bcm-color-danger ) !important;
	border-color: var( --bcm-color-danger ) !important;
}

/* Inbox-row icon actions (Delete) are ghost buttons that reveal on hover.
 * The host theme paints them with its accent fill + near-black text; pin
 * them transparent with token colour so the icon stays legible. */
.bcm-message__action {
	background: transparent !important;
	border: 0 !important;
	color: var( --bcm-color-text-muted ) !important;
}
.bcm-message__action--delete:hover {
	color: var( --bcm-color-danger ) !important;
	background: var( --bcm-color-danger-soft ) !important;
}

/* Confirm dialog buttons — neutral cancel, accent confirm, red danger.
 * `!important` is scoped to the dialog's own classes only. */
.bcm-confirm__btn--cancel {
	color: var( --bcm-color-text ) !important;
	background: var( --bcm-color-surface ) !important;
	border-color: var( --bcm-color-border-strong ) !important;
}
.bcm-confirm__btn--cancel:hover {
	background: var( --bcm-color-bg-soft ) !important;
}
.bcm-confirm__btn--confirm {
	color: var( --bcm-color-on-primary ) !important;
	background: var( --bcm-color-primary ) !important;
	border-color: var( --bcm-color-primary ) !important;
}
.bcm-confirm__btn--confirm:hover {
	background: var( --bcm-color-primary-hover ) !important;
	border-color: var( --bcm-color-primary-hover ) !important;
}
.bcm-confirm__btn--dangerous {
	color: var( --bcm-color-on-danger ) !important;
	background: var( --bcm-color-danger ) !important;
	border-color: var( --bcm-color-danger ) !important;
}
.bcm-confirm__btn--dangerous:hover {
	background: var( --bcm-color-danger-hover ) !important;
	border-color: var( --bcm-color-danger-hover ) !important;
}

/*
 * BuddyX Pro iconic profile nav: its icon sheet maps no Preferences or Send
 * sub-tab (they fall back to the generic info glyph), so name them here.
 * Scoped to Contact screens; the ids are generic across BuddyPress.
 */
.wbcom-bp-contact .buddyx-nav-iconic #preferences-personal-li > a:before {
	--bx-icon-mask: var( --bx-icon-settings );
}

.wbcom-bp-contact .buddyx-nav-iconic #send-personal-li > a:before {
	--bx-icon-mask: var( --bx-icon-send );
}
