/* Eactive chat widget. Compact panel; on screens >= 900px it can expand into a full conversation view. */
.eas-root {
	--eas-color: #1f6feb;
	--eas-bg: #ffffff;
	--eas-surface: #faf9f7;
	--eas-fg: #1f1e1d;
	--eas-muted: #6b6a68;
	--eas-border: #e4e2de;
	--eas-soft: #f0eeea;
	--eas-user: #efece6;
	--eas-shadow: 0 12px 40px rgba(20, 20, 19, .18);
	--eas-font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	position: fixed;
	right: 20px;
	bottom: calc(20px + env(safe-area-inset-bottom, 0px));
	z-index: 2147483000;
	font: 14px/1.55 var(--eas-font);
	color: var(--eas-fg);
	-webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
	.eas-root {
		--eas-bg: #262624; --eas-surface: #1f1e1d; --eas-fg: #ecebe8; --eas-muted: #a3a29f;
		--eas-border: #3a3936; --eas-soft: #30302e; --eas-user: #3a3936; --eas-shadow: 0 12px 40px rgba(0, 0, 0, .5);
	}
}
[data-theme="dark"] .eas-root {
	--eas-bg: #262624; --eas-surface: #1f1e1d; --eas-fg: #ecebe8; --eas-muted: #a3a29f;
	--eas-border: #3a3936; --eas-soft: #30302e; --eas-user: #3a3936; --eas-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
[data-theme="light"] .eas-root {
	--eas-bg: #ffffff; --eas-surface: #faf9f7; --eas-fg: #1f1e1d; --eas-muted: #6b6a68;
	--eas-border: #e4e2de; --eas-soft: #f0eeea; --eas-user: #efece6; --eas-shadow: 0 12px 40px rgba(20, 20, 19, .18);
}

.eas-root *, .eas-root *::before, .eas-root *::after { box-sizing: border-box; }
.eas-root [hidden] { display: none !important; }
.eas-root button { font-family: inherit; }
html.eas-noscroll, html.eas-noscroll body { overflow: hidden !important; }

/* ---------------------------------------------------------------- launcher */
.eas-launcher {
	width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
	background: var(--eas-color); color: #fff; display: flex; align-items: center; justify-content: center;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22); position: relative; margin-left: auto;
	transition: transform .15s ease;
}
.eas-launcher:hover { transform: scale(1.05); }
.eas-launcher:focus-visible, .eas-root button:focus-visible { outline: 2px solid var(--eas-color); outline-offset: 2px; }
.eas-badge {
	position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
	border-radius: 10px; background: #c4332a; color: #fff; font-size: 11px; font-weight: 700;
	display: flex; align-items: center; justify-content: center;
}

/* ---------------------------------------------------------------- panel */
.eas-panel {
	position: absolute; right: 0; bottom: 70px; width: 400px; height: min(640px, calc(100vh - 110px));
	background: var(--eas-surface); border: 1px solid var(--eas-border); border-radius: 18px;
	box-shadow: var(--eas-shadow); display: flex; flex-direction: column; overflow: hidden;
}
.eas-header {
	display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px;
	background: var(--eas-surface); border-bottom: 1px solid var(--eas-border);
}
.eas-avatar, .eas-mavatar, .eas-welcome-avatar {
	flex-shrink: 0; border-radius: 50%; background: var(--eas-color); color: #fff;
	display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.eas-avatar { width: 32px; height: 32px; font-size: 14px; }
.eas-title { flex: 1; min-width: 0; }
.eas-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.eas-sub { font-size: 12px; color: var(--eas-muted); }
.eas-icon {
	background: transparent; border: none; color: var(--eas-muted); border-radius: 8px; height: 32px; min-width: 32px;
	padding: 0 8px; cursor: pointer; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center;
}
.eas-icon:hover { background: var(--eas-soft); color: var(--eas-fg); }
.eas-expand { display: none; }
@media (min-width: 900px) { .eas-expand { display: inline-flex; } }

.eas-body { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--eas-surface); }
.eas-scroll { flex: 1; overflow-y: auto; padding: 18px 16px 8px; }
.eas-column { display: flex; flex-direction: column; gap: 18px; width: 100%; margin: 0 auto; }
.eas-list { display: flex; flex-direction: column; gap: 18px; }

/* ---------------------------------------------------------------- messages */
.eas-msg { display: flex; gap: 10px; max-width: 100%; }
.eas-content { min-width: 0; overflow-wrap: anywhere; }
.eas-content p { margin: 0 0 .6em; }
.eas-content p:last-child { margin-bottom: 0; }
.eas-content ul, .eas-content ol { margin: .2em 0 .6em; padding-left: 1.3em; }
.eas-content li { margin: .15em 0; }
.eas-content a { color: var(--eas-color); text-decoration: underline; text-underline-offset: 2px; }
.eas-content code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--eas-soft); padding: 1px 5px; border-radius: 5px; }

/* assistant and agent: plain text beside a small avatar, no bubble */
.eas-ai { align-self: stretch; }
.eas-mavatar { width: 26px; height: 26px; font-size: 12px; margin-top: 1px; }
.eas-ai .eas-content { flex: 1; padding-top: 2px; }
.eas-agent .eas-mavatar { background: #2f7d4f; }
.eas-who { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.eas-who span { font-weight: 400; color: var(--eas-muted); }

/* customer: soft bubble on the right */
.eas-customer { align-self: flex-end; max-width: 85%; }
.eas-customer .eas-content { background: var(--eas-user); padding: 9px 14px; border-radius: 16px; }
.eas-pending { opacity: .6; }

.eas-system { align-self: center; max-width: 92%; }
.eas-system .eas-content { color: var(--eas-muted); font-size: 12.5px; text-align: center; }

.eas-dots { display: inline-flex; gap: 4px; padding-top: 8px; }
.eas-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--eas-muted); animation: eas-blink 1.2s infinite; }
.eas-dots span:nth-child(2) { animation-delay: .2s; }
.eas-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes eas-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------------------------------------------------------------- welcome + chips */
.eas-welcome { text-align: center; padding: 10px 6px 0; }
.eas-welcome-avatar { width: 44px; height: 44px; font-size: 19px; margin: 0 auto 12px; }
.eas-welcome h2 { font-size: 20px; line-height: 1.3; font-weight: 600; margin: 0 0 6px; color: var(--eas-fg); }
.eas-welcome-text { color: var(--eas-muted); font-size: 13.5px; }
.eas-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.eas-chip {
	border: 1px solid var(--eas-border); background: var(--eas-bg); color: var(--eas-fg); border-radius: 999px;
	padding: 7px 13px; font-size: 13px; cursor: pointer; transition: background .12s, border-color .12s;
}
.eas-chip:hover { background: var(--eas-soft); border-color: var(--eas-muted); }
.eas-chip:disabled { opacity: .5; cursor: default; }

/* ---------------------------------------------------------------- choices (ask_choices) */
.eas-choices {
	margin-top: 10px; border: 1px solid var(--eas-border); border-radius: 14px; padding: 12px;
	display: flex; flex-direction: column; gap: 10px; background: var(--eas-bg);
}
.eas-cq { font-size: 13px; font-weight: 600; }
.eas-copts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.eas-copts.eas-single { display: flex; flex-wrap: wrap; }
.eas-copt {
	display: flex; align-items: center; gap: 8px; border: 1px solid var(--eas-border); border-radius: 10px;
	padding: 7px 10px; font-size: 13px; cursor: pointer; line-height: 1.3; transition: background .12s, border-color .12s;
}
.eas-copt:hover { background: var(--eas-soft); }
.eas-copt.eas-on { border-color: var(--eas-color); background: var(--eas-soft); }
.eas-copt input { accent-color: var(--eas-color); margin: 0; flex-shrink: 0; }
.eas-cother {
	border: 1px solid var(--eas-border); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px;
	color: var(--eas-fg); background: var(--eas-bg); flex: 1; min-width: 0;
}
.eas-cother:focus { outline: 2px solid var(--eas-color); outline-offset: -1px; }
.eas-crow { display: flex; gap: 8px; align-items: center; }
.eas-choices .eas-btn { padding: 9px; font-size: 13.5px; }
.eas-choices.eas-locked { opacity: .55; }
.eas-choices.eas-locked .eas-copt, .eas-choices.eas-locked .eas-chip { cursor: default; }
.eas-choices.eas-locked .eas-cother, .eas-choices.eas-locked .eas-csend { display: none; }

/* ---------------------------------------------------------------- shared file card */
.eas-root .eas-file {
	margin-top: 10px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; max-width: 320px;
	border: 1px solid var(--eas-border); border-radius: 12px; background: var(--eas-bg); color: var(--eas-fg);
	text-decoration: none; transition: background .12s, border-color .12s;
}
.eas-root .eas-file:hover { background: var(--eas-soft); border-color: var(--eas-muted); text-decoration: none; }
.eas-file-icon {
	flex: none; width: 38px; height: 44px; border-radius: 6px; background: #d93f3f; color: #fff;
	font-size: 11px; font-weight: 700; letter-spacing: .04em; display: flex; align-items: flex-end;
	justify-content: center; padding-bottom: 7px; box-sizing: border-box;
}
.eas-file-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.eas-file-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eas-file-note { font-size: 12px; color: var(--eas-muted); }
.eas-file-dl { flex: none; color: var(--eas-muted); }

/* ---------------------------------------------------------------- status bar + composer */
.eas-bar {
	padding: 0 16px 6px; font-size: 12.5px; color: var(--eas-muted); display: flex; gap: 8px; align-items: center;
	flex-wrap: wrap; justify-content: center;
}
.eas-bar:empty { padding: 0; }
.eas-live { width: 8px; height: 8px; border-radius: 50%; background: #d48a1f; }
.eas-live.eas-on { background: #2f9e5a; }
.eas-pill {
	border: 1px solid var(--eas-border); background: var(--eas-bg); color: var(--eas-fg); border-radius: 999px;
	padding: 4px 12px; font-size: 12.5px; cursor: pointer;
}
.eas-pill:hover { background: var(--eas-soft); }
.eas-pill:disabled { opacity: .5; cursor: default; }
.eas-ghost { background: transparent; }

.eas-compose-wrap { padding: 4px 12px 10px; }
.eas-compose {
	display: flex; gap: 8px; align-items: flex-end; background: var(--eas-bg); border: 1px solid var(--eas-border);
	border-radius: 18px; padding: 8px 8px 8px 14px; box-shadow: 0 1px 6px rgba(0, 0, 0, .05);
	transition: border-color .12s, box-shadow .12s;
}
.eas-compose:focus-within { border-color: var(--eas-muted); box-shadow: 0 2px 12px rgba(0, 0, 0, .08); }
.eas-compose textarea {
	flex: 1; resize: none; border: none; outline: none; background: transparent; color: var(--eas-fg);
	font: inherit; font-size: 14.5px; line-height: 1.5; padding: 5px 0; max-height: 120px; min-height: 30px;
}
.eas-compose textarea::placeholder { color: var(--eas-muted); }
.eas-send {
	width: 34px; height: 34px; border-radius: 10px; border: none; background: var(--eas-color); color: #fff;
	cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: opacity .12s;
}
.eas-send:disabled { opacity: .35; cursor: default; }
.eas-hint { font-size: 11px; color: var(--eas-muted); text-align: center; margin-top: 6px; }

/* ---------------------------------------------------------------- forms */
.eas-card { background: var(--eas-bg); border: 1px solid var(--eas-border); border-radius: 14px; padding: 16px; }
.eas-form { display: flex; flex-direction: column; gap: 11px; }
.eas-form h3 { margin: 0; font-size: 16px; font-weight: 600; }
.eas-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.eas-form input {
	border: 1px solid var(--eas-border); border-radius: 10px; padding: 9px 11px; font: inherit; font-weight: 400;
	color: var(--eas-fg); background: var(--eas-bg);
}
.eas-form input:focus { outline: 2px solid var(--eas-color); outline-offset: -1px; }
.eas-form input[name="code"] { letter-spacing: 8px; font-size: 20px; text-align: center; }
.eas-opt { color: var(--eas-muted); font-weight: 400; }
.eas-note { margin: 0; color: var(--eas-muted); font-size: 13px; }
.eas-error { color: #c4332a; font-size: 13px; text-align: center; }
.eas-info { color: #2f7d4f; font-size: 13px; }
.eas-btn {
	border: none; border-radius: 10px; padding: 11px; background: var(--eas-color); color: #fff;
	font: inherit; font-weight: 600; cursor: pointer;
}
.eas-btn:disabled { opacity: .6; cursor: default; }
.eas-links { font-size: 12.5px; text-align: center; color: var(--eas-muted); }
.eas-links a { color: var(--eas-color); }
.eas-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* ---------------------------------------------------------------- expanded (large screens) */
.eas-backdrop { position: fixed; inset: 0; background: rgba(20, 20, 19, .45); backdrop-filter: blur(2px); }
@media (min-width: 900px) {
	.eas-expanded .eas-panel {
		position: fixed; left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%);
		width: min(1040px, calc(100vw - 64px)); height: calc(100vh - 64px); border-radius: 20px;
	}
	.eas-expanded .eas-header { padding: 14px 18px 14px 22px; }
	.eas-expanded .eas-scroll { padding: 32px 24px 12px; }
	.eas-expanded .eas-column, .eas-expanded .eas-compose-wrap, .eas-expanded .eas-bar {
		max-width: 740px; width: 100%; margin-left: auto; margin-right: auto;
	}
	.eas-expanded .eas-column, .eas-expanded .eas-list { gap: 26px; }
	.eas-expanded .eas-content { font-size: 15.5px; line-height: 1.65; }
	.eas-expanded .eas-mavatar { width: 30px; height: 30px; font-size: 13px; }
	.eas-expanded .eas-customer { max-width: 78%; }
	.eas-expanded .eas-customer .eas-content { padding: 10px 16px; border-radius: 18px; }
	.eas-expanded .eas-system .eas-content { font-size: 13px; }
	.eas-expanded .eas-welcome { padding-top: 9vh; }
	.eas-expanded .eas-welcome-avatar { width: 56px; height: 56px; font-size: 24px; margin-bottom: 16px; }
	.eas-expanded .eas-welcome h2 { font-size: 30px; font-weight: 500; letter-spacing: -.01em; }
	.eas-expanded .eas-welcome-text { font-size: 15px; max-width: 560px; margin: 0 auto; }
	.eas-expanded .eas-chips { gap: 10px; margin-top: 8px; }
	.eas-expanded .eas-chip { padding: 9px 16px; font-size: 14px; }
	.eas-expanded .eas-card { max-width: 440px; width: 100%; margin: 0 auto; padding: 22px; }
	.eas-expanded .eas-compose-wrap { padding: 6px 24px 16px; box-sizing: content-box; }
	.eas-expanded .eas-compose { border-radius: 22px; padding: 12px 12px 12px 18px; }
	.eas-expanded .eas-compose textarea { font-size: 15.5px; max-height: 220px; min-height: 48px; }
	.eas-expanded .eas-send { width: 38px; height: 38px; border-radius: 12px; }
	.eas-expanded .eas-launcher { visibility: hidden; }
}

/* ---------------------------------------------------------------- phones: full screen */
@media (max-width: 480px) {
	.eas-root { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
	.eas-panel {
		position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; border: none;
		padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
	}
	.eas-launcher.eas-hide-mobile { display: none; }
	.eas-compose textarea { font-size: 16px; } /* stop iOS zoom on focus */
}
