.bmp-portal {
	--bmp-primary: #6d3fa0;
	--bmp-primary-dark: #522f79;
	--bmp-ink: #241b2e;
	--bmp-muted: #6b6478;
	--bmp-border: #e7e1ef;

	--bmp-c1: #6d3fa0;
	--bmp-c1-bg: #f1e9fa;
	--bmp-c2: #2fb6a8;
	--bmp-c2-bg: #e3f7f4;
	--bmp-c3: #d9822b;
	--bmp-c3-bg: #fdecd6;
	--bmp-c4: #3f6fd1;
	--bmp-c4-bg: #e7edfc;
	--bmp-c5: #c0447a;
	--bmp-c5-bg: #fbe6f0;
	--bmp-c6: #4a9c4a;
	--bmp-c6-bg: #e7f5e7;

	/* No background/font declarations here on purpose: the dashboard sits
	   directly on whatever page embeds it, and headings/body copy inherit
	   the theme's own typography rather than a font this plugin ships. */
	max-width: 1200px;
	margin: 0 auto;
}

.bmp-portal * {
	box-sizing: border-box;
}

.bmp-portal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1em;
	margin-bottom: 1.25em;
}

.bmp-portal__header h2 {
	margin: 0 0 0.2em;
}

.bmp-portal__subtitle {
	margin: 0;
	color: var(--bmp-muted);
}

/* Toolbar: pills + search */

.bmp-portal__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	flex-wrap: wrap;
	margin-bottom: 1.5em;
}

.bmp-portal__pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
}

.bmp-pill {
	display: inline-block;
	padding: 0.4em 1em;
	border-radius: 999px;
	border: 1px solid var(--bmp-border);
	background: transparent;
	/* !important: themes commonly style anchors via `a:link, a:visited`,
	   which outranks a single class selector in specificity and would
	   otherwise win here - producing invisible same-color text on the
	   filled active pill. */
	color: var(--bmp-ink) !important;
	text-decoration: none;
	font-size: 0.85rem;
	font-weight: 500;
	transition: all 0.15s ease;
}

.bmp-pill:hover {
	border-color: var(--bmp-primary);
	color: var(--bmp-primary) !important;
}

.bmp-pill--active,
.bmp-pill--active:hover {
	background: var(--bmp-primary);
	border-color: var(--bmp-primary);
	color: #fff !important;
}

.bmp-portal__controls {
	display: flex;
	align-items: center;
	gap: 0.5em;
	flex-wrap: wrap;
}

.bmp-portal__controls input[type="search"] {
	padding: 0.55em 1em;
	border-radius: 999px;
	border: 1px solid var(--bmp-border);
	min-width: 240px;
	font-size: 1rem;
	background: transparent;
	color: inherit;
}

.bmp-select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	padding: 0.55em 2.3em 0.55em 1em;
	border-radius: 999px;
	border: 1px solid var(--bmp-border);
	font-size: 0.9rem;
	background-color: transparent;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6478' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.9em center;
	background-size: 12px;
	color: inherit;
	cursor: pointer;
}

.bmp-portal__results {
	transition: opacity 0.15s ease;
}

.bmp-portal__results--loading {
	opacity: 0.5;
	pointer-events: none;
}

.bmp-btn {
	display: inline-block;
	padding: 0.55em 1.3em;
	border-radius: 999px;
	border: none;
	background: var(--bmp-primary);
	color: #fff !important;
	font-weight: 600;
	font-size: 1rem;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s ease, transform 0.1s ease;
}

.bmp-btn:hover {
	background: var(--bmp-primary-dark);
	color: #fff !important;
	transform: translateY(-1px);
}

.bmp-btn--ghost {
	background: transparent;
	color: var(--bmp-primary) !important;
	border: 1px solid var(--bmp-primary);
}

.bmp-btn--ghost:hover {
	background: var(--bmp-c1-bg);
	color: var(--bmp-primary) !important;
}

/* Document grid: column count set per-instance via --bmp-columns (Board
   Portal → Settings → Grid Density), stepping down for narrower embeds. */

.bmp-portal__grid {
	display: grid;
	grid-template-columns: repeat(var(--bmp-columns, 4), 1fr);
	gap: 1em;
}

@media (max-width: 980px) {
	.bmp-portal__grid {
		grid-template-columns: repeat(min(var(--bmp-columns, 4), 3), 1fr);
	}
}

@media (max-width: 720px) {
	.bmp-portal__grid {
		grid-template-columns: repeat(min(var(--bmp-columns, 4), 2), 1fr);
	}
}

@media (max-width: 460px) {
	.bmp-portal__grid {
		grid-template-columns: 1fr;
	}
}

.bmp-card {
	--bmp-card-tint: #f6f6f7;
	--bmp-card-ink: #52525b;

	position: relative;
	background: var(--bmp-card-tint);
	border: 1px solid var(--bmp-border);
	border-radius: 14px;
	padding: 1.1em;
	min-height: 230px;
	max-height: var(--bmp-card-max-height, none);
	display: flex;
	flex-direction: column;
	gap: 0.5em;
	overflow: hidden;
	text-decoration: none;
	color: inherit !important;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.bmp-card {
	cursor: pointer;
}

.bmp-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 24px rgba(36, 27, 46, 0.12);
}

.bmp-card--pdf { --bmp-card-tint: #fdf3f2; --bmp-card-ink: #b3261e; }
.bmp-card--doc { --bmp-card-tint: #f1f5fd; --bmp-card-ink: #2952a3; }
.bmp-card--xls { --bmp-card-tint: #f0faf2; --bmp-card-ink: #227a3e; }
.bmp-card--ppt { --bmp-card-tint: #fdf6ec; --bmp-card-ink: #a15b09; }
.bmp-card--txt { --bmp-card-tint: #f6f6f7; --bmp-card-ink: #52525b; }
.bmp-card--zip { --bmp-card-tint: #f7f3fc; --bmp-card-ink: #6d3fa0; }
.bmp-card--img { --bmp-card-tint: #fdf2f7; --bmp-card-ink: #a3276b; }
.bmp-card--link { --bmp-card-tint: #eaf6fb; --bmp-card-ink: #1b7a9e; }
.bmp-card--file { --bmp-card-tint: #f6f6f7; --bmp-card-ink: #52525b; }

.bmp-card__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.5em;
}

.bmp-card__icon {
	color: var(--bmp-card-ink);
	display: inline-flex;
	line-height: 0;
}

.bmp-card__date {
	font-size: 0.72rem;
	color: var(--bmp-muted);
	white-space: nowrap;
	padding-top: 0.3em;
}

.bmp-card__title {
	margin: 0;
	line-height: 1.3;
	/* Weight only, not family/size: some themes style h4 quite light by
	   default, which reads as washed-out in a dense card. Size and family
	   still come entirely from the theme. */
	font-weight: 700;
}

.bmp-card__excerpt {
	margin: 0;
	color: var(--bmp-muted);
	font-size: 0.95rem;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.bmp-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em;
	margin-top: auto;
	padding-top: 0.4em;
}

.bmp-card__hint {
	position: absolute;
	right: 1em;
	bottom: 1em;
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	padding: 0.3em 0.7em;
	border-radius: 999px;
	background: var(--bmp-primary);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 600;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.15s ease, transform 0.15s ease;
	pointer-events: none;
}

.bmp-card:hover .bmp-card__hint {
	opacity: 1;
	transform: translateY(0);
}

/* Badges, tags */

.bmp-badge {
	display: inline-block;
	padding: 0.2em 0.6em;
	border-radius: 999px;
	font-size: 0.7rem;
	font-weight: 600;
}

.bmp-badge--c1 { background: var(--bmp-c1-bg); color: var(--bmp-c1); }
.bmp-badge--c2 { background: var(--bmp-c2-bg); color: var(--bmp-c2); }
.bmp-badge--c3 { background: var(--bmp-c3-bg); color: var(--bmp-c3); }
.bmp-badge--c4 { background: var(--bmp-c4-bg); color: var(--bmp-c4); }
.bmp-badge--c5 { background: var(--bmp-c5-bg); color: var(--bmp-c5); }
.bmp-badge--c6 { background: var(--bmp-c6-bg); color: var(--bmp-c6); }

.bmp-tag {
	display: inline-block;
	padding: 0.2em 0.45em;
	font-size: 0.7rem;
	color: var(--bmp-muted);
}

/* Panels: login, denied, empty state */

.bmp-card-panel {
	border: 1px solid var(--bmp-border);
	border-radius: 14px;
	padding: 2em;
}

.bmp-card-panel--center {
	max-width: 420px;
	margin: 2em auto;
	text-align: center;
}

.bmp-portal__icon {
	color: var(--bmp-primary);
	margin-bottom: 0.5em;
}

.bmp-card-panel--center h2 {
	margin: 0 0 0.2em;
}

.bmp-card-panel--center .login-username,
.bmp-card-panel--center .login-password {
	text-align: left;
	margin-bottom: 1em;
}

.bmp-card-panel--center input[type="text"],
.bmp-card-panel--center input[type="password"] {
	width: 100%;
	padding: 0.6em 0.8em;
	border-radius: 8px;
	border: 1px solid var(--bmp-border);
	box-sizing: border-box;
	background: transparent;
	color: inherit;
}

.bmp-card-panel--center .login-submit input[type="submit"] {
	margin-top: 0.5em;
	width: 100%;
	padding: 0.65em;
	border-radius: 999px;
	border: none;
	background: var(--bmp-primary);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

.bmp-card-panel--center .login-submit input[type="submit"]:hover {
	background: var(--bmp-primary-dark);
}

/* Mobile */

@media (max-width: 600px) {
	.bmp-portal__toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.bmp-portal__controls {
		flex-direction: column;
		align-items: stretch;
	}

	.bmp-portal__controls input[type="search"] {
		min-width: 0;
	}
}
