:root {
	--phw-green: #35bb4b;
	--phw-green-dark: #25a93e;
	--phw-text: #30343b;
	--phw-muted: #9198a3;
	--phw-surface: #ffffff;
	--phw-row: #f4f6f8;
}

.phw-widget,
.phw-widget * {
	box-sizing: border-box;
}

.phw-widget {
	position: fixed;
	right: 18px;
	right: max(18px, env(safe-area-inset-right));
	bottom: 18px;
	bottom: max(18px, env(safe-area-inset-bottom));
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--phw-text);
}

.phw-panel {
	position: absolute;
	right: 0;
	bottom: 70px;
	display: flex;
	width: min(352px, calc(100vw - 28px));
	max-height: calc(100vh - 106px);
	max-height: calc(100dvh - 70px - max(18px, env(safe-area-inset-top)) - max(18px, env(safe-area-inset-bottom)));
	flex-direction: column;
	overflow: hidden;
	background: var(--phw-surface);
	border-radius: 7px;
	box-shadow: 0 14px 44px rgba(0, 0, 0, 0.28);
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(0.98);
	transform-origin: right bottom;
	transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}

.phw-widget.is-open .phw-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.phw-header {
	display: grid;
	flex: 0 0 auto;
	grid-template-columns: 38px minmax(0, 1fr);
	gap: 14px;
	align-items: start;
	padding: 21px 22px 19px;
	color: #fff;
	background: var(--phw-green);
}

.phw-header h2,
.phw-header p {
	margin: 0;
}

.phw-header h2 {
	font-size: 17px;
	font-weight: 500;
	line-height: 1.3;
}

.phw-header p {
	margin-top: 6px;
	font-size: 12px;
	line-height: 1.55;
	opacity: 0.92;
}

.phw-header-icon {
	width: 36px;
	height: 36px;
}

.phw-account-list {
	flex: 0 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 18px 18px 20px;
	scrollbar-color: #c9ced3 transparent;
	scrollbar-width: thin;
}

.phw-account {
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr) 24px;
	gap: 12px;
	align-items: center;
	min-height: 72px;
	margin-bottom: 12px;
	padding: 8px 12px;
	color: var(--phw-muted);
	text-decoration: none !important;
	background: var(--phw-row);
	border-left: 2px solid var(--phw-green);
	border-radius: 3px;
	transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.phw-account:last-child {
	margin-bottom: 0;
}

.phw-account:hover,
.phw-account:focus-visible {
	color: #68707a;
	background: #edf8ef;
	transform: translateX(2px);
}

.phw-account:focus-visible,
.phw-toggle:focus-visible {
	outline: 3px solid rgba(53, 187, 75, 0.35);
	outline-offset: 3px;
}

.phw-avatar {
	display: grid;
	width: 44px;
	height: 44px;
	place-items: center;
	color: #fff;
	background: #4dce73;
	border: 4px solid #e2e8e5;
	border-radius: 50%;
}

.phw-avatar-icon {
	width: 29px;
	height: 29px;
}

.phw-account-name {
	overflow: hidden;
	font-size: 11px;
	font-weight: 400;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.phw-row-icon {
	width: 20px;
	height: 20px;
	color: #23bd48;
}

.phw-toggle {
	display: grid;
	grid-template-columns: auto 31px;
	gap: 12px;
	width: auto;
	height: 56px;
	margin-left: auto;
	padding: 0 16px 0 20px;
	place-items: center;
	color: #fff;
	background: var(--phw-green);
	border: 0;
	border-radius: 28px;
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
	cursor: pointer;
	transition: background-color 150ms ease, transform 150ms ease;
}

.phw-toggle:hover {
	background: var(--phw-green-dark);
	transform: scale(1.04);
}

.phw-toggle-label {
	display: block;
	grid-area: 1 / 1;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
}

.phw-toggle-open {
	display: grid;
	grid-area: 1 / 2;
	place-items: center;
}

.phw-toggle-icon {
	width: 31px;
	height: 31px;
}

.phw-toggle-close {
	position: relative;
	display: none;
	grid-area: 1 / 1;
	width: 22px;
	height: 22px;
}

.phw-toggle-close::before,
.phw-toggle-close::after {
	position: absolute;
	top: 10px;
	left: 1px;
	width: 20px;
	height: 2px;
	content: "";
	background: currentColor;
	border-radius: 2px;
}

.phw-toggle-close::before {
	transform: rotate(45deg);
}

.phw-toggle-close::after {
	transform: rotate(-45deg);
}

.phw-widget.is-open .phw-toggle-open {
	display: none;
}

.phw-widget.is-open .phw-toggle {
	grid-template-columns: 1fr;
	gap: 0;
	width: 56px;
	padding: 0;
	border-radius: 50%;
}

.phw-widget.is-open .phw-toggle-label {
	display: none;
}

.phw-widget.is-open .phw-toggle-close {
	display: block;
	grid-area: 1 / 1;
}

@media (max-width: 600px) {
	.phw-widget {
		right: max(12px, env(safe-area-inset-right));
		bottom: max(12px, env(safe-area-inset-bottom));
		left: max(12px, env(safe-area-inset-left));
	}

	.phw-panel {
		right: 0;
		bottom: 66px;
		width: 100%;
		max-height: calc(100vh - 90px);
		max-height: calc(100dvh - 66px - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
	}

	.phw-header {
		padding: 17px 17px 15px;
	}

	.phw-account-list {
		padding: 13px 13px 15px;
	}

	.phw-account {
		min-height: 64px;
		margin-bottom: 9px;
	}

	.phw-toggle {
		height: 54px;
	}

	.phw-widget.is-open .phw-toggle {
		width: 54px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.phw-panel,
	.phw-account,
	.phw-toggle {
		transition: none;
	}
}
