
.tw3-chat-widget {
	position: fixed;
	right: 20px;
	bottom: 22px;
	z-index: 999990;
	font-family: Inter, "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tw3-chat-launcher {
	position: relative;
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 54px;
	padding: 0 18px 0 14px;
	border: 1px solid rgba(255,255,255,.32);
	border-radius: 999px;
	color: #fff;
	background: linear-gradient(125deg,#0284c7,#2563eb);
	box-shadow: 0 18px 42px rgba(37,99,235,.30);
	font-size: 14px;
	font-weight: 900;
	cursor: pointer;
}

.tw3-chat-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 22px 48px rgba(37,99,235,.38);
}

.tw3-chat-launcher__pulse {
	position: absolute;
	inset: -5px;
	z-index: -1;
	border-radius: inherit;
	background: rgba(14,165,233,.20);
	animation: tw3-chat-pulse 2.4s ease-out infinite;
}

.tw3-chat-launcher__icon {
	display: grid;
	place-items: center;
}

.tw3-chat-launcher__badge {
	position: absolute;
	top: -8px;
	right: -4px;
	display: grid;
	place-items: center;
	min-width: 24px;
	height: 24px;
	padding: 0 5px;
	border: 2px solid #fff;
	border-radius: 999px;
	color: #fff;
	background: #ef4444;
	font-size: 11px;
}

.tw3-chat-panel {
	position: absolute;
	right: 0;
	bottom: 68px;
	display: flex;
	flex-direction: column;
	width: min(390px, calc(100vw - 26px));
	height: min(650px, calc(100vh - 110px));
	overflow: hidden;
	border: 1px solid rgba(148,163,184,.20);
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 30px 90px rgba(15,23,42,.28);
	animation: tw3-chat-open .22s ease both;
}

.tw3-chat-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px;
	color: #fff;
	background:
		radial-gradient(circle at 90% 0%,rgba(34,211,238,.28),transparent 180px),
		linear-gradient(135deg,#07192d,#0f4d7f);
}

.tw3-chat-brand {
	display: flex;
	align-items: center;
	gap: 11px;
}

.tw3-chat-brand__mark {
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border: 1px solid rgba(255,255,255,.20);
	border-radius: 14px;
	color: #fff;
	background: rgba(255,255,255,.10);
	font-size: 22px;
	font-weight: 950;
}

.tw3-chat-brand strong,
.tw3-chat-brand small {
	display: block;
}

.tw3-chat-brand strong {
	font-size: 15px;
}

.tw3-chat-brand small {
	margin-top: 3px;
	color: #bde5fa;
	font-size: 10px;
}

.tw3-chat-brand small i {
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 4px;
	border-radius: 50%;
	background: #4ade80;
}

.tw3-chat-close {
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: #fff;
	background: rgba(255,255,255,.08);
	font-size: 25px;
	cursor: pointer;
}

.tw3-chat-welcome {
	padding: 14px 18px;
	border-bottom: 1px solid #e8eef5;
	color: #52647b;
	background: #f7fafc;
	font-size: 12px;
	line-height: 1.65;
}

.tw3-chat-welcome p {
	margin: 0;
}

.tw3-chat-identity {
	display: grid;
	gap: 13px;
	padding: 20px;
	overflow: auto;
}

.tw3-chat-identity label {
	display: grid;
	gap: 6px;
}

.tw3-chat-identity label span {
	color: #40536b;
	font-size: 11px;
	font-weight: 900;
}

.tw3-chat-identity input {
	width: 100%;
	min-height: 46px;
	padding: 0 13px;
	border: 1px solid #d7e1ed;
	border-radius: 12px;
	color: #17233a;
	background: #fbfdff;
	box-sizing: border-box;
}

.tw3-chat-identity button {
	min-height: 48px;
	border: 0;
	border-radius: 13px;
	color: #fff;
	background: linear-gradient(125deg,#0284c7,#2563eb);
	font-weight: 900;
	cursor: pointer;
}

.tw3-chat-identity small {
	color: #7b8ca1;
	font-size: 10px;
	line-height: 1.55;
}

.tw3-chat-conversation {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
}

.tw3-chat-messages,
.tw3-chat-thread__messages {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 11px;
	overflow: auto;
	padding: 18px;
	background:
		linear-gradient(rgba(246,249,252,.94),rgba(246,249,252,.94)),
		radial-gradient(circle at 20% 10%,#dff5ff,transparent 180px);
}

.tw3-chat-empty,
.tw3-chat-center-empty {
	margin: auto;
	color: #8291a5;
	font-size: 12px;
	text-align: center;
}

.tw3-chat-message {
	max-width: 82%;
}

.tw3-chat-message > div {
	padding: 11px 13px;
	border-radius: 15px;
	font-size: 13px;
	line-height: 1.55;
	word-break: break-word;
}

.tw3-chat-message time {
	display: block;
	margin-top: 4px;
	color: #94a3b8;
	font-size: 9px;
}

.tw3-chat-message--customer {
	align-self: flex-end;
}

.tw3-chat-message--customer > div {
	color: #fff;
	border-bottom-right-radius: 4px;
	background: linear-gradient(125deg,#0284c7,#2563eb);
}

.tw3-chat-message--customer time {
	text-align: right;
}

.tw3-chat-message--admin {
	align-self: flex-start;
}

.tw3-chat-message--admin > div {
	color: #27364a;
	border: 1px solid #dce6f0;
	border-bottom-left-radius: 4px;
	background: #fff;
}

.tw3-chat-composer,
.tw3-chat-thread__composer {
	display: grid;
	grid-template-columns: minmax(0,1fr) auto;
	gap: 9px;
	padding: 12px;
	border-top: 1px solid #e4ebf3;
	background: #fff;
}

.tw3-chat-composer textarea,
.tw3-chat-thread__composer textarea {
	width: 100%;
	min-height: 46px;
	max-height: 130px;
	padding: 11px 12px;
	border: 1px solid #d7e1ed;
	border-radius: 13px;
	color: #17233a;
	background: #f9fbfd;
	resize: none;
	box-sizing: border-box;
}

.tw3-chat-composer button {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 14px;
	color: #fff;
	background: linear-gradient(125deg,#0284c7,#2563eb);
	cursor: pointer;
}

/* Admin center */
.tw3-chat-center {
	width: min(calc(100% - 28px), 1420px);
	margin: 30px auto 70px;
	color: #122033;
	font-family: Inter, "Noto Sans TC", system-ui, sans-serif;
}

.tw3-chat-center__header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
	padding: 30px 34px;
	border-radius: 25px;
	color: #fff;
	background:
		radial-gradient(circle at 85% 0%,rgba(34,211,238,.25),transparent 280px),
		linear-gradient(135deg,#06162a,#0e426f);
	box-shadow: 0 22px 60px rgba(15,42,70,.18);
}

.tw3-chat-center__header span {
	color: #7dd3fc;
	font-size: 10px;
	font-weight: 900;
	letter-spacing: .18em;
}

.tw3-chat-center__header h1 {
	margin: 5px 0 8px;
	color: #fff;
	font-size: clamp(32px,5vw,54px);
	letter-spacing: -.05em;
}

.tw3-chat-center__header p {
	margin: 0;
	color: #c7d8ea;
}

.tw3-chat-center__header a {
	padding: 10px 14px;
	border: 1px solid rgba(255,255,255,.16);
	border-radius: 12px;
	color: #fff;
	background: rgba(255,255,255,.08);
	text-decoration: none;
}

.tw3-chat-center__layout {
	display: grid;
	grid-template-columns: 390px minmax(0,1fr);
	min-height: 720px;
	margin-top: 20px;
	overflow: hidden;
	border: 1px solid #dce6f0;
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 18px 50px rgba(21,43,71,.08);
}

.tw3-chat-inbox {
	border-right: 1px solid #e1e9f2;
	background: #f7fafc;
}

.tw3-chat-inbox__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 17px;
	border-bottom: 1px solid #e1e9f2;
}

.tw3-chat-inbox__toolbar button,
.tw3-chat-thread__header button {
	padding: 8px 11px;
	border: 1px solid #d6e1ec;
	border-radius: 10px;
	color: #36516d;
	background: #fff;
	font-weight: 800;
	cursor: pointer;
}

.tw3-chat-inbox__list {
	max-height: 665px;
	overflow: auto;
}

.tw3-chat-inbox-item {
	display: grid;
	grid-template-columns: 46px minmax(0,1fr) auto;
	gap: 11px;
	width: 100%;
	padding: 14px 15px;
	border: 0;
	border-bottom: 1px solid #e4ebf3;
	color: inherit;
	background: transparent;
	text-align: left;
	cursor: pointer;
}

.tw3-chat-inbox-item:hover,
.tw3-chat-inbox-item.is-active {
	background: #edf8fe;
}

.tw3-chat-inbox-item__avatar {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border-radius: 14px;
	color: #075985;
	background: linear-gradient(145deg,#dff5ff,#e9efff);
	font-weight: 950;
}

.tw3-chat-inbox-item__content {
	display: grid;
	min-width: 0;
	gap: 4px;
}

.tw3-chat-inbox-item__content strong {
	color: #17243a;
}

.tw3-chat-inbox-item__content small {
	overflow: hidden;
	color: #73859b;
	font-size: 11px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tw3-chat-inbox-item__meta {
	display: grid;
	justify-items: end;
	gap: 4px;
}

.tw3-chat-inbox-item__meta time {
	color: #8b9bb0;
	font-size: 9px;
}

.tw3-chat-inbox-item__meta b {
	display: grid;
	place-items: center;
	min-width: 20px;
	height: 20px;
	border-radius: 999px;
	color: #fff;
	background: #ef4444;
	font-size: 10px;
}

.tw3-chat-inbox-item__meta i {
	padding: 3px 6px;
	border-radius: 999px;
	font-size: 8px;
	font-style: normal;
	font-weight: 900;
}

.tw3-chat-inbox-item__meta i.is-open {
	color: #047857;
	background: #d1fae5;
}

.tw3-chat-inbox-item__meta i.is-closed {
	color: #64748b;
	background: #e2e8f0;
}

.tw3-chat-thread {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.tw3-chat-thread__empty {
	display: grid;
	place-items: center;
	margin: auto;
	color: #8291a5;
	text-align: center;
}

.tw3-chat-thread__empty span {
	font-size: 48px;
}

.tw3-chat-thread__empty h2 {
	margin: 10px 0 5px;
	color: #26364c;
}

.tw3-chat-thread__empty p {
	margin: 0;
}

.tw3-chat-thread__active {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
}

.tw3-chat-thread__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 17px 20px;
	border-bottom: 1px solid #e1e9f2;
}

.tw3-chat-thread__header strong,
.tw3-chat-thread__header small {
	display: block;
}

.tw3-chat-thread__header small {
	margin-top: 3px;
	color: #718096;
	font-size: 11px;
}

.tw3-chat-thread__messages {
	min-height: 550px;
}

.tw3-chat-thread__composer {
	padding: 14px;
}

.tw3-chat-thread__composer button {
	min-width: 110px;
	border: 0;
	border-radius: 13px;
	color: #fff;
	background: linear-gradient(125deg,#0284c7,#2563eb);
	font-weight: 900;
	cursor: pointer;
}

@keyframes tw3-chat-pulse {
	from { opacity:.7; transform:scale(.92); }
	to { opacity:0; transform:scale(1.25); }
}

@keyframes tw3-chat-open {
	from { opacity:0; transform:translateY(12px) scale(.98); }
	to { opacity:1; transform:translateY(0) scale(1); }
}

@media (max-width: 850px) {
	.tw3-chat-center__layout {
		grid-template-columns: 1fr;
	}

	.tw3-chat-inbox {
		border-right: 0;
		border-bottom: 1px solid #e1e9f2;
	}

	.tw3-chat-inbox__list {
		max-height: 330px;
	}

	.tw3-chat-thread__messages {
		min-height: 420px;
	}
}

@media (max-width: 560px) {
	.tw3-chat-widget {
		right: 10px;
		bottom: 12px;
	}

	.tw3-chat-launcher {
		width: 54px;
		padding: 0;
		justify-content: center;
	}

	.tw3-chat-launcher__text {
		display: none;
	}

	.tw3-chat-panel {
		position: fixed;
		inset: 8px;
		width: auto;
		height: auto;
		max-height: none;
		border-radius: 20px;
	}

	.tw3-chat-center {
		width: min(calc(100% - 14px),100%);
		margin-top: 10px;
	}

	.tw3-chat-center__header {
		align-items: flex-start;
		flex-direction: column;
		padding: 20px;
	}

	.tw3-chat-center__layout {
		min-height: 0;
	}

	.tw3-chat-thread__messages {
		min-height: 380px;
	}

	.tw3-chat-thread__composer {
		grid-template-columns: 1fr;
	}

	.tw3-chat-thread__composer button {
		min-height: 46px;
	}
}


/* ==========================================================
   v1.1.0 DIRECT MESSAGE + LAYOUT RESET
   ========================================================== */

/* Author CSS must never override the hidden attribute again. */
.tw3-chat-widget [hidden],
.tw3-chat-panel[hidden],
.tw3-chat-launcher__badge[hidden] {
	display: none !important;
}

.tw3-chat-widget,
.tw3-chat-widget *,
.tw3-chat-panel,
.tw3-chat-panel * {
	box-sizing: border-box;
}

.tw3-chat-panel {
	right: 0 !important;
	bottom: 68px !important;
	width: min(380px, calc(100vw - 24px)) !important;
	height: min(540px, calc(100dvh - 105px)) !important;
	max-height: 540px !important;
	min-height: 390px !important;
	overflow: hidden !important;
}

.tw3-chat-panel__header {
	flex: 0 0 auto;
	min-height: 74px;
	padding: 14px 16px !important;
}

.tw3-chat-brand__mark {
	width: 40px !important;
	height: 40px !important;
	flex: 0 0 40px;
}

.tw3-chat-close {
	flex: 0 0 38px;
}

.tw3-chat-welcome {
	flex: 0 0 auto;
	padding: 11px 16px !important;
	font-size: 11px !important;
}

.tw3-chat-conversation {
	display: flex !important;
	flex: 1 1 auto !important;
	flex-direction: column !important;
	min-height: 0 !important;
	overflow: hidden !important;
}

.tw3-chat-messages {
	flex: 1 1 auto !important;
	min-height: 0 !important;
	overflow-y: auto !important;
	padding: 14px !important;
}

.tw3-chat-empty {
	display: grid;
	gap: 5px;
	margin: auto;
	padding: 24px 16px;
}

.tw3-chat-empty strong {
	color: #334155;
	font-size: 14px;
}

.tw3-chat-empty span {
	color: #94a3b8;
	font-size: 11px;
}

.tw3-chat-offline-note {
	display: flex;
	flex: 0 0 auto;
	align-items: flex-start;
	gap: 7px;
	padding: 8px 13px;
	border-top: 1px solid #e5edf5;
	color: #7b8ca1;
	background: #f8fafc;
	font-size: 9px;
	line-height: 1.45;
}

.tw3-chat-offline-note > span {
	width: 6px;
	height: 6px;
	margin-top: 3px;
	flex: 0 0 6px;
	border-radius: 50%;
	background: #f59e0b;
}

.tw3-chat-composer {
	flex: 0 0 auto !important;
	grid-template-columns: minmax(0, 1fr) 46px !important;
	align-items: end;
	gap: 8px !important;
	padding: 10px !important;
}

.tw3-chat-composer textarea {
	display: block;
	min-height: 46px !important;
	max-height: 96px !important;
	margin: 0 !important;
	padding: 11px 12px !important;
	border-radius: 13px !important;
	font-size: 13px !important;
	line-height: 1.45 !important;
}

.tw3-chat-composer button {
	width: 46px !important;
	height: 46px !important;
	min-height: 46px !important;
	margin: 0 !important;
	border-radius: 13px !important;
}

@media (max-width: 560px) {
	.tw3-chat-widget {
		right: 10px !important;
		bottom: 12px !important;
	}

	.tw3-chat-panel {
		position: fixed !important;
		inset: auto 8px 76px 8px !important;
		width: auto !important;
		height: min(520px, calc(100dvh - 96px)) !important;
		max-height: min(520px, calc(100dvh - 96px)) !important;
		min-height: 360px !important;
		border-radius: 19px !important;
	}

	.tw3-chat-panel__header {
		min-height: 66px;
		padding: 12px 14px !important;
	}

	.tw3-chat-brand__mark {
		width: 38px !important;
		height: 38px !important;
		flex-basis: 38px;
	}

	.tw3-chat-brand strong {
		font-size: 14px !important;
	}

	.tw3-chat-welcome {
		padding: 9px 13px !important;
	}

	.tw3-chat-messages {
		padding: 12px !important;
	}

	.tw3-chat-offline-note {
		padding: 7px 11px;
	}

	.tw3-chat-composer {
		padding: 9px !important;
	}
}

@media (max-height: 600px) and (max-width: 560px) {
	.tw3-chat-panel {
		height: calc(100dvh - 88px) !important;
		max-height: calc(100dvh - 88px) !important;
		bottom: 72px !important;
	}
}


/* ==========================================================
   v1.1.1 MOBILE PURCHASE BAR COLLISION FIX
   ========================================================== */

:root {
	--tw3-chat-mobile-obstruction: 0px;
}

/*
 * On the homepage, the theme displays a fixed mobile purchase bar.
 * Move both the launcher and the open chat panel above its measured height.
 */
@media (max-width: 720px) {
	body.home.tw3-chat-has-mobile-offer .tw3-chat-widget {
		bottom: calc(var(--tw3-chat-mobile-obstruction, 92px) + env(safe-area-inset-bottom, 0px)) !important;
	}

	body.home.tw3-chat-has-mobile-offer .tw3-chat-panel {
		inset: auto 8px calc(var(--tw3-chat-mobile-obstruction, 92px) + 66px + env(safe-area-inset-bottom, 0px)) 8px !important;
		height: min(
			500px,
			calc(100dvh - var(--tw3-chat-mobile-obstruction, 92px) - 86px)
		) !important;
		max-height: calc(
			100dvh - var(--tw3-chat-mobile-obstruction, 92px) - 86px
		) !important;
		min-height: 300px !important;
	}

	/*
	 * Reserve document space so the final homepage content is not concealed
	 * behind both fixed controls.
	 */
	body.home.tw3-chat-has-mobile-offer {
		padding-bottom: calc(var(--tw3-chat-mobile-obstruction, 92px) + 12px);
	}
}

@media (max-width: 420px) {
	body.home.tw3-chat-has-mobile-offer .tw3-chat-panel {
		right: 6px !important;
		left: 6px !important;
		height: min(
			470px,
			calc(100dvh - var(--tw3-chat-mobile-obstruction, 92px) - 78px)
		) !important;
		max-height: calc(
			100dvh - var(--tw3-chat-mobile-obstruction, 92px) - 78px
		) !important;
	}
}

@media (max-height: 620px) and (max-width: 720px) {
	body.home.tw3-chat-has-mobile-offer .tw3-chat-panel {
		height: calc(
			100dvh - var(--tw3-chat-mobile-obstruction, 92px) - 74px
		) !important;
		max-height: calc(
			100dvh - var(--tw3-chat-mobile-obstruction, 92px) - 74px
		) !important;
		min-height: 260px !important;
	}
}
