/* ── Three-column Telegram-like layout ────────────────────────────── */

[mol_view_root="$xmpp"] > [xmpp] {
	display: flex;
	flex-direction: row;
	height: 100vh;
	width: 100vw;
	overflow: hidden;
}

[xmpp_Login_pane] {
	flex: 1;
	min-width: 0;
}

[xmpp_Folders_pane] {
	width: 84px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	padding: .5rem;
	gap: .25rem;
	background: var(--mol_theme_field);
	border-right: 1px solid var(--mol_theme_line);
	overflow-y: auto;
}

[xmpp_Folders_pane] [xmpp_My_avatar] {
	width: 56px;
	height: 56px;
	margin: 0 auto .5rem auto;
	cursor: pointer;
	transition: filter .15s, transform .15s;
}

[xmpp_Folders_pane] [xmpp_My_avatar]:hover {
	filter: brightness(.7);
	transform: scale(1.05);
}

[xmpp_Folders_spacer] {
	flex: 1;
}

[xmpp_Folder_all],
[xmpp_Folder_chats],
[xmpp_Folder_rooms] {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: .5rem;
	border-radius: .5rem;
	font-size: .8rem;
	color: inherit;
	text-align: center;
}

[xmpp_Folder_all]:hover,
[xmpp_Folder_chats]:hover,
[xmpp_Folder_rooms]:hover,
[xmpp_User_folder_link]:hover {
	background: var(--mol_theme_hover, rgba(0,0,0,.05));
}

[xmpp_Folder_all][mol_link_current="true"],
[xmpp_Folder_chats][mol_link_current="true"],
[xmpp_Folder_rooms][mol_link_current="true"],
[xmpp_User_folder_link][mol_link_current="true"] {
	background: var(--mol_theme_focus, #4a9eff);
	color: var(--mol_theme_card, #fff);
	font-weight: bold;
}

[xmpp_User_folders] {
	display: flex;
	flex-direction: column;
	gap: .15rem;
}

[xmpp_User_folder] {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	gap: .15rem;
}

[xmpp_User_folder_drop] {
	flex: 1;
	min-width: 0;
}

[xmpp_User_folder_link] {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: .4rem .25rem;
	border-radius: .5rem;
	font-size: .75rem;
	color: inherit;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

[xmpp_User_folder_delete] {
	width: 1.4rem;
	min-width: 1.4rem;
	height: 1.4rem;
	padding: 0;
	font-size: .9rem;
	opacity: .4;
	align-self: center;
}

[xmpp_User_folder_delete]:hover {
	opacity: 1;
}

[xmpp_New_folder_zone] {
	margin-top: .25rem;
	padding: .5rem .25rem;
	border: 2px dashed var(--mol_theme_line, rgba(0,0,0,.2));
	border-radius: .5rem;
	font-size: .7rem;
	opacity: .5;
	text-align: center;
}

[xmpp_New_folder_zone][mol_drop_status="drag"],
[xmpp_User_folder_drop][mol_drop_status="drag"] [xmpp_User_folder_link] {
	background: var(--mol_theme_focus, rgba(74,158,255,.15));
	opacity: 1;
}

[xmpp_Roster_contact] {
	display: flex;
	flex-direction: row;
	align-items: center;
	position: relative;
}

[xmpp_Roster_contact_drag] {
	flex: 1;
	min-width: 0;
}

[xmpp_Roster_contact_link] {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: .5rem;
	padding: .5rem .75rem;
	color: inherit;
	justify-content: space-between;
}

[xmpp_Contact_info] {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

[xmpp_Contact_name] {
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

[xmpp_Last_message] {
	font-size: .875rem;
	color: var(--mol_theme_shade, #666);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-top: .125rem;
}

[xmpp_Unread_dot] {
	font-size: 1.2rem;
	color: var(--mol_theme_focus, #4a9eff);
	flex-shrink: 0;
}

[xmpp_Roster_contact_link]:hover {
	background: var(--mol_theme_hover, rgba(0,0,0,.05));
}

[xmpp_Roster_contact][mol_drag_status="drag"] [xmpp_Roster_contact_link] {
	opacity: .4;
}

[xmpp_Roster_contact_drop][mol_drop_status="drag"] [xmpp_Roster_contact_link] {
	background: var(--mol_theme_focus, rgba(74,158,255,.15));
}

[xmpp_Pin_button] {
	flex-shrink: 0;
	width: 1.8rem;
	min-width: 1.8rem;
	padding: 0;
	opacity: 0;
	transition: opacity .15s;
}

[xmpp_Roster_contact]:hover [xmpp_Pin_button],
[xmpp_Roster_contact][xmpp_pinned="true"] [xmpp_Pin_button] {
	opacity: .6;
}

[xmpp_Pin_button]:hover {
	opacity: 1 !important;
}

[xmpp_Roster_contact][xmpp_pinned="true"] [xmpp_Pin_button] {
	color: var(--mol_theme_focus, #4a9eff);
}

[xmpp_Roster_pane] {
	width: 320px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--mol_theme_line);
	overflow: hidden;
}

[xmpp_Roster_header] {
	padding: .5rem 1rem;
	border-bottom: 1px solid var(--mol_theme_line);
	flex-shrink: 0;
}

[xmpp_Roster_static_header] {
	font-weight: bold;
	font-size: 1rem;
}

[xmpp_Roster_folder_header] {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: .5rem;
	width: 100%;
}

[xmpp_Roster_folder_input] {
	flex: 1;
	min-width: 0;
	font-weight: bold;
}

[xmpp_Roster_folder_delete] {
	flex-shrink: 0;
	font-size: .8rem;
	opacity: .6;
}

[xmpp_Roster_folder_delete]:hover {
	opacity: 1;
	color: #d33;
}

[xmpp_Folders_pane] [xmpp_Disconnect_button],
[xmpp_Folders_pane] [xmpp_Settings_button],
[xmpp_Folders_pane] [xmpp_Lights2] {
	min-height: 2rem;
	padding: .35rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ── Settings modal ────────────────────────────────────────────── */

[xmpp_Settings_modal] {
	position: fixed;
	inset: 0;
	z-index: 2000;
	display: flex;
	align-items: center;
	justify-content: center;
}

[xmpp_Settings_dim] {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	cursor: pointer;
}

[xmpp_Settings_dialog] {
	position: relative;
	width: min(560px, 90vw);
	max-height: 90vh;
	overflow-y: auto;
	background: var(--mol_theme_back);
	border: 1px solid var(--mol_theme_line);
	border-radius: .75rem;
	box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
	padding: 1rem 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

[xmpp_Settings_header] {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid var(--mol_theme_line);
	padding-bottom: .5rem;
}

[xmpp_Settings_title] {
	font-size: 1.1rem;
	font-weight: bold;
}

[xmpp_Notif_section],
[xmpp_Sound_section],
[xmpp_Theme_section] {
	display: flex;
	flex-direction: column;
	gap: .5rem;
}

[xmpp_Notif_section_title],
[xmpp_Sound_section_title],
[xmpp_Theme_section_title] {
	font-weight: bold;
	font-size: .9rem;
	opacity: .7;
}

[xmpp_Notif_section] {
	flex-direction: row;
	flex-wrap: wrap;
	gap: .5rem;
	align-items: center;
}

[xmpp_Notif_section_title] {
	width: 100%;
}

[xmpp_Notif_inapp_button],
[xmpp_Notif_system_button] {
	padding: .5rem .9rem;
	border-radius: .5rem;
	border: 1px solid var(--mol_theme_line);
}

[xmpp_Notif_inapp_button][xmpp_active="true"],
[xmpp_Notif_system_button][xmpp_active="true"] {
	background: var(--mol_theme_focus);
	color: var(--mol_theme_card);
	border-color: var(--mol_theme_focus);
}

[xmpp_Sound_section] {
	flex-wrap: wrap;
	flex-direction: row;
	gap: .5rem;
	align-items: center;
}

[xmpp_Sound_section_title] { width: 100%; }

[xmpp_Sound_status] {
	width: 100%;
	font-size: .85rem;
	opacity: .7;
}

[xmpp_Sound_pick_button],
[xmpp_Sound_test_button],
[xmpp_Sound_clear_button] {
	padding: .4rem .7rem;
	border-radius: .4rem;
	border: 1px solid var(--mol_theme_line);
}

[xmpp_Theme_presets] {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: .5rem;
}

[xmpp_Theme_preset] {
	padding: .5rem .9rem;
	border-radius: .5rem;
	border: 1px solid var(--mol_theme_line);
}

[xmpp_Theme_preset][xmpp_active="true"] {
	background: var(--mol_theme_focus);
	color: var(--mol_theme_card);
	border-color: var(--mol_theme_focus);
}

[xmpp_Theme_custom] {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: .75rem;
	padding-top: .5rem;
	border-top: 1px solid var(--mol_theme_line);
}

[xmpp_Theme_color_input] {
	height: 2.5rem;
	width: 4rem;
	cursor: pointer;
	padding: 0;
	border: 1px solid var(--mol_theme_line);
	border-radius: .4rem;
}

[xmpp_Roster_list] {
	flex: 1;
	overflow-y: auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

[xmpp_Chat_pane] {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

[xmpp_Chat_view] {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

[xmpp_Chat_header] {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: .75rem;
	padding: .75rem 1rem;
	border-bottom: 1px solid var(--mol_theme_line);
	flex-shrink: 0;
}

[xmpp_Chat_title] {
	flex: 1;
	font-weight: bold;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

[xmpp_Chat_avatar] {
	margin-right: 0;
}

[xmpp_Messages_area] {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	position: relative;
}

[xmpp_Messages_list] {
	flex: 1;
	overflow-y: auto;
	min-height: 0;
}

[xmpp_Scroll_down_button] {
	position: absolute;
	right: 1rem;
	bottom: 1rem;
	width: 2.5rem;
	height: 2.5rem;
	min-width: 2.5rem;
	border-radius: 50%;
	background: var(--mol_theme_card);
	border: 1px solid var(--mol_theme_line);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	z-index: 10;
}

[xmpp_Scroll_down_button]:hover {
	background: var(--mol_theme_hover, var(--mol_theme_card));
}

[xmpp_Scroll_down_button][hidden] {
	display: none;
}

[xmpp_Compose_pane] {
	display: flex;
	flex-direction: row;
	align-items: flex-end;
	gap: .5rem;
	padding: .75rem 1rem;
	border-top: 1px solid var(--mol_theme_line);
	flex-shrink: 0;
}

[xmpp_Chat_placeholder] {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: .5;
	font-size: 1rem;
}

[xmpp_Search_input] {
	margin: .5rem 1rem;
	flex-shrink: 0;
	flex-grow: 0;
	height: 2.25rem;
	min-height: 2.25rem;
	max-height: 2.25rem;
	box-sizing: border-box;
}

[xmpp_Search_actions] {
	display: flex;
	flex-direction: column;
	gap: .25rem;
	padding: .25rem .5rem .5rem .5rem;
	flex-shrink: 0;
}

[xmpp_Search_actions]:empty {
	display: none;
}

[xmpp_Search_action_chat],
[xmpp_Search_action_room] {
	font-size: .85rem;
	padding: .5rem .75rem;
	border-radius: .5rem;
	background: var(--mol_theme_card);
	text-align: left;
}

[xmpp_Search_action_chat]:hover,
[xmpp_Search_action_room]:hover {
	background: var(--mol_theme_hover, rgba(0,0,0,.05));
}

/* ── Messages ─────────────────────────────────────────────────────── */

[xmpp_Msg] {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	padding: .5rem 1rem;
	gap: .5rem;
}

[xmpp_Msg_avatar] {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--mol_theme_back);
	flex-shrink: 0;
}


[xmpp_Msg_content] {
	display: flex;
	flex-direction: column;
	gap: .25rem;
	flex: 1;
	min-width: 0;
}

[xmpp_Msg_from] {
	font-size: .75rem;
	opacity: .6;
	font-weight: bold;
}

[xmpp_Msg_body] {
	padding: .4rem .7rem;
	border-radius: .5rem;
	background: var(--mol_theme_card, #f0f0f0);
	max-width: 80%;
	word-break: break-word;
}

[xmpp_Compose_input] {
	flex: 1;
	min-height: 2.5rem;
	max-height: 8rem;
	resize: vertical;
	overflow: auto;
	white-space: pre-wrap;
	word-break: break-word;
	font: inherit;
}

[xmpp_Msg_head] {
	display: flex;
	flex-direction: row;
	align-items: baseline;
	gap: .5rem;
}

[xmpp_Msg_time] {
	font-size: .7rem;
	opacity: .5;
	margin-left: auto;
}

/* media */

[xmpp_Msg_media]:empty {
	display: none;
}

[xmpp_Msg_image] {
	display: block;
	max-width: min(320px, 80%);
	max-height: 240px;
	border-radius: .5rem;
	object-fit: contain;
	cursor: pointer;
}

[xmpp_Msg_audio] {
	max-width: min(320px, 80%);
	display: block;
}

[xmpp_Msg_link] {
	font-size: .85rem;
	opacity: .8;
}

[xmpp_Msg_status] {
	align-self: flex-end;
	font-size: .75rem;
	opacity: .6;
	color: var(--mol_theme_focus, #4a9eff);
	line-height: 1;
}

[xmpp_Msg_status]:empty {
	display: none;
}

[xmpp_My_avatar],
[xmpp_Contact_avatar],
[xmpp_Chat_avatar] {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--mol_theme_back);
	flex-shrink: 0;
}

[xmpp_Chat_avatar] {
	margin-right: .5rem;
}


[xmpp_Contact_label] {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

[xmpp_Room_join_form] {
	margin-top: 1rem;
}

[xmpp_Toasts] {
	position: fixed;
	top: 1rem;
	right: 1rem;
	display: flex;
	flex-direction: column;
	gap: .5rem;
	z-index: 1000;
	pointer-events: none;
	max-width: 360px;
}

[xmpp_Toast] {
	position: relative;
	pointer-events: auto;
	cursor: pointer;
	flex-direction: column;
	align-items: stretch;
	text-align: left;
	background: var(--mol_theme_card);
	border-left: 3px solid var(--mol_theme_focus, #4a9eff);
	padding: .6rem 2rem .6rem .9rem;
	box-shadow: 0 4px 12px rgba(0,0,0,0.18);
	min-width: 240px;
	animation: xmpp_toast_in .2s ease-out;
}

[xmpp_Toast_close] {
	position: absolute;
	top: .2rem;
	right: .35rem;
	width: 1.4rem;
	height: 1.4rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	cursor: pointer;
	opacity: .5;
	font-size: 1.1rem;
	line-height: 1;
	user-select: none;
}

[xmpp_Toast_close]:hover {
	opacity: 1;
	background: rgba(0,0,0,0.1);
}

@keyframes xmpp_toast_in {
	from { transform: translateX(120%); opacity: 0; }
	to   { transform: translateX(0);     opacity: 1; }
}

[xmpp_Toast_title] {
	font-weight: bold;
	font-size: .9rem;
	margin-bottom: .2rem;
}

[xmpp_Toast_body] {
	font-size: .85rem;
	opacity: .8;
	word-break: break-word;
	max-height: 4em;
	overflow: hidden;
}
