/* ============================================================
   Church Management Portal – Fully Adaptive Styles
   Phones · Tablets · Desktops · Large screens
   ============================================================ */

:root {
	--cmp-primary: #1e40af;
	--cmp-secondary: #3b82f6;
	--cmp-accent: #f59e0b;
	--cmp-bg: #f1f5f9;
	--cmp-card-bg: #ffffff;
	--cmp-text: #0f172a;
	--cmp-muted: #64748b;
	--cmp-border: #e2e8f0;
	--cmp-radius: 14px;
	--cmp-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
	--cmp-safe-bottom: env(safe-area-inset-bottom, 0px);
	--cmp-safe-top: env(safe-area-inset-top, 0px);
	--cmp-header-h: 56px;
	--cmp-bottom-nav-h: 64px;
	--cmp-sidebar-w: 260px;
	--cmp-touch: 44px;
	--cmp-content-max: 1100px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
}

.cmp-app,
.cmp-dashboard,
.cmp-directory,
.cmp-groups,
.cmp-events,
.cmp-sermons,
.cmp-give,
.cmp-my-giving,
.cmp-volunteer,
.cmp-prayer-wall,
.cmp-plan-visit,
.cmp-messages,
.cmp-profile,
.cmp-checkin,
.cmp-members-manage {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--cmp-text);
	background: var(--cmp-bg);
	min-height: 100vh;
	min-height: 100dvh;
	-webkit-font-smoothing: antialiased;
	line-height: 1.5;
}

/* ---------- App shell ---------- */
.cmp-app {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
	padding-bottom: calc(var(--cmp-bottom-nav-h) + var(--cmp-safe-bottom));
}

/* ---------- Top bar ---------- */
.cmp-topbar {
	position: sticky;
	top: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--cmp-header-h);
	padding: 0 12px;
	padding-top: var(--cmp-safe-top);
	background: var(--cmp-card-bg);
	border-bottom: 1px solid var(--cmp-border);
	box-shadow: 0 1px 0 rgba(0,0,0,.04);
}

.cmp-topbar-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	flex: 1;
}

.cmp-topbar-brand img {
	height: 32px;
	width: auto;
	border-radius: 6px;
	flex-shrink: 0;
}

.cmp-topbar-brand h1 {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	color: var(--cmp-primary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cmp-topbar-actions {
	display: flex;
	align-items: center;
	gap: 2px;
	flex-shrink: 0;
}

.cmp-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--cmp-touch);
	height: var(--cmp-touch);
	border: none;
	background: transparent;
	border-radius: 50%;
	color: var(--cmp-text);
	font-size: 1.2rem;
	text-decoration: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.cmp-icon-btn:hover,
.cmp-icon-btn:focus-visible {
	background: rgba(0,0,0,.06);
}

.cmp-icon-btn:active {
	background: rgba(0,0,0,.1);
}

/* Desktop nav links in topbar (hidden on small screens) */
.cmp-desktop-nav {
	display: none;
}

/* ---------- Bottom navigation (phones / small tablets) ---------- */
.cmp-bottom-nav {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 200;
	display: flex;
	justify-content: space-around;
	align-items: stretch;
	height: calc(var(--cmp-bottom-nav-h) + var(--cmp-safe-bottom));
	padding-bottom: var(--cmp-safe-bottom);
	background: var(--cmp-card-bg);
	border-top: 1px solid var(--cmp-border);
	box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}

.cmp-bottom-nav a {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	padding: 6px 2px;
	color: var(--cmp-muted);
	text-decoration: none;
	font-size: 0.65rem;
	font-weight: 500;
	-webkit-tap-highlight-color: transparent;
	min-height: var(--cmp-bottom-nav-h);
	transition: color .15s;
}

.cmp-bottom-nav a .cmp-nav-icon {
	font-size: 1.3rem;
	line-height: 1;
}

.cmp-bottom-nav a.cmp-active,
.cmp-bottom-nav a:hover {
	color: var(--cmp-primary);
}

/* ---------- Sidebar (tablets landscape + desktop) ---------- */
.cmp-sidebar {
	display: none;
	flex-direction: column;
	width: var(--cmp-sidebar-w);
	background: var(--cmp-card-bg);
	border-right: 1px solid var(--cmp-border);
	padding: 20px 12px;
	position: sticky;
	top: 0;
	height: 100vh;
	height: 100dvh;
	overflow-y: auto;
	flex-shrink: 0;
}

.cmp-sidebar-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 8px 20px;
	border-bottom: 1px solid var(--cmp-border);
	margin-bottom: 16px;
}

.cmp-sidebar-brand img {
	height: 40px;
	width: auto;
	border-radius: 8px;
}

.cmp-sidebar-brand span {
	font-weight: 700;
	font-size: 1.05rem;
	color: var(--cmp-primary);
	line-height: 1.2;
}

.cmp-sidebar-nav {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.cmp-sidebar-nav a {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 12px;
	border-radius: 10px;
	color: var(--cmp-text);
	text-decoration: none;
	font-size: 0.92rem;
	font-weight: 500;
	transition: background .15s, color .15s;
}

.cmp-sidebar-nav a:hover {
	background: #f1f5f9;
	color: var(--cmp-primary);
}

.cmp-sidebar-nav a.cmp-active {
	background: rgba(30, 64, 175, 0.1);
	color: var(--cmp-primary);
	font-weight: 600;
}

.cmp-sidebar-nav .cmp-nav-icon {
	font-size: 1.2rem;
	width: 24px;
	text-align: center;
}

.cmp-sidebar-footer {
	margin-top: auto;
	padding-top: 16px;
	border-top: 1px solid var(--cmp-border);
}

/* ---------- Content area ---------- */
.cmp-content {
	flex: 1;
	padding: 14px 12px;
	width: 100%;
	max-width: 100%;
}

.cmp-page-title {
	margin: 0 0 4px;
	font-size: 1.3rem;
	font-weight: 700;
	color: var(--cmp-text);
}

.cmp-page-sub {
	margin: 0 0 16px;
	color: var(--cmp-muted);
	font-size: 0.875rem;
}

/* ---------- Cards ---------- */
.cmp-card {
	background: var(--cmp-card-bg);
	border-radius: var(--cmp-radius);
	padding: 14px 16px;
	margin-bottom: 12px;
	box-shadow: var(--cmp-shadow);
	border: 1px solid var(--cmp-border);
}

.cmp-card h2,
.cmp-card-title {
	margin: 0 0 12px;
	font-size: 1rem;
	font-weight: 650;
	color: var(--cmp-primary);
}

.cmp-card ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.cmp-card ul li { margin: 0; }

.cmp-card ul li a {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 4px;
	color: var(--cmp-text);
	text-decoration: none;
	border-bottom: 1px solid var(--cmp-border);
	font-size: 0.92rem;
	min-height: var(--cmp-touch);
	-webkit-tap-highlight-color: transparent;
}

.cmp-card ul li:last-child a { border-bottom: none; }

.cmp-card ul li a:hover {
	background: #f8fafc;
}

.cmp-card-icon {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: rgba(30, 64, 175, 0.1);
	color: var(--cmp-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.05rem;
	flex-shrink: 0;
}

.cmp-muted {
	color: var(--cmp-muted);
	font-size: 0.85rem;
}

/* ---------- Quick action grid ---------- */
.cmp-quick-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 8px;
	margin-bottom: 14px;
}

.cmp-quick-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	padding: 12px 4px;
	background: var(--cmp-card-bg);
	border-radius: 12px;
	border: 1px solid var(--cmp-border);
	text-decoration: none;
	color: var(--cmp-text);
	font-size: 0.68rem;
	font-weight: 550;
	text-align: center;
	box-shadow: var(--cmp-shadow);
	-webkit-tap-highlight-color: transparent;
	min-height: 72px;
	transition: transform .1s, background .15s;
}

.cmp-quick-item:hover {
	background: #f8fafc;
	color: var(--cmp-primary);
}

.cmp-quick-item:active {
	transform: scale(0.97);
}

.cmp-quick-item .cmp-qi-icon {
	font-size: 1.35rem;
	line-height: 1;
	color: var(--cmp-primary);
}

/* ---------- Buttons ---------- */
.cmp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: var(--cmp-touch);
	padding: 0 18px;
	border-radius: 12px;
	font-weight: 600;
	font-size: 0.92rem;
	text-decoration: none;
	border: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background .15s, transform .1s, box-shadow .15s;
	width: 100%;
}

.cmp-btn:active { transform: scale(0.98); }

.cmp-btn-primary {
	background: var(--cmp-primary);
	color: #fff;
}

.cmp-btn-primary:hover {
	background: var(--cmp-secondary);
	color: #fff;
}

.cmp-btn-secondary {
	background: #e2e8f0;
	color: var(--cmp-text);
}

.cmp-btn-secondary:hover {
	background: #cbd5e1;
}

.cmp-btn-outline {
	background: transparent;
	border: 2px solid var(--cmp-primary);
	color: var(--cmp-primary);
}

.cmp-btn-sm {
	min-height: 38px;
	padding: 0 14px;
	font-size: 0.85rem;
	width: auto;
}

.cmp-btn-block { width: 100%; }

/* ---------- Forms ---------- */
.cmp-form label {
	display: block;
	font-weight: 550;
	font-size: 0.85rem;
	margin-bottom: 5px;
	color: var(--cmp-text);
}

.cmp-form .cmp-field {
	margin-bottom: 14px;
}

.cmp-form input[type="text"],
.cmp-form input[type="email"],
.cmp-form input[type="tel"],
.cmp-form input[type="number"],
.cmp-form input[type="date"],
.cmp-form input[type="search"],
.cmp-form input[type="password"],
.cmp-form input[type="time"],
.cmp-form select,
.cmp-form textarea {
	width: 100%;
	min-height: var(--cmp-touch);
	padding: 10px 12px;
	border: 1.5px solid var(--cmp-border);
	border-radius: 10px;
	font-size: 16px; /* prevents iOS zoom */
	background: #fff;
	color: var(--cmp-text);
	-webkit-appearance: none;
	appearance: none;
}

.cmp-form textarea {
	min-height: 100px;
	resize: vertical;
}

.cmp-form input:focus,
.cmp-form select:focus,
.cmp-form textarea:focus {
	outline: none;
	border-color: var(--cmp-secondary);
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.cmp-form .cmp-row {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.cmp-form .cmp-row > * {
	flex: 1;
}

.cmp-form .cmp-checkbox {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: var(--cmp-touch);
	font-weight: 500;
}

.cmp-form .cmp-checkbox input {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

/* ---------- Search ---------- */
.cmp-search-wrap {
	position: relative;
	margin-bottom: 12px;
}

.cmp-search-wrap input {
	width: 100%;
	min-height: var(--cmp-touch);
	padding: 10px 14px 10px 42px;
	border: 1.5px solid var(--cmp-border);
	border-radius: 12px;
	font-size: 16px;
	background: #fff;
	box-shadow: var(--cmp-shadow);
}

.cmp-search-wrap::before {
	content: "🔍";
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 0.95rem;
	opacity: 0.5;
	pointer-events: none;
}

/* ---------- Member / group cards ---------- */
.cmp-member-list,
.cmp-group-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cmp-member-card,
.cmp-group-card {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px;
	background: var(--cmp-card-bg);
	border-radius: 12px;
	border: 1px solid var(--cmp-border);
	box-shadow: var(--cmp-shadow);
	text-decoration: none;
	color: inherit;
	-webkit-tap-highlight-color: transparent;
	transition: background .15s, box-shadow .15s;
}

.cmp-member-card:hover,
.cmp-group-card:hover {
	background: #f8fafc;
	box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.cmp-avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--cmp-primary), var(--cmp-secondary));
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 0.95rem;
	flex-shrink: 0;
	overflow: hidden;
}

.cmp-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cmp-member-info,
.cmp-group-info {
	flex: 1;
	min-width: 0;
}

.cmp-member-info strong,
.cmp-group-info strong {
	display: block;
	font-size: 0.95rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cmp-member-info span,
.cmp-group-info span {
	display: block;
	font-size: 0.78rem;
	color: var(--cmp-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cmp-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 20px;
	font-size: 0.68rem;
	font-weight: 600;
	background: #e0e7ff;
	color: var(--cmp-primary);
	flex-shrink: 0;
}

.cmp-badge-guest { background: #fef3c7; color: #b45309; }
.cmp-badge-leader { background: #d1fae5; color: #047857; }
.cmp-badge-open { background: #dbeafe; color: #1d4ed8; }
.cmp-badge-full { background: #fee2e2; color: #b91c1c; }

/* ---------- Profile header ---------- */
.cmp-profile-header {
	text-align: center;
	padding: 20px 16px 16px;
	background: var(--cmp-card-bg);
	border-radius: 0 0 16px 16px;
	margin: -14px -12px 16px;
	box-shadow: var(--cmp-shadow);
}

.cmp-profile-header .cmp-avatar {
	width: 80px;
	height: 80px;
	font-size: 1.6rem;
	margin: 0 auto 10px;
}

.cmp-profile-header h2 {
	margin: 0 0 2px;
	font-size: 1.25rem;
}

/* ---------- Filters / chips ---------- */
.cmp-filters {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding-bottom: 10px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.cmp-filters::-webkit-scrollbar { display: none; }

.cmp-chip {
	flex-shrink: 0;
	padding: 7px 12px;
	border-radius: 20px;
	background: #e2e8f0;
	color: var(--cmp-text);
	font-size: 0.78rem;
	font-weight: 550;
	border: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background .15s, color .15s;
}

.cmp-chip:hover { background: #cbd5e1; }

.cmp-chip.cmp-active {
	background: var(--cmp-primary);
	color: #fff;
}

/* ---------- Empty / loading ---------- */
.cmp-empty {
	text-align: center;
	padding: 36px 16px;
	color: var(--cmp-muted);
}

.cmp-empty .cmp-empty-icon {
	font-size: 2.2rem;
	margin-bottom: 8px;
	opacity: 0.5;
}

.cmp-loading {
	text-align: center;
	padding: 28px;
	color: var(--cmp-muted);
}

/* ---------- Alerts ---------- */
.cmp-alert {
	padding: 12px 14px;
	border-radius: 10px;
	margin-bottom: 12px;
	font-size: 0.88rem;
}

.cmp-alert-success { background: #d1fae5; color: #065f46; }
.cmp-alert-error { background: #fee2e2; color: #991b1b; }
.cmp-alert-info { background: #e0f2fe; color: #075985; }

/* ---------- Login ---------- */
.cmp-login-prompt {
	text-align: center;
	padding: 40px 20px;
	max-width: 380px;
	margin: 32px auto;
	background: var(--cmp-card-bg);
	border-radius: 16px;
	box-shadow: var(--cmp-shadow);
}

.cmp-login-prompt h2 {
	color: var(--cmp-primary);
	margin: 0 0 6px;
}

.cmp-login-prompt p {
	color: var(--cmp-muted);
	margin-bottom: 20px;
}

/* ---------- Staff tools ---------- */
.cmp-staff-tools {
	border-left: 4px solid var(--cmp-accent);
}

/* ---------- Group detail ---------- */
.cmp-group-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	font-size: 0.85rem;
	color: var(--cmp-muted);
	margin-bottom: 12px;
}

.cmp-group-meta span {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

/* ---------- Attendance list ---------- */
.cmp-attendance-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cmp-attendance-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px solid var(--cmp-border);
}

.cmp-attendance-row:last-child { border-bottom: none; }

.cmp-attendance-row .cmp-avatar {
	width: 36px;
	height: 36px;
	font-size: 0.8rem;
}

.cmp-attendance-row label {
	flex: 1;
	font-weight: 500;
	margin: 0;
}

.cmp-attendance-toggle {
	display: flex;
	gap: 4px;
}

.cmp-attendance-toggle button {
	min-width: 36px;
	min-height: 36px;
	border-radius: 8px;
	border: 1.5px solid var(--cmp-border);
	background: #fff;
	cursor: pointer;
	font-size: 0.9rem;
}

.cmp-attendance-toggle button.cmp-present {
	background: #d1fae5;
	border-color: #10b981;
	color: #047857;
}

.cmp-attendance-toggle button.cmp-absent {
	background: #fee2e2;
	border-color: #ef4444;
	color: #b91c1c;
}

/* ============================================================
   TABLET (768px+)
   ============================================================ */
@media (min-width: 768px) {
	:root {
		--cmp-header-h: 60px;
		--cmp-touch: 42px;
	}

	.cmp-app {
		padding-bottom: 0; /* no bottom nav */
	}

	.cmp-bottom-nav {
		display: none;
	}

	.cmp-topbar {
		padding: 0 20px;
	}

	.cmp-topbar-brand h1 {
		font-size: 1.15rem;
	}

	.cmp-topbar-brand img {
		height: 36px;
	}

	.cmp-desktop-nav {
		display: flex;
		align-items: center;
		gap: 4px;
		margin-right: 8px;
	}

	.cmp-desktop-nav a {
		padding: 8px 12px;
		border-radius: 8px;
		color: var(--cmp-text);
		text-decoration: none;
		font-size: 0.88rem;
		font-weight: 500;
		white-space: nowrap;
		transition: background .15s, color .15s;
	}

	.cmp-desktop-nav a:hover {
		background: #f1f5f9;
		color: var(--cmp-primary);
	}

	.cmp-content {
		padding: 24px 28px;
		max-width: var(--cmp-content-max);
		margin: 0 auto;
	}

	.cmp-page-title {
		font-size: 1.5rem;
	}

	.cmp-quick-grid {
		grid-template-columns: repeat(4, 1fr);
		gap: 14px;
	}

	.cmp-quick-item {
		padding: 18px 10px;
		font-size: 0.82rem;
		min-height: 88px;
		border-radius: 14px;
	}

	.cmp-quick-item .cmp-qi-icon {
		font-size: 1.6rem;
	}

	.cmp-form .cmp-row {
		flex-direction: row;
		gap: 14px;
	}

	.cmp-btn {
		width: auto;
		min-width: 140px;
	}

	.cmp-member-list,
	.cmp-group-list {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
	}

	.cmp-profile-header {
		margin: -24px -28px 24px;
		padding: 28px 24px 20px;
		border-radius: 0 0 20px 20px;
	}

	.cmp-profile-header .cmp-avatar {
		width: 96px;
		height: 96px;
		font-size: 2rem;
	}

	.cmp-card {
		padding: 18px 20px;
	}
}

/* ============================================================
   DESKTOP (1024px+) — sidebar layout
   ============================================================ */
@media (min-width: 1024px) {
	.cmp-app {
		flex-direction: row;
		padding-bottom: 0;
	}

	.cmp-sidebar {
		display: flex;
	}

	.cmp-topbar {
		display: none; /* sidebar replaces topbar on large screens */
	}

	.cmp-content {
		padding: 28px 32px;
		max-width: none;
		flex: 1;
	}

	.cmp-content-inner {
		max-width: var(--cmp-content-max);
	}

	.cmp-quick-grid {
		grid-template-columns: repeat(4, 1fr);
		gap: 16px;
		max-width: 640px;
	}

	.cmp-member-list,
	.cmp-group-list {
		grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	}

	.cmp-profile-header {
		margin: 0 0 24px;
		border-radius: 16px;
		text-align: left;
		display: flex;
		align-items: center;
		gap: 20px;
		padding: 24px;
	}

	.cmp-profile-header .cmp-avatar {
		margin: 0;
	}
}

/* ============================================================
   LARGE DESKTOP (1280px+)
   ============================================================ */
@media (min-width: 1280px) {
	:root {
		--cmp-sidebar-w: 280px;
		--cmp-content-max: 1200px;
	}

	.cmp-content {
		padding: 32px 40px;
	}

	.cmp-quick-grid {
		grid-template-columns: repeat(8, 1fr);
		max-width: none;
	}
}

/* ============================================================
   VERYY SMALL PHONES (≤360px)
   ============================================================ */
@media (max-width: 360px) {
	.cmp-quick-grid {
		grid-template-columns: repeat(4, 1fr);
		gap: 6px;
	}

	.cmp-quick-item {
		padding: 10px 2px;
		font-size: 0.62rem;
		min-height: 64px;
	}

	.cmp-quick-item .cmp-qi-icon {
		font-size: 1.2rem;
	}

	.cmp-bottom-nav a {
		font-size: 0.6rem;
	}
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		transition: none !important;
		animation: none !important;
	}
}


/* ---------- Reports ---------- */
.cmp-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 768px) {
  .cmp-stats-grid { grid-template-columns: repeat(4, 1fr); }
}
.cmp-stat-card {
  background: var(--cmp-surface, #fff);
  border: 1px solid var(--cmp-border, #e2e8f0);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
}
.cmp-stat-card .cmp-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cmp-primary, #1e40af);
  line-height: 1.2;
}
.cmp-stat-card .cmp-stat-label {
  font-size: 0.75rem;
  color: var(--cmp-muted, #64748b);
  margin-top: 4px;
}

/* ---------- Public home & header ---------- */
.cmp-public-page {
  min-height: 100vh;
  background: var(--cmp-bg, #f8fafc);
  color: var(--cmp-text, #0f172a);
}
.cmp-public-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid var(--cmp-border, #e2e8f0);
  backdrop-filter: blur(8px);
}
.cmp-public-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cmp-public-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
}
.cmp-public-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}
.cmp-public-menu-toggle {
  display: none;
  border: 1px solid var(--cmp-border, #e2e8f0);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 1.1rem;
  cursor: pointer;
}
.cmp-public-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
.cmp-public-nav a {
  text-decoration: none;
  color: var(--cmp-muted, #475569);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 4px;
}
.cmp-public-nav a.cmp-active,
.cmp-public-nav a:hover {
  color: var(--cmp-primary, #1e40af);
}
.cmp-public-nav a.cmp-public-cta {
  background: var(--cmp-primary, #1e40af);
  color: #fff !important;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
}
.cmp-home-hero {
  background: linear-gradient(145deg, var(--cmp-primary, #1e40af) 0%, #1e3a8a 55%, #0f172a 100%);
  color: #fff;
  padding: 56px 16px 64px;
  text-align: center;
}
.cmp-home-hero-inner { max-width: 720px; margin: 0 auto; }
.cmp-home-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  opacity: 0.85;
  margin: 0 0 8px;
}
.cmp-home-title {
  font-size: clamp(1.75rem, 5vw, 2.6rem);
  margin: 0 0 12px;
  line-height: 1.15;
}
.cmp-home-tagline {
  font-size: 1.05rem;
  opacity: 0.92;
  margin: 0 0 24px;
  line-height: 1.5;
}
.cmp-home-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.cmp-home-cta-row .cmp-btn-secondary {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
}
.cmp-home-section { padding: 36px 16px; }
.cmp-home-section-inner { max-width: 1100px; margin: 0 auto; }
.cmp-home-section-title {
  font-size: 1.25rem;
  margin: 0 0 16px;
}
.cmp-home-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) {
  .cmp-home-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .cmp-home-cards { grid-template-columns: repeat(3, 1fr); }
}
.cmp-home-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--cmp-border, #e2e8f0);
  border-radius: 14px;
  padding: 18px 16px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s ease, transform .15s ease;
}
.cmp-home-card:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}
.cmp-home-card-icon { font-size: 1.5rem; }
.cmp-home-card strong { font-size: 1.05rem; }
.cmp-home-card span { font-size: 0.88rem; color: var(--cmp-muted, #64748b); line-height: 1.4; }
.cmp-home-widgets-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 768px) {
  .cmp-home-widgets-grid { grid-template-columns: 1fr 1fr; }
}
.cmp-home-member-strip {
  background: #fff;
  border-top: 1px solid var(--cmp-border, #e2e8f0);
  border-bottom: 1px solid var(--cmp-border, #e2e8f0);
  text-align: center;
}
.cmp-home-member-strip .cmp-home-section-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.cmp-public-footer {
  padding: 28px 16px 40px;
  text-align: center;
  color: var(--cmp-muted, #64748b);
  font-size: 0.85rem;
}
.cmp-public-footer a { color: var(--cmp-primary, #1e40af); }
.cmp-login-prompt.cmp-public-prompt {
  max-width: 420px;
  margin: 48px auto;
  padding: 28px 20px;
  text-align: center;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--cmp-border, #e2e8f0);
  box-shadow: 0 8px 28px rgba(15,23,42,0.06);
}
.cmp-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
@media (max-width: 767px) {
  .cmp-public-menu-toggle { display: inline-flex; }
  .cmp-public-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 8px;
  }
  .cmp-public-nav.cmp-open { display: flex; }
  .cmp-public-header-inner { flex-wrap: wrap; }
  .cmp-public-nav a.cmp-public-cta { text-align: center; }
}


/* ---------- Mobile full menu (hamburger) ---------- */
.cmp-menu-toggle {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin-right: 6px;
	border: 1px solid var(--cmp-border, #e2e8f0);
	border-radius: 10px;
	background: #fff;
	cursor: pointer;
	flex-shrink: 0;
	padding: 0;
	z-index: 1001;
	position: relative;
}
.cmp-menu-toggle-bars,
.cmp-menu-toggle-bars::before,
.cmp-menu-toggle-bars::after {
	display: block;
	width: 18px;
	height: 2px;
	background: var(--cmp-text, #0f172a);
	border-radius: 2px;
	position: relative;
	transition: transform .2s ease, opacity .2s ease;
}
.cmp-menu-toggle-bars::before,
.cmp-menu-toggle-bars::after {
	content: '';
	position: absolute;
	left: 0;
}
.cmp-menu-toggle-bars::before { top: -6px; }
.cmp-menu-toggle-bars::after { top: 6px; }
.cmp-menu-toggle[aria-expanded="true"] .cmp-menu-toggle-bars { background: transparent; }
.cmp-menu-toggle[aria-expanded="true"] .cmp-menu-toggle-bars::before {
	top: 0; transform: rotate(45deg);
}
.cmp-menu-toggle[aria-expanded="true"] .cmp-menu-toggle-bars::after {
	top: 0; transform: rotate(-45deg);
}

.cmp-mobile-menu {
	position: fixed !important;
	top: 0; left: 0; right: 0; bottom: 0;
	z-index: 99999 !important;
	visibility: hidden;
	pointer-events: none;
}
.cmp-mobile-menu.cmp-open {
	visibility: visible;
	pointer-events: auto;
}
.cmp-mobile-menu-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
	opacity: 0;
	transition: opacity .2s ease;
}
.cmp-mobile-menu.cmp-open .cmp-mobile-menu-backdrop {
	opacity: 1;
}
.cmp-mobile-menu-panel {
	position: absolute;
	top: 0;
	left: 0;
	width: min(320px, 90vw);
	height: 100%;
	max-height: 100vh;
	background: #fff !important;
	box-shadow: 8px 0 32px rgba(15, 23, 42, 0.2);
	padding: 18px 12px 32px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	transform: translateX(-105%);
	transition: transform .25s ease;
	z-index: 2;
}
.cmp-mobile-menu.cmp-open .cmp-mobile-menu-panel {
	transform: translateX(0);
}
.cmp-mobile-menu-title {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #64748b;
	margin: 4px 8px 12px;
	font-weight: 600;
}
.cmp-mobile-menu-link {
	display: flex !important;
	align-items: center;
	gap: 12px;
	padding: 13px 12px;
	border-radius: 12px;
	text-decoration: none !important;
	color: #0f172a !important;
	font-size: 0.98rem;
	font-weight: 500;
}
.cmp-mobile-menu-link:hover,
.cmp-mobile-menu-link.cmp-active {
	background: #eff6ff !important;
	color: #1e40af !important;
}
.cmp-mobile-menu-link .cmp-nav-icon {
	font-size: 1.2rem;
	width: 28px;
	text-align: center;
}
.cmp-mobile-menu-logout {
	margin-top: 12px;
	border-top: 1px solid #e2e8f0;
	color: #64748b !important;
}
body.cmp-menu-open {
	overflow: hidden !important;
}

/* Desktop portal: sidebar exists — keep hamburger available under 1024 for tablets */
@media (min-width: 1024px) {
	.cmp-app .cmp-menu-toggle {
		/* still show — user asked for menu access; sidebar also present */
		display: inline-flex !important;
	}
}

/* Public header desktop links */
.cmp-public-nav-desktop {
	display: none;
}
@media (min-width: 900px) {
	.cmp-public-nav-desktop {
		display: flex !important;
		flex-wrap: wrap;
		align-items: center;
		gap: 4px 14px;
	}
}
.cmp-public-header .cmp-menu-toggle {
	display: inline-flex !important;
}
@media (min-width: 900px) {
	/* Keep toggle on public pages too so full menu (incl. member links) is reachable */
	.cmp-public-header .cmp-menu-toggle {
		display: inline-flex !important;
	}
}

/* Old public-only toggle no longer used */
.cmp-public-menu-toggle { display: none !important; }

/* ---------- WhatsApp-style chat ---------- */
.cmp-chat-app {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - 160px);
	background: #e5ddd5;
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid var(--cmp-border, #e2e8f0);
}
@media (min-width: 768px) {
	.cmp-chat-app {
		flex-direction: row;
		min-height: 520px;
		max-height: calc(100vh - 140px);
	}
}
.cmp-chat-list {
	background: #fff;
	display: flex;
	flex-direction: column;
	width: 100%;
	border-right: 1px solid var(--cmp-border, #e2e8f0);
}
@media (min-width: 768px) {
	.cmp-chat-list { width: 340px; flex-shrink: 0; }
}
.cmp-chat-list-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	border-bottom: 1px solid var(--cmp-border, #e2e8f0);
	background: #f0f2f5;
}
.cmp-chat-conversations {
	overflow-y: auto;
	flex: 1;
}
.cmp-chat-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 12px 14px;
	border: 0;
	border-bottom: 1px solid #f1f5f9;
	background: #fff;
	text-align: left;
	cursor: pointer;
}
.cmp-chat-item:hover,
.cmp-chat-item.cmp-active {
	background: #f0f2f5;
}
.cmp-chat-item-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.cmp-chat-item-info strong {
	font-size: 0.95rem;
}
.cmp-chat-preview {
	font-size: 0.8rem;
	color: #64748b;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.cmp-chat-item-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
}
.cmp-chat-time {
	font-size: 0.7rem;
	color: #94a3b8;
}
.cmp-chat-unread {
	background: #25d366;
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 5px;
}
.cmp-chat-thread {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: #ece5dd;
}
.cmp-chat-thread-empty {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: #f0f2f5;
}
.cmp-chat-thread-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	background: #075e54;
	color: #fff;
}
.cmp-chat-thread-header .cmp-avatar {
	background: rgba(255,255,255,0.25);
	color: #fff;
}
.cmp-chat-back {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 1.2rem;
	cursor: pointer;
	padding: 4px 8px;
}
.cmp-chat-bubbles {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.cmp-chat-date-sep {
	text-align: center;
	margin: 8px 0;
}
.cmp-chat-date-sep span {
	background: rgba(255,255,255,0.85);
	padding: 4px 10px;
	border-radius: 8px;
	font-size: 0.72rem;
	color: #64748b;
}
.cmp-chat-bubble {
	max-width: 78%;
	padding: 8px 10px 4px;
	border-radius: 10px;
	position: relative;
	box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}
.cmp-chat-bubble.cmp-mine {
	align-self: flex-end;
	background: #dcf8c6;
	border-top-right-radius: 2px;
}
.cmp-chat-bubble.cmp-theirs {
	align-self: flex-start;
	background: #fff;
	border-top-left-radius: 2px;
}
.cmp-chat-bubble-body {
	font-size: 0.92rem;
	line-height: 1.4;
	word-wrap: break-word;
}
.cmp-chat-bubble-time {
	text-align: right;
	font-size: 0.65rem;
	color: #64748b;
	margin-top: 2px;
}
.cmp-chat-compose {
	display: flex;
	gap: 8px;
	padding: 10px;
	background: #f0f2f5;
	align-items: flex-end;
}
.cmp-chat-compose textarea {
	flex: 1;
	border: 0;
	border-radius: 20px;
	padding: 10px 14px;
	resize: none;
	min-height: 42px;
	max-height: 120px;
	font: inherit;
}
.cmp-chat-new-panel {
	margin: 12px;
}
@media (max-width: 767px) {
	.cmp-chat-thread:not(.cmp-chat-thread-visible-mobile) .cmp-chat-thread-empty {
		display: none;
	}
	.cmp-chat-list.cmp-chat-list-hidden-mobile {
		display: none;
	}
	.cmp-chat-thread.cmp-chat-thread-visible-mobile {
		display: flex;
		min-height: calc(100vh - 160px);
	}
	.cmp-chat-thread:not(.cmp-chat-thread-visible-mobile) {
		display: none;
	}
}

.cmp-public-logo, .cmp-sidebar-logo, .cmp-topbar-logo, .cmp-brand-logo {
	max-height: 40px;
	width: auto;
	display: block;
	object-fit: contain;
}
.cmp-sidebar-logo { max-height: 48px; }
.cmp-brand-name, .cmp-public-name {
	font-weight: 700;
	font-size: 1.05rem;
	color: inherit;
}
.cmp-topbar-brand-link {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: inherit;
}
.cmp-topbar-page-title {
	font-size: 1rem;
	margin: 0 0 0 8px;
	font-weight: 600;
}
.cmp-sidebar-brand {
	justify-content: center;
}
