/* =====================================================================
   MERIDIAN ASSIST  ::  the support widget
   Loaded by both the marketing site and the dashboard, which have separate
   stylesheets. Rather than depend on either, it reads the host's tokens where
   they exist and falls back to its own: var(--brass, var(--accent, #38BDF8))
   resolves under the dashboard, under the site, and on a bare page.
   ===================================================================== */

.mer-assist{
	--a-accent: var(--brass, var(--accent, #38BDF8));
	--a-accent-ink: #04121F;
	--a-surface: var(--surface, #1E293B);
	--a-surface-2: var(--surface-2, #243144);
	--a-paper: var(--canvas, var(--paper, #0B0F19));
	--a-ink: var(--ink, #E8EFF7);
	--a-ink-2: var(--ink-2, var(--ink-soft, #AFBDD0));
	--a-ink-3: var(--ink-3, var(--ink-mute, #8B9AB0));
	--a-line: var(--line, #2A3A52);
	--a-line-soft: var(--line-soft, #1F2B3E);
	--a-pos: var(--pos, #4FA882);
	--a-warn: var(--warn, #D9A441);

	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 90;
	font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;

	/* The container is only here to put things in the corner. It has no
	   surface of its own, and it was still taking the taps aimed at whatever
	   sat underneath it: hiding the launcher was not enough, because the box
	   around it stayed in the way. Nothing is clickable here except the parts
	   that are actually drawn. */
	pointer-events: none;
}
.mer-assist > *{ pointer-events: auto }

/* ------------------------------------------------------------- launcher */
.mer-assist-launch{
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0;
	width: 48px;
	height: 48px;
	padding: 0;
	border-radius: 999px;
	border: 1px solid var(--a-accent);
	background: var(--a-accent);
	color: var(--a-accent-ink);
	font: 600 13.5px/1 Inter, sans-serif;
	letter-spacing: -.01em;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .34);
	transition: width .18s cubic-bezier(.16, 1, .3, 1), gap .18s, padding .18s, filter .18s;
	overflow: hidden;
	white-space: nowrap;
}

/* The label is there for a pointer, and for anyone who tabs to it. It is not
   there taking up the corner the whole time. */
.mer-assist-launch > span:not(.mer-assist-dot){
	max-width: 0;
	opacity: 0;
	transition: max-width .18s cubic-bezier(.16, 1, .3, 1), opacity .14s;
}
.mer-assist-launch:hover,
.mer-assist-launch:focus-visible{
	width: auto;
	gap: 9px;
	padding: 0 18px 0 14px;
}
.mer-assist-launch:hover > span:not(.mer-assist-dot),
.mer-assist-launch:focus-visible > span:not(.mer-assist-dot){
	max-width: 160px;
	opacity: 1;
}
.mer-assist-launch:hover{ filter: brightness(1.06) }
.mer-assist-launch:active{ filter: brightness(.97) }
.mer-assist-launch svg{ width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }

/* A modal surface owns the screen while it is up. The launcher is mounted
   last in the body, so it is a following sibling of every scrim. */
.scrim.open ~ .mer-assist .mer-assist-launch,
.rail-scrim.on ~ .mer-assist .mer-assist-launch{
	opacity: 0;
	pointer-events: none;
	transition: opacity .16s;
}
/* Hidden is not the same as gone: a button still laid out is still a button
   the page has to step around. */
.scrim.open ~ .mer-assist:not(.is-open) .mer-assist-launch,
.rail-scrim.on ~ .mer-assist:not(.is-open) .mer-assist-launch{
	visibility: hidden;
}

.mer-assist-dot{
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--a-pos);
	box-shadow: 0 0 0 3px rgba(79, 168, 130, .22);
	flex: 0 0 7px;
}
/* On the collapsed disc the dot is a status light in the corner of the mark,
   not a third thing competing for the width. */
.mer-assist-launch > .mer-assist-dot{
	position: absolute;
	top: 8px;
	right: 8px;
	box-shadow: 0 0 0 2px var(--a-accent);
}
.mer-assist-launch:hover > .mer-assist-dot,
.mer-assist-launch:focus-visible > .mer-assist-dot{
	position: static;
	box-shadow: 0 0 0 3px rgba(79, 168, 130, .22);
}

/* ---------------------------------------------------------------- panel */
.mer-assist-panel{
	display: none;
	width: min(392px, calc(100vw - 32px));
	height: min(580px, calc(100vh - 110px));
	flex-direction: column;
	background: var(--a-paper);
	border: 1px solid var(--a-line);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 28px 70px rgba(0, 0, 0, .48);
}
.mer-assist.is-open .mer-assist-panel{ display: flex }
.mer-assist.is-open .mer-assist-launch{ display: none }

.mer-assist-head{
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 15px 14px 15px 17px;
	background: var(--a-surface);
	border-bottom: 1px solid var(--a-line);
}
.mer-assist-mark{
	width: 34px; height: 34px; flex: 0 0 34px;
	border-radius: 9px;
	display: grid; place-items: center;
	background: var(--a-accent);
	color: var(--a-accent-ink);
}
.mer-assist-mark svg{ width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round }
.mer-assist-title{ font-size: 14px; font-weight: 600; color: var(--a-ink); letter-spacing: -.01em }
.mer-assist-sub{ font-size: 11.5px; color: var(--a-ink-3); margin-top: 2px; display: flex; align-items: center; gap: 6px }
.mer-assist-x{
	margin-left: auto;
	width: 30px; height: 30px;
	display: grid; place-items: center;
	border-radius: 8px;
	border: 1px solid transparent;
	background: transparent;
	color: var(--a-ink-3);
	cursor: pointer;
}
.mer-assist-x:hover{ background: var(--a-surface-2); color: var(--a-ink) }
.mer-assist-x svg{ width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round }

/* ------------------------------------------------------------ transcript */
.mer-assist-log{
	flex: 1;
	overflow-y: auto;
	padding: 16px 16px 8px;
	display: flex;
	flex-direction: column;
	gap: 11px;
	scroll-behavior: smooth;
}
.mer-assist-log::-webkit-scrollbar{ width: 8px }
.mer-assist-log::-webkit-scrollbar-thumb{ background: var(--a-line); border-radius: 99px }

.mer-assist-msg{
	max-width: 86%;
	padding: 11px 14px;
	border-radius: 13px;
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--a-ink);
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.mer-assist-msg.from-bank{
	align-self: flex-start;
	background: var(--a-surface);
	border: 1px solid var(--a-line-soft);
	border-bottom-left-radius: 5px;
}
.mer-assist-msg.from-you{
	align-self: flex-end;
	background: var(--a-accent);
	color: var(--a-accent-ink);
	border-bottom-right-radius: 5px;
	font-weight: 500;
}
.mer-assist-msg.from-system{
	align-self: center;
	max-width: 100%;
	text-align: center;
	background: transparent;
	border: 1px dashed var(--a-line);
	color: var(--a-ink-3);
	font-size: 12px;
	padding: 9px 13px;
}
.mer-assist-who{
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: .11em;
	text-transform: uppercase;
	color: var(--a-ink-3);
	margin: 2px 0 -5px 4px;
	align-self: flex-start;
}
.mer-assist-who.is-officer{ color: var(--a-accent) }

/* The three dots, so a turn that takes a moment does not look like a failure. */
.mer-assist-wait{ align-self: flex-start; display: flex; gap: 4px; padding: 13px 15px }
.mer-assist-wait i{
	width: 6px; height: 6px; border-radius: 50%;
	background: var(--a-ink-3);
	animation: mer-assist-bounce 1.3s infinite ease-in-out;
}
.mer-assist-wait i:nth-child(2){ animation-delay: .16s }
.mer-assist-wait i:nth-child(3){ animation-delay: .32s }
@keyframes mer-assist-bounce{
	0%, 70%, 100%{ transform: translateY(0); opacity: .45 }
	35%{ transform: translateY(-4px); opacity: 1 }
}

/* --------------------------------------------------------------- prompts */
.mer-assist-chips{ display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 16px 10px }
.mer-assist-chip{
	padding: 7px 12px;
	border-radius: 999px;
	border: 1px solid var(--a-line);
	background: var(--a-surface);
	color: var(--a-ink-2);
	font: 500 12px/1 Inter, sans-serif;
	cursor: pointer;
	transition: border-color .16s, color .16s;
}
.mer-assist-chip:hover{ border-color: var(--a-accent); color: var(--a-accent) }

/* -------------------------------------------------------------- composer */
.mer-assist-foot{
	border-top: 1px solid var(--a-line);
	background: var(--a-surface);
	padding: 11px 12px;
}
.mer-assist-row{ display: flex; gap: 8px; align-items: flex-end }
.mer-assist-in{
	flex: 1;
	min-height: 40px;
	max-height: 108px;
	resize: none;
	padding: 11px 13px;
	border-radius: 10px;
	border: 1px solid var(--a-line);
	background: var(--a-paper);
	color: var(--a-ink);
	font: 400 13.5px/1.5 Inter, sans-serif;
}
.mer-assist-in:focus{ outline: none; border-color: var(--a-accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, .16) }
.mer-assist-in::placeholder{ color: var(--a-ink-3) }
.mer-assist-send{
	width: 40px; height: 40px; flex: 0 0 40px;
	display: grid; place-items: center;
	border-radius: 10px;
	border: 1px solid var(--a-accent);
	background: var(--a-accent);
	color: var(--a-accent-ink);
	cursor: pointer;
}
.mer-assist-send:disabled{ opacity: .4; cursor: not-allowed }
.mer-assist-send svg{ width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round }

.mer-assist-legal{
	margin-top: 9px;
	font-size: 10.5px;
	line-height: 1.55;
	color: var(--a-ink-3);
	text-align: center;
}

/* ----------------------------------------------------- the reply address */
.mer-assist-ask{
	margin: 0 16px 12px;
	padding: 13px 14px;
	border-radius: 11px;
	border: 1px solid var(--a-line);
	background: var(--a-surface);
}
.mer-assist-ask p{ font-size: 12.5px; line-height: 1.55; color: var(--a-ink-2); margin: 0 0 10px }
.mer-assist-ask input{
	width: 100%;
	padding: 9px 11px;
	margin-bottom: 7px;
	border-radius: 8px;
	border: 1px solid var(--a-line);
	background: var(--a-paper);
	color: var(--a-ink);
	font: 400 13px/1.4 Inter, sans-serif;
}
.mer-assist-ask input:focus{ outline: none; border-color: var(--a-accent) }
.mer-assist-ask button{
	width: 100%;
	padding: 9px;
	border-radius: 8px;
	border: 1px solid var(--a-accent);
	background: transparent;
	color: var(--a-accent);
	font: 600 12.5px/1 Inter, sans-serif;
	cursor: pointer;
}
.mer-assist-ask button:hover{ background: var(--a-accent); color: var(--a-accent-ink) }

/* A phone gets the whole screen, because a 392px panel on a 375px screen is
   a panel with nowhere to put the keyboard. */
@media (max-width: 480px){
	.mer-assist{ right: 14px; bottom: 14px; left: 14px; align-items: flex-end }
	.mer-assist-panel{ width: 100%; height: min(78vh, calc(100vh - 90px)) }
	.mer-assist-launch{ width: 46px; height: 46px }
	.mer-assist-launch:hover{ width: 46px; gap: 0; padding: 0 }
	.mer-assist-launch:hover > span:not(.mer-assist-dot){ max-width: 0; opacity: 0 }
	.mer-assist-launch:hover > .mer-assist-dot{ position: absolute; top: 7px; right: 7px }
}

/* Somebody who has asked for less movement gets less movement. */
@media (prefers-reduced-motion: reduce){
	.mer-assist-launch, .mer-assist-chip{ transition: none }
	.mer-assist-launch > span:not(.mer-assist-dot){ transition: none }
	.mer-assist-wait i{ animation: none; opacity: .6 }
	.mer-assist-log{ scroll-behavior: auto }
}
