.aja-wrap, .aja-wrap * {
	box-sizing: border-box;
}
.aja-wrap {
	--aja-primary: #4d6bfe;
	--aja-secondary: #1c2b4a;
	--aja-size: 60px;
	--aja-bottom: 20px;
	--aja-side-offset: 20px;
	position: fixed;
	bottom: var(--aja-bottom);
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.4;
	/* Isolate the widget's own stacking context so page content behind it can
	 * never paint-order-mix with it in a buggy Android in-app WebView. (No
	 * transform/filter/will-change here on purpose: .aja-panel switches to
	 * position:fixed for the mobile keyboard-fit state below, and any of
	 * those properties on this ancestor would silently change .aja-panel's
	 * containing block from the real viewport to this element's own box.) */
	isolation: isolate;
}
.aja-wrap.aja-side-right { right: var(--aja-side-offset); }
.aja-wrap.aja-side-left  { left: var(--aja-side-offset); }

/* Reset theme button/input styling from leaking into the widget */
.aja-wrap button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	font-family: inherit;
}
.aja-wrap input,
.aja-wrap textarea {
	all: revert;
	box-sizing: border-box;
	font-family: inherit;
}
.aja-wrap [hidden] { display: none !important; }

/* ================= Launcher button ================= */
.aja-button {
	width: var(--aja-size) !important;
	height: var(--aja-size) !important;
	border-radius: 50% !important;
	background: linear-gradient(135deg, var(--aja-primary), var(--aja-secondary)) !important;
	color: #fff !important;
	box-shadow: 0 10px 28px rgba(0,0,0,.22) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	position: relative !important;
	overflow: visible !important;
	transition: transform .2s ease, box-shadow .2s ease !important;
}
.aja-button:hover { transform: scale(1.06) !important; box-shadow: 0 14px 32px rgba(0,0,0,.28) !important; }
.aja-button svg {
	display: block !important; visibility: visible !important; opacity: 1 !important;
	width: 50% !important; height: 50% !important; min-width: 18px !important; min-height: 18px !important;
	fill: currentColor !important; color: inherit !important; pointer-events: none !important;
}
.aja-btn-icon {
	position: absolute; inset: 0;
	display: flex !important; align-items: center !important; justify-content: center !important;
	border-radius: 50%; overflow: hidden;
	transition: opacity .2s, transform .2s;
}
.aja-button.aja-has-custom-icon {
	/* Keep the launcher itself identical to the built-in button so the online
	 * badge can sit outside the circle without being clipped. */
	border-radius: 50% !important;
	overflow: visible !important;
}
.aja-button.aja-has-custom-icon .aja-btn-icon.aja-icon-open {
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	border-radius: 50% !important;
	overflow: hidden !important;
	clip-path: circle(50% at 50% 50%);
	-webkit-clip-path: circle(50% at 50% 50%);
}
.aja-button.aja-has-custom-icon .aja-btn-icon.aja-icon-open img {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	min-width: 100% !important;
	min-height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	object-fit: cover !important;
	object-position: center center !important;
	display: block !important;
	clip-path: circle(50% at 50% 50%);
	-webkit-clip-path: circle(50% at 50% 50%);
}
/* Keep the launcher status dot exactly like the built-in icon. */
.aja-button.aja-has-custom-icon .aja-badge {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	z-index: 20 !important;
}
/* A transparent custom PNG/SVG should remain truly transparent. The launcher
 * gradient must not bleed through the transparent pixels of the uploaded logo. */
.aja-wrap:not(.aja-open) .aja-button.aja-has-custom-icon {
	background: transparent !important;
	box-shadow: 0 10px 28px rgba(0,0,0,.22) !important;
}
.aja-wrap:not(.aja-open) .aja-button.aja-has-custom-icon .aja-icon-open {
	border-radius: 50% !important; overflow: hidden !important;
}
.aja-wrap:not(.aja-open).aja-anim-pulse .aja-button.aja-has-custom-icon::after {
	display: none !important;
}
.aja-icon-close { opacity: 0; transform: scale(.5) rotate(-45deg); }
.aja-icon-close svg { width: 42%; height: 42%; }
.aja-wrap.aja-open .aja-icon-open { opacity: 0; transform: scale(.5) rotate(45deg); }
.aja-wrap.aja-open .aja-icon-close { opacity: 1; transform: scale(1) rotate(0); }

.aja-anim-bounce .aja-button { animation: aja-bounce 2.6s ease-in-out infinite; }
.aja-anim-pulse .aja-button::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(77,107,254,.5);
	animation: aja-pulse 2s infinite;
}
@keyframes aja-bounce { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-6px);} }
@keyframes aja-pulse { 0%{ box-shadow:0 0 0 0 rgba(77,107,254,.45);} 70%{ box-shadow:0 0 0 14px rgba(77,107,254,0);} 100%{ box-shadow:0 0 0 0 rgba(77,107,254,0);} }

.aja-badge {
	position: absolute; top: -2px; right: -2px;
	width: 13px; height: 13px; border-radius: 50%;
	background: #22c55e; border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0,0,0,.05);
	z-index: 5; pointer-events: none;
}

/* ================= Panel shell ================= */
.aja-panel {
	position: absolute;
	bottom: calc(var(--aja-size) + 18px);
	width: 370px; max-width: calc(100vw - 32px);
	height: auto; max-height: 75vh;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 20px 56px rgba(15,23,42,.24);
	overflow: hidden;
	display: flex; flex-direction: column;
	opacity: 0; transform: translateY(18px) scale(.97);
	pointer-events: none;
	transition: opacity .22s ease, transform .22s ease;
	/* Backstop so an inner scroll can never chain out to the page/app shell
	 * and trigger a WebView's pull-to-refresh, even if a specific inner
	 * element's own touch handling is ever bypassed. */
	overscroll-behavior: contain;
}
.aja-wrap.aja-dm-active .aja-panel { height: min(70vh, 560px); }
.aja-wrap.aja-side-right .aja-panel { right: 0; }
.aja-wrap.aja-side-left  .aja-panel { left: 0; }
.aja-wrap.aja-open .aja-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.aja-panel-header {
	background: linear-gradient(135deg, var(--aja-primary), var(--aja-secondary));
	color: #fff; padding: 22px 22px 20px; flex: none;
	display: flex; align-items: center; gap: 12px;
}
.aja-panel-avatar {
	width: 40px; height: 40px; border-radius: 50%; flex: none;
	background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center;
	overflow: hidden; font-weight: 700; font-size: 15px;
}
.aja-panel-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; -webkit-mask-image: -webkit-radial-gradient(white, black); mask-image: radial-gradient(circle at center, #000 99.4%, transparent 100%); }
.aja-panel-avatar.aja-has-custom-icon { background: transparent; }
.aja-panel-header-text { min-width: 0; }
.aja-panel-close {
	width: 34px !important; height: 34px !important; margin-left: auto !important; flex: none !important;
	display: flex !important; align-items: center !important; justify-content: center !important;
	border-radius: 50% !important; color: #fff !important; background: rgba(255,255,255,.16) !important;
	-webkit-tap-highlight-color: transparent !important;
}
.aja-panel-close:hover, .aja-panel-close:focus { background: rgba(255,255,255,.28) !important; }
.aja-panel-close svg { width: 17px; height: 17px; }
.aja-panel-title { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.aja-panel-sub { font-size: 12px; opacity: .88; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.aja-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #38d67a; display: inline-block; }
.aja-status-dot.aja-offline { background: #ffb020; }

.aja-panel-body {
	flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fafbfd;
	/* Own compositing layer + opaque background, isolated from whatever page
	 * content sits underneath in a buggy WebView repaint. Kept separate from
	 * .aja-panel's own transform so it never fights the open/close animation. */
	position: relative; isolation: isolate;
	transform: translateZ(0); -webkit-transform: translateZ(0);
	backface-visibility: hidden; -webkit-backface-visibility: hidden;
}

/* ---- Channels list view ---- */
.aja-channels-view { flex: 1; min-height: 0; padding: 18px 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; touch-action: pan-y; }
.aja-welcome-text { margin: 0 0 14px; font-size: 13.5px; color: #3a3f4b; }

.aja-channel-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.aja-channel {
	display: flex; align-items: center; gap: 12px;
	padding: 11px 13px; border-radius: 12px;
	background: #fff; text-decoration: none; color: #1c2b4a;
	font-size: 13.5px; font-weight: 600;
	border: 1px solid #ecedf3;
	box-shadow: 0 1px 2px rgba(15,23,42,.04);
	transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.aja-channel:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(15,23,42,.08); border-color: #dfe3f5; }
.aja-channel:hover .aja-channel-label { color: #ff0000 !important; }

/* Colored circular badge per channel (background set inline by JS) so
   WhatsApp/Messenger/etc are instantly recognizable at a glance. */
.aja-channel-icon {
	width: 34px; height: 34px; flex: none;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	color: #fff;
	box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.aja-channel-icon svg { width: 56%; height: 56%; fill: currentColor; }

.aja-dm-toggle {
	width: 100% !important; display: flex !important; align-items: center !important; gap: 10px !important; justify-content: center !important;
	background: linear-gradient(135deg, var(--aja-primary), var(--aja-secondary)) !important; color: #fff !important;
	border-radius: 12px !important;
	padding: 12px 12px !important; font-size: 13.5px !important; font-weight: 700 !important;
	box-shadow: 0 6px 16px rgba(0,0,0,.14) !important;
	transition: transform .12s ease, box-shadow .12s ease !important;
}
.aja-dm-toggle:hover { transform: translateY(-1px) !important; box-shadow: 0 10px 22px rgba(0,0,0,.2) !important; }
.aja-dm-toggle .aja-badge-message { width: 20px; height: 20px; color: #fff; box-shadow: none; background: rgba(255,255,255,.18) !important; }
.aja-dm-toggle .aja-badge-message svg { width: 62%; height: 62%; }

/* ---- Direct-message chat view ---- */
.aja-dm-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.aja-dm-topbar {
	flex: none; display: flex; align-items: center; justify-content: space-between;
	padding: 10px 14px; border-bottom: 1px solid #eef0f5; background: #fff;
}
.aja-dm-topbar.aja-no-channel-title { border-bottom-color: transparent; }
.aja-dm-back.aja-dm-first-heading { pointer-events: none !important; font-weight: 400 !important; font-size: 13.5px !important; }
.aja-dm-back.aja-dm-first-heading svg { display: none !important; }
.aja-dm-back[hidden] { display: none !important; }
.aja-dm-back {
	display: flex !important; align-items: center !important; gap: 6px !important;
	font-size: 13px !important; font-weight: 600 !important; color: #3a3f4b !important;
	background: transparent !important; background-color: transparent !important;
	border: 0 !important; box-shadow: none !important; outline: 0 !important; text-decoration: none !important;
	-webkit-tap-highlight-color: transparent !important; -webkit-user-select: none; user-select: none;
}
.aja-dm-back:hover, .aja-dm-back:focus, .aja-dm-back:active,
.aja-dm-back span, .aja-dm-back:hover span, .aja-dm-back:focus span, .aja-dm-back:active span {
	background: transparent !important; background-color: transparent !important; color: #3a3f4b !important;
	box-shadow: none !important; outline: 0 !important; text-decoration: none !important;
}
.aja-dm-back svg { width: 16px; height: 16px; fill: none; }
.aja-dm-end {
	font-size: 12px !important; font-weight: 600 !important; color: #ff0000 !important;
	padding: 5px 10px !important; border-radius: 20px !important;
	background: #fdeceb !important;
}
.aja-dm-end { margin-left: auto !important; }
.aja-dm-end:hover { background: #fbdedc !important; }


/* AJ Assist End chat confirmation. Replaces the browser-native confirm() dialog. */
.aja-end-confirm[hidden] { display: none !important; }
.aja-end-confirm {
	position: absolute !important; inset: 0 !important; z-index: 60 !important;
	display: flex !important; align-items: center !important; justify-content: center !important;
	padding: 20px !important; box-sizing: border-box !important;
}
.aja-end-confirm-backdrop {
	position: absolute !important; inset: 0 !important;
	background: rgba(17,24,39,.52) !important;
	backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px);
}
.aja-end-confirm-box {
	position: relative !important; z-index: 1 !important;
	width: min(310px, 100%) !important; box-sizing: border-box !important;
	background: #fff !important; border: 1px solid rgba(15,23,42,.08) !important;
	border-radius: 20px !important; padding: 20px 20px 16px !important;
	box-shadow: 0 22px 60px rgba(15,23,42,.28) !important;
	text-align: left !important;
}
.aja-end-confirm-title {
	margin: 0 0 8px !important; color: #ff0000 !important;
	font-size: 18px !important; line-height: 1.25 !important; font-weight: 800 !important;
}
.aja-end-confirm-message {
	margin: 0 !important; color: #374151 !important;
	font-size: 14px !important; line-height: 1.55 !important; font-weight: 500 !important;
}
.aja-end-confirm-actions {
	display: flex !important; justify-content: flex-end !important; gap: 10px !important;
	margin-top: 18px !important;
}
.aja-end-confirm-actions button {
	box-sizing: border-box !important; flex: 0 0 auto !important;
	width: 92px !important; min-width: 92px !important; height: 40px !important; min-height: 40px !important;
	display: inline-flex !important; align-items: center !important; justify-content: center !important; text-align: center !important;
	border-radius: 11px !important; padding: 9px 16px !important;
	font-size: 13px !important; line-height: 1 !important; font-weight: 800 !important;
	cursor: pointer !important; box-shadow: none !important;
}
.aja-end-confirm-cancel {
	background: #ff0000 !important; color: #ffffff !important;
	border: 1px solid #ff0000 !important;
}
.aja-end-confirm-cancel:hover, .aja-end-confirm-cancel:focus {
	background: #ff0000 !important; color: #ffffff !important;
	border-color: #ff0000 !important;
}
.aja-end-confirm-ok {
	background: #16a34a !important; color: #fff !important;
	border: 1px solid #16a34a !important;
	display: inline-flex !important; align-items: center !important; justify-content: center !important; text-align: center !important;
}
.aja-end-confirm-ok:hover, .aja-end-confirm-ok:focus {
	background: #15803d !important; color: #fff !important;
	border-color: #15803d !important;
}

.aja-dm-thread {
	flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
	padding: 16px 14px; display: flex; flex-direction: column; gap: 9px;
	background: #fafbfd;
	-webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; overscroll-behavior-x: none; touch-action: pan-y; overflow-anchor: none;
}
.aja-open .aja-panel, .aja-dm-view { overscroll-behavior-y: contain; }
.aja-bubble { padding: 9px 12px; border-radius: 14px; font-size: 13.3px; max-width: 86%; line-height: 1.5; word-break: break-word; white-space: pre-line; }
.aja-bubble-user { align-self: flex-end; background: linear-gradient(135deg, var(--aja-primary), var(--aja-secondary)); color: #fff; border-bottom-right-radius: 4px; }
.aja-bubble-bot { align-self: flex-start; background: #fff; border: 1px solid #ecedf3; color: #262a34; border-bottom-left-radius: 4px; }
.aja-bubble-meta { font-size: 10.5px; opacity: .65; margin-top: 3px; }

/* Message identity avatars: scoped only to conversation bubbles. */
.aja-message-row { display: flex; align-items: flex-end; gap: 7px; max-width: 92%; }
.aja-message-row-ai, .aja-message-row-admin { align-self: flex-start; }
.aja-message-row-user { align-self: flex-end; flex-direction: row-reverse; }
.aja-message-row .aja-bubble { align-self: auto; max-width: calc(100% - 35px); }
.aja-message-avatar { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; line-height: 1; background: #eef1f7; color: #263248; border: 1px solid rgba(0,0,0,.06); }
.aja-message-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aja-message-avatar-ai { background: linear-gradient(135deg, #4d6bfe, #1c2b4a); color: #fff; }
.aja-message-avatar-ai { background: #fff; padding: 2px; }
.aja-message-avatar-ai img { object-fit: contain; background: #fff; }
.aja-view-product-btn {
	display: inline-flex !important; align-items: center !important; justify-content: center !important;
	margin: 7px 0 3px !important; padding: 8px 14px !important; min-height: 34px;
	border-radius: 999px !important; background: linear-gradient(135deg, var(--aja-primary), var(--aja-secondary)) !important;
	color: #fff !important; text-decoration: none !important; font-size: 12.5px !important; font-weight: 700 !important;
	box-shadow: 0 4px 10px rgba(0,0,0,.12) !important; line-height: 1 !important;
}
.aja-view-product-btn:hover, .aja-view-product-btn:focus { filter: brightness(.96); color: #fff !important; }
.aja-message-avatar-admin { background: #111; color: #fff; }
.aja-bubble-system {
	align-self: center; font-size: 11px; color: #8c8f94; background: #eceef3;
	padding: 4px 12px; border-radius: 20px; margin: 2px 0;
}
.aja-typing { opacity: .6; font-style: italic; }

.aja-dm-identity {
	flex: none; padding: 10px 14px; border-top: 1px solid #eef0f5; background: #fff;
	display: flex; flex-direction: column; gap: 7px;
}
.aja-dm-hint { font-size: 12px; color: #8c8f94; margin: 0 0 2px; }

.aja-dm-name, .aja-dm-phone, .aja-dm-email, .aja-dm-message {
	width: 100% !important; border: 1px solid #e1e3ea !important; border-radius: 10px !important;
	padding: 9px 11px !important; font-size: 13px !important; background: #fff !important; color: #222 !important;
}
.aja-dm-name:focus, .aja-dm-phone:focus, .aja-dm-email:focus, .aja-dm-message:focus {
	outline: none !important; border-color: #9ca3af !important;
	box-shadow: 0 0 0 2px rgba(31,41,55,.08) !important;
}
.aja-dm-name:invalid, .aja-dm-phone:invalid, .aja-dm-email:invalid { border-color: #e1e3ea !important; box-shadow: none !important; }
.aja-dm-name:invalid:focus, .aja-dm-phone:invalid:focus, .aja-dm-email:invalid:focus { border-color: #9ca3af !important; box-shadow: 0 0 0 2px rgba(31,41,55,.08) !important; }

.aja-dm-row {
	flex: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
	padding: 10px 12px; border-top: 1px solid #eef0f5; background: #fff;
}
.aja-dm-row-inner {
	flex: 1; display: flex; align-items: center; gap: 6px;
	background: #f1f2f6; border-radius: 22px; padding: 4px 5px 4px 16px;
}
.aja-dm-attach { width: 25px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; color: #69707d; cursor: pointer; }
.aja-dm-attach:hover { color: #ff0000; }
.aja-dm-attach svg { width: 19px; height: 19px; fill: currentColor; }
.aja-dm-file { display: none !important; }
.aja-dm-file-name { flex: 0 0 100%; padding: 0 8px; font-size: 11px; color: #646970; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aja-media-preview {
	display: block !important; position: relative !important; width: min(240px, 100%) !important; height: 150px !important;
	margin-top: 7px !important; padding: 0 !important; overflow: hidden !important; border-radius: 10px !important;
	background: #e8ebf1 !important; border: 1px solid rgba(0,0,0,.1) !important; color: #252a34 !important;
}
.aja-media-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.aja-media-preview iframe { width: 100%; height: 100%; border: 0; display: block; pointer-events: none; background: #fff; }
.aja-media-preview span { position: absolute; left: 0; right: 0; bottom: 0; padding: 7px 9px; background: rgba(17,24,39,.82); color: #fff; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aja-media-preview.aja-media-file { height: auto !important; min-height: 48px; }
.aja-media-preview.aja-media-file span { position: static; display: block; background: transparent; color: #252a34; white-space: normal; }
.aja-media-modal { position: fixed; inset: 0; z-index: 2147483647; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(5,10,20,.68); }
.aja-media-modal-box { width: min(560px, calc(100vw - 32px)); max-height: min(720px, 82dvh); display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.36); color: #20242c; }
.aja-media-modal-head { position: relative; min-height: 58px; display: flex; align-items: center; gap: 12px; padding: 10px 48px 10px 18px; border-bottom: 1px solid #e5e7eb; font-size: 14px; font-weight: 600; }
.aja-media-modal-head span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aja-media-close { all: unset !important; position: absolute !important; top: 50% !important; right: 14px !important; transform: translateY(-50%) !important; width: 20px !important; height: 20px !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; flex: none !important; margin: 0 !important; padding: 0 !important; min-width: 20px !important; min-height: 20px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; color: #ff0000 !important; line-height: 1 !important; cursor: pointer !important; appearance: none !important; -webkit-appearance: none !important; text-decoration: none !important; }
.aja-media-close:hover, .aja-media-close:focus { background: transparent !important; box-shadow: none !important; color: #ff0000 !important; outline: none !important; }
.aja-media-close svg { width: 18px; height: 18px; display: block; }
.aja-media-modal-body { flex: 0 1 auto; min-height: 220px; max-height: 58dvh; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; background: #f6f7f9; }
.aja-media-modal-body img { display: block; max-width: 100%; max-height: 54dvh; width: auto; height: auto; object-fit: contain; border-radius: 12px; }
.aja-media-modal-body iframe { width: 100%; height: min(56dvh, 560px); border: 0; background: #fff; border-radius: 10px; }
.aja-media-generic { padding: 28px; text-align: center; font-size: 16px; word-break: break-word; }
.aja-media-modal-foot { flex: none; padding: 12px 14px; border-top: 1px solid #e5e7eb; text-align: right; background: #fff; }
.aja-media-modal-foot a { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 9px 18px; border-radius: 10px; background: #ff0000 !important; color: #fff !important; font-size: 13px; font-weight: 700; text-decoration: none !important; }
.aja-media-modal-foot a:hover, .aja-media-modal-foot a:focus { background: #000 !important; color: #fff !important; }
@media (max-width: 480px) {
	.aja-media-modal { padding: 16px; }
	.aja-media-modal-box { width: calc(100vw - 32px); max-height: 78dvh; border-radius: 20px; }
	.aja-media-modal-body { min-height: 200px; max-height: 54dvh; padding: 12px; }
	.aja-media-modal-body img { max-height: 50dvh; }
}
.aja-dm-row textarea {
	resize: none; flex: 1; width: auto !important; height: 34px !important; min-height: 34px !important; max-height: 90px;
	border: none !important; background: transparent !important; padding: 6px 2px !important; margin: 0 !important;
	font-size: 14px !important; line-height: 22px !important; vertical-align: middle !important;
	caret-color: #111827 !important; color: #222 !important;
}
.aja-dm-row textarea:focus { box-shadow: none !important; }
.aja-dm-send {
	width: 38px !important; height: 38px !important; border-radius: 50% !important; flex: none !important;
	background: linear-gradient(135deg, var(--aja-primary), var(--aja-secondary)) !important; color: #fff !important;
	display: flex !important; align-items: center !important; justify-content: center !important;
	box-shadow: 0 4px 10px rgba(0,0,0,.16) !important;
	-webkit-tap-highlight-color: transparent !important;
}
.aja-dm-send svg { width: 16px; height: 16px; fill: currentColor; margin-left: -1px; }
.aja-dm-send[disabled] { opacity: 1 !important; filter: none !important; cursor: wait !important; }
.aja-dm-send:focus, .aja-dm-send:active { opacity: 1 !important; filter: none !important; box-shadow: 0 4px 10px rgba(0,0,0,.16) !important; }

.aja-channels-view::-webkit-scrollbar,
.aja-dm-thread::-webkit-scrollbar { width: 6px; }
.aja-channels-view::-webkit-scrollbar-thumb,
.aja-dm-thread::-webkit-scrollbar-thumb { background: #d8dae4; border-radius: 6px; }

/* ================= Mobile: full bottom-sheet ================= */
@media (max-width: 600px) {
	.aja-panel {
		position: fixed;
		left: 10px; right: 10px; bottom: calc(var(--aja-bottom) + var(--aja-size) + 18px);
		width: auto; max-width: none;
		height: auto; max-height: min(72vh, calc(100dvh - var(--aja-bottom) - var(--aja-size) - 38px));
		border-radius: 20px;
	}
	.aja-wrap.aja-dm-active .aja-panel {
		height: min(64vh, 520px);
	}
	.aja-dm-send { width: 34px !important; height: 34px !important; }
	.aja-dm-row { padding: 8px 10px; }
	.aja-dm-row textarea { height: 34px !important; min-height: 34px !important; max-height: 64px; padding: 6px 2px !important; line-height: 22px !important; }
	/* Keep identity fields identical in channel/no-channel modes and immune to
	 * theme form-control sizing. This matches the original stable mobile layout. */
	.aja-dm-name, .aja-dm-phone, .aja-dm-email {
		height: 42px !important; min-height: 42px !important; max-height: 42px !important;
		box-sizing: border-box !important; line-height: 22px !important;
	}
	.aja-wrap.aja-side-right .aja-panel,
	.aja-wrap.aja-side-left  .aja-panel { left: 10px; right: 10px; }
}
@media (min-width: 601px) and (max-width: 1024px) {
	.aja-panel {
		position: fixed;
		bottom: calc(var(--aja-bottom) + var(--aja-size) + 18px);
		max-height: min(75vh, calc(100dvh - var(--aja-bottom) - var(--aja-size) - 38px));
	}
}
@media (max-width: 1024px) {
	/* Mobile browser keyboard: preserve the pre-keyboard chat height inside the
	 * actual visible viewport. The panel temporarily overlays the site's bottom
	 * navigation instead of shrinking above it. App/WebView uses its own branch. */
	.aja-wrap.aja-browser-keyboard-fit.aja-dm-active .aja-panel {
		position: fixed !important;
		bottom: var(--aja-browser-panel-bottom, 8px) !important;
		height: var(--aja-browser-panel-height) !important;
		max-height: var(--aja-browser-panel-height) !important;
		transition: none !important;
		transform: none !important;
	}
	.aja-wrap.aja-keyboard-open.aja-dm-active .aja-panel {
		transform: translateY(calc(-1 * var(--aja-keyboard-lift, 0px))) scale(1);
		transition: none !important;
		will-change: transform;
	}
	.aja-wrap.aja-keyboard-open .aja-dm-thread:empty { display: none; }
	.aja-wrap.aja-keyboard-open .aja-dm-identity {
		flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
	}
	.aja-wrap.aja-keyboard-open .aja-dm-row { position: relative; z-index: 2; flex: none; }

	/* App/WebView parity: same empty-spacer collapse as the browser keyboard state,
	 * applied on field focus when the WebView reports no keyboard viewport change. */
	.aja-wrap.aja-focus-collapse-empty-thread .aja-dm-thread:empty { display: none; }
	.aja-wrap.aja-focus-collapse-empty-thread .aja-dm-identity {
		flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
	}
	.aja-wrap.aja-focus-collapse-empty-thread .aja-dm-row { position: relative; z-index: 2; flex: none; }
	/* App/WebView (IME overlays the page): content-sized panel anchored from the top
	 * so the composer stays above the keyboard. Skipped whenever real keyboard
	 * geometry is available (browser-style fit takes over) or the thread has messages. */
	.aja-wrap.aja-focus-collapse-empty-thread:not(.aja-keyboard-open):not(.aja-viewport-emulated):not(.aja-browser-keyboard-fit).aja-dm-active:has(.aja-dm-thread:empty) .aja-panel {
		top: var(--aja-compact-top, 8px) !important; bottom: auto !important;
		height: auto !important; max-height: none !important;
		transition: opacity .22s ease !important;
	}
	/* Conversation view in the App/WebView: same idea, fixed height that ends above the keyboard. */
	.aja-wrap.aja-focus-collapse-empty-thread:not(.aja-keyboard-open):not(.aja-viewport-emulated):not(.aja-browser-keyboard-fit).aja-dm-active:has(.aja-dm-thread:not(:empty)) .aja-panel {
		top: var(--aja-compact-top, 8px) !important; bottom: auto !important;
		height: var(--aja-compact-height, 55vh) !important; max-height: none !important;
		transition: opacity .22s ease !important;
	}

	/* App/WebView only: when Android overlays the IME instead of resizing the
	 * layout viewport, JS supplies the exact browser-equivalent visible height. */
	.aja-wrap.aja-viewport-emulated.aja-dm-active .aja-panel {
		height: var(--aja-emulated-panel-height) !important;
		max-height: var(--aja-emulated-panel-height) !important;
		transition: none !important;
	}
}
@media (max-width: 400px) {
	.aja-panel { left: 6px; right: 6px; }
}

