/* ══ Rise chat (Discord-style DMs) ═══════════════════════════════ */
.rise-chat {
	display: grid;
	grid-template-columns: minmax(220px, 280px) 1fr minmax(0, 260px);
	height: 100%;
	min-height: 0;
	background: var(--bg);
	color: var(--text);
	overflow: hidden;
}

.rise-chat__side,
.rise-chat__main,
.rise-chat__profile {
	min-height: 0;
	min-width: 0;
}

.rise-chat__side {
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--line);
	background: color-mix(in srgb, var(--shell) 88%, transparent);
}

.rise-chat__side-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem;
	padding: 1rem 1rem 0.7rem;
}

.rise-chat__side-head h1 {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	margin: 0;
	font-size: 1.05rem;
	font-weight: 740;
	letter-spacing: -0.02em;
}

.rise-chat__side-head .lucide {
	width: 18px;
	height: 18px;
	color: var(--accent);
}

.rise-chat__iconbtn {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border: 1px solid var(--line);
	border-radius: var(--r-sm, 8px);
	background: var(--surface-2);
	color: var(--text-dim);
	cursor: pointer;
	transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.rise-chat__iconbtn:hover {
	background: var(--accent-low);
	color: var(--accent);
}

.rise-chat__iconbtn .lucide {
	width: 16px;
	height: 16px;
}

.rise-chat__search {
	padding: 0 0.85rem 0.7rem;
}

.rise-chat__search input {
	width: 100%;
	height: 36px;
	padding: 0 0.75rem;
	border: 1px solid var(--line);
	border-radius: var(--r-sm, 8px);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 0.84rem;
}

.rise-chat__people {
	margin-top: 0.45rem;
	max-height: 220px;
	overflow: auto;
}

.rise-chat__person,
.rise-chat__convo {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	padding: 0.55rem 0.65rem;
	border: none;
	border-radius: var(--r-sm, 8px);
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: background 0.18s var(--ease);
}

.rise-chat__person:hover,
.rise-chat__convo:hover,
.rise-chat__convo.on {
	background: var(--surface-2);
}

.rise-chat__person strong,
.rise-chat__convo-text strong {
	display: block;
	font-size: 0.86rem;
	font-weight: 680;
}

.rise-chat__person small,
.rise-chat__convo-text small {
	display: block;
	color: var(--text-mute);
	font-size: 0.72rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 140px;
}

.rise-chat__convos {
	flex: 1;
	overflow: auto;
	padding: 0.35rem 0.55rem 1rem;
}

.rise-chat__convo-time {
	margin-left: auto;
	color: var(--text-mute);
	font-size: 0.66rem;
	white-space: nowrap;
}

.rise-chat__av {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--surface-3, var(--surface-2));
	border: 1px solid var(--line);
	flex-shrink: 0;
	color: var(--accent);
	font-weight: 720;
}

.rise-chat__av img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.rise-chat__av--lg {
	width: 88px;
	height: 88px;
	font-size: 1.6rem;
}

.rise-chat__main {
	display: flex;
	flex-direction: column;
	background: var(--bg);
}

.rise-chat__empty {
	margin: auto;
	display: grid;
	place-items: center;
	gap: 0.7rem;
	color: var(--text-mute);
	text-align: center;
	padding: 2rem;
}

.rise-chat__empty .lucide {
	width: 36px;
	height: 36px;
	color: var(--accent);
	opacity: 0.8;
}

.rise-chat__thread-head {
	display: flex;
	align-items: center;
	padding: 0.85rem 1.1rem;
	border-bottom: 1px solid var(--line);
	background: color-mix(in srgb, var(--shell) 90%, transparent);
}

.rise-chat__peerbtn {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	border: none;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
	text-align: left;
}

.rise-chat__peerbtn strong {
	display: block;
	font-size: 0.95rem;
}

.rise-chat__peerbtn small {
	color: var(--text-mute);
	font-size: 0.74rem;
}

.rise-chat__thread {
	flex: 1;
	overflow: auto;
	padding: 1.1rem 1.2rem;
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
}

.rise-chat__bubble {
	align-self: flex-start;
	max-width: min(70%, 520px);
	padding: 0.55rem 0.8rem;
	border: 1px solid var(--line);
	border-radius: 14px 14px 14px 6px;
	background: var(--surface-2);
}

.rise-chat__bubble.mine {
	align-self: flex-end;
	border-radius: 14px 14px 6px 14px;
	background: var(--accent-low);
	border-color: rgb(var(--accent-rgb) / 0.28);
}

.rise-chat__bubble p {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.4;
	white-space: pre-wrap;
	word-break: break-word;
}

.rise-chat__bubble time {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.66rem;
	color: var(--text-mute);
}

.rise-chat__composer {
	display: flex;
	align-items: flex-end;
	gap: 0.55rem;
	padding: 0.85rem 1.1rem 1.1rem;
	border-top: 1px solid var(--line);
	background: color-mix(in srgb, var(--shell) 92%, transparent);
}

.rise-chat__composer textarea {
	flex: 1;
	resize: none;
	min-height: 42px;
	max-height: 140px;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--line);
	border-radius: var(--r, 10px);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 0.9rem;
}

.rise-chat__send {
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border: none;
	border-radius: var(--r-sm, 8px);
	background: var(--accent);
	color: #fff;
	cursor: pointer;
}

.rise-chat__send .lucide {
	width: 18px;
	height: 18px;
}

.rise-chat__profile {
	position: relative;
	border-left: 1px solid var(--line);
	background: color-mix(in srgb, var(--shell) 90%, transparent);
	padding: 1.2rem;
}

.rise-chat__profile[hidden] {
	display: none !important;
}

.rise-chat__close {
	position: absolute;
	top: 0.8rem;
	right: 0.8rem;
}

.rise-chat__card {
	display: grid;
	justify-items: center;
	gap: 0.45rem;
	text-align: center;
	padding-top: 1.4rem;
}

.rise-chat__card h2 {
	margin: 0.4rem 0 0;
	font-size: 1.2rem;
	letter-spacing: -0.02em;
}

.rise-chat__role {
	margin: 0;
	color: var(--accent);
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.rise-chat__bio {
	margin: 0.4rem 0 0.8rem;
	color: var(--text-dim);
	font-size: 0.86rem;
	line-height: 1.45;
}

.rise-chat__cta {
	padding: 0.5rem 1rem;
	border: 1px solid var(--line-2);
	border-radius: var(--r-sm, 8px);
	background: var(--accent-low);
	color: var(--accent);
	font: inherit;
	font-weight: 680;
	cursor: pointer;
}

.rise-chat__muted {
	margin: 0.6rem;
	color: var(--text-mute);
	font-size: 0.78rem;
}

@media (max-width: 900px) {
	.rise-chat {
		grid-template-columns: minmax(200px, 240px) 1fr;
	}
	.rise-chat__profile {
		position: absolute;
		inset: 0 0 0 auto;
		width: min(280px, 85vw);
		z-index: 5;
		box-shadow: -12px 0 40px rgb(0 0 0 / 0.35);
	}
}

@media (max-width: 640px) {
	.rise-chat {
		grid-template-columns: 1fr;
	}
	.rise-chat__side {
		display: none;
	}
}
