/* =========================================================================
   Kit, l'assistant guidé — DA de l'accueil v2 (Élan)
   Contours marine, ombres pleines « 3D », pastilles légèrement inclinées,
   bouton orange à pastille marine, trame de points, anneau, vagues.
   ====================================================================== */

.kmk {
	--kmk-blue: #2457D6;
	--kmk-blue-light: #E9EEFB;
	--kmk-orange: #FFB176;
	--kmk-orange-dark: #C9773A;
	--kmk-navy: #142B49;
	--kmk-cream: #FFF9F1;
	--kmk-muted: rgba(20, 43, 73, .72);
	--kmk-line: 2px solid var(--kmk-navy);
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--kmk-navy);
}
.kmk--raised { bottom: 96px; }
.kmk *, .kmk *::before, .kmk *::after { box-sizing: border-box; }
.kmk [hidden] { display: none !important; }
.kmk button { font: inherit; cursor: pointer; margin: 0; }
.kmk p { margin: 0; padding: 0; }
.kmk :focus-visible { outline: 3px solid var(--kmk-orange); outline-offset: 3px; }
.kmk-ico { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }

/* ---------- Bouton flottant : Kit sur son disque, en relief ---------- */
.kmk-launcher {
	position: relative;
	display: grid;
	place-items: center;
	width: 70px;
	height: 70px;
	padding: 0;
	border: var(--kmk-line);
	border-radius: 50%;
	background: var(--kmk-blue);
	box-shadow: 0 6px 0 var(--kmk-navy);
	transition: transform .15s ease, box-shadow .15s ease;
}
.kmk-launcher:hover { transform: translateY(-2px) rotate(-4deg); box-shadow: 0 8px 0 var(--kmk-navy); }
.kmk-launcher:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--kmk-navy); }
.kmk-launcher__avatar,
.kmk-head__avatar {
	display: grid;
	place-items: center;
	flex: none;
	border-radius: 50%;
	background: var(--kmk-orange);
	color: var(--kmk-navy);
	font-family: "Manrope", system-ui, sans-serif;
	font-weight: 800;
	overflow: hidden;
}
.kmk-launcher__avatar { width: 56px; height: 56px; border: 2px solid #fff; }
.kmk-launcher__avatar img,
.kmk-head__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }


/* ---------- Bulle « Besoin d'aide ? » ---------- */
.kmk-teaser {
	position: absolute;
	right: 86px;
	bottom: 14px;
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 4px 6px 4px 4px;
	border: var(--kmk-line);
	border-radius: 20px 20px 6px 20px;
	background: var(--kmk-blue);
	box-shadow: 0 5px 0 var(--kmk-navy);
	white-space: nowrap;
	transform: rotate(-2deg);
	transform-origin: right bottom;
	animation: kmk-teaser .55s cubic-bezier(.2, 1.4, .4, 1) .8s both;
}
.kmk .kmk-teaser__text {
	padding: 8px 6px 8px 14px;
	border: 0;
	background: none;
	color: #fff;
	font-family: "Manrope", "DM Sans", system-ui, sans-serif;
	font-size: 15px;
	font-weight: 800;
	line-height: 1.2;
}
.kmk .kmk-teaser__close {
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--kmk-navy);
	color: var(--kmk-orange);
}
.kmk .kmk-teaser__close:hover { background: var(--kmk-orange); color: var(--kmk-navy); }
.kmk--open .kmk-teaser { display: none; }
@keyframes kmk-teaser {
	from { opacity: 0; transform: translateX(12px) rotate(-2deg) scale(.85); }
	to { opacity: 1; transform: rotate(-2deg); }
}

/* ---------- Fenêtre ---------- */
.kmk-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 392px;
	max-width: calc(100vw - 32px);
	height: min(640px, calc(100vh - 140px));
	margin-bottom: 18px;
	border: var(--kmk-line);
	border-radius: 28px;
	background: var(--kmk-cream);
	overflow: hidden;
	box-shadow: 0 10px 0 var(--kmk-navy), 0 30px 60px rgba(20, 43, 73, .28);
	animation: kmk-in .25s cubic-bezier(.2, 1.2, .4, 1);
	transform-origin: right bottom;
}
@keyframes kmk-in {
	from { opacity: 0; transform: translateY(14px) scale(.96); }
	to { opacity: 1; transform: none; }
}

/* En-tête bleu, trame de points orange, anneau, vague */
.kmk-head {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 14px 26px 16px;
	background: var(--kmk-blue);
	color: #fff;
	overflow: hidden;
}
.kmk-head::after {
	/* vague vers la zone crème */
	content: "";
	position: absolute;
	left: -2px;
	right: -2px;
	bottom: -1px;
	height: 16px;
	background: var(--kmk-cream);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 16' preserveAspectRatio='none'%3E%3Cpath d='M0 9 C 70 0 130 0 200 8 S 330 16 400 6 V16 H0Z' fill='%23000'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 16' preserveAspectRatio='none'%3E%3Cpath d='M0 9 C 70 0 130 0 200 8 S 330 16 400 6 V16 H0Z' fill='%23000'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.kmk-head__dots {
	position: absolute;
	top: 6px;
	right: 112px;
	width: 54px;
	height: 30px;
	background-image: radial-gradient(var(--kmk-orange) 1.6px, transparent 1.8px);
	background-size: 10px 10px;
	opacity: .85;
	pointer-events: none;
	z-index: -1;
}
.kmk-head__ring {
	position: absolute;
	right: -34px;
	bottom: -46px;
	width: 96px;
	height: 96px;
	border: 12px solid rgba(255, 177, 118, .9);
	border-radius: 50%;
	pointer-events: none;
	z-index: -1;
}
.kmk-head__avatar {
	width: 48px;
	height: 48px;
	border: var(--kmk-line);
	box-shadow: 0 3px 0 var(--kmk-navy);
	background: #fff;
	transform: rotate(-4deg);
}
.kmk-head__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.kmk-head__name {
	font-family: "Manrope", system-ui, sans-serif;
	font-size: 20px;
	font-weight: 800;
	line-height: 1.1;
	color: #fff;
}
.kmk-head__sub {
	align-self: flex-start;
	margin-top: 3px;
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--kmk-navy);
	color: var(--kmk-orange);
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: .01em;
}
.kmk-head__btn {
	display: grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: var(--kmk-line);
	border-radius: 50%;
	background: #fff;
	color: var(--kmk-navy);
	box-shadow: 0 3px 0 var(--kmk-navy);
	transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.kmk-head__btn:hover { background: var(--kmk-orange); transform: translateY(-1px); box-shadow: 0 4px 0 var(--kmk-navy); }
.kmk-head__btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--kmk-navy); }

.kmk-preview {
	margin: 0 14px !important;
	padding: 5px 12px !important;
	border: var(--kmk-line);
	border-top: 0;
	border-radius: 0 0 14px 14px;
	background: var(--kmk-orange);
	font-size: 12px;
	font-weight: 700;
	text-align: center;
}

/* ---------- Fil de discussion ---------- */
.kmk-log {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 14px 16px 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: rgba(20, 43, 73, .35) transparent;
}
.kmk-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 88%; animation: kmk-msg .22s ease both; }
.kmk-msg--me { align-self: flex-end; align-items: flex-end; }
.kmk-msg--cards { max-width: 100%; align-self: stretch; align-items: stretch; gap: 12px; }
@keyframes kmk-msg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.kmk-bubble {
	padding: 10px 14px !important;
	border: var(--kmk-line);
	border-radius: 18px 18px 18px 6px;
	background: #fff;
	white-space: pre-line;
	overflow-wrap: anywhere;
}
.kmk-msg--me .kmk-bubble {
	border-radius: 18px 18px 6px 18px;
	background: var(--kmk-blue);
	color: #fff;
	font-weight: 600;
}

/* Kit dans la discussion */
.kmk-pose { align-self: flex-start; margin: 2px 0 -6px 2px; line-height: 0; }
.kmk-pose img { width: 92px; height: 92px; object-fit: contain; display: block; }
.kmk-pose:first-child {
	position: relative;
	align-self: center;
	margin: 6px 0 2px;
}
.kmk-pose:first-child::before {
	/* Kit sur son disque orange, comme dans le hero */
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 118px;
	height: 118px;
	border-radius: 50%;
	background: var(--kmk-orange);
	transform: translate(-50%, -46%);
}
.kmk-pose:first-child img {
	position: relative;
	width: 136px;
	height: 136px;
	animation: kmk-pop .5s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes kmk-pop { from { opacity: 0; transform: translateY(10px) scale(.85); } to { opacity: 1; transform: none; } }

/* ---------- Fiches recommandées (tuiles à ombre pleine) ---------- */
.kmk-card {
	display: flex;
	gap: 12px;
	padding: 12px;
	border: var(--kmk-line);
	border-radius: 20px;
	background: #fff;
	box-shadow: 0 5px 0 var(--kmk-navy);
	transition: transform .15s ease, box-shadow .15s ease;
}
.kmk-card:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--kmk-navy); }
.kmk-card__img {
	flex: none;
	width: 76px;
	height: 76px;
	padding: 4px;
	border: var(--kmk-line);
	border-radius: 16px;
	object-fit: contain;
	background: var(--kmk-blue-light);
}
.kmk-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.kmk-card__meta { display: flex; flex-wrap: wrap; gap: 5px; }
.kmk-tag {
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--kmk-blue);
	color: #fff;
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.5;
}
.kmk-tag--soon { background: var(--kmk-orange); color: var(--kmk-navy); }
.kmk-tag--note { background: var(--kmk-navy); color: var(--kmk-orange); }
.kmk-card__name { font-family: "Manrope", system-ui, sans-serif; font-size: 15.5px; font-weight: 800; line-height: 1.25; color: var(--kmk-navy); }
.kmk-card__desc { font-size: 13.5px; color: var(--kmk-muted); }
.kmk-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.kmk-card__price { font-family: "Manrope", system-ui, sans-serif; font-size: 18px; font-weight: 800; }

/* ---------- Bouton d'action « 3D » (orange, pastille marine) ---------- */
.kmk a.kmk-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
	padding: 5px 5px 5px 14px;
	border: var(--kmk-line);
	border-radius: 999px;
	background: var(--kmk-orange);
	color: var(--kmk-navy);
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	box-shadow: 0 4px 0 var(--kmk-navy);
	transition: transform .15s ease, box-shadow .15s ease;
}
.kmk a.kmk-link .kmk-ico {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--kmk-navy);
	color: var(--kmk-orange);
	transition: rotate .25s ease, translate .25s ease;
}
.kmk a.kmk-link:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--kmk-navy); }
.kmk a.kmk-link:hover .kmk-ico { translate: 2px 0; }
.kmk a.kmk-link:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--kmk-navy); }
.kmk a.kmk-link--block { margin-left: 0; margin-bottom: 4px; font-size: 14px; }

/* ---------- Réponses proposées (pastilles à ombre pleine) ---------- */
.kmk-choices {
	display: flex;
	flex-wrap: wrap;
	gap: 9px 8px;
	max-height: 38%;
	overflow-y: auto;
	padding: 14px 16px 12px;
	border-top: var(--kmk-line);
	background: #fff;
	scrollbar-width: thin;
}
.kmk-choices:empty { display: none; }
.kmk .kmk-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 3px;
	padding: 7px 14px;
	border: var(--kmk-line);
	border-radius: 999px;
	background: #fff;
	color: var(--kmk-navy);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	text-align: left;
	text-decoration: none;
	box-shadow: 0 3px 0 var(--kmk-navy);
	transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.kmk .kmk-chip:hover { background: var(--kmk-blue); color: #fff; transform: translateY(-1px) rotate(-1deg); box-shadow: 0 4px 0 var(--kmk-navy); }
.kmk .kmk-chip:active { transform: translateY(3px); box-shadow: 0 0 0 var(--kmk-navy); }
/* première proposition mise en avant, comme les pastilles bleues de l'accueil */
.kmk .kmk-chip:first-child:not(.kmk-chip--soft):not(.kmk-chip--link) { background: var(--kmk-blue); color: #fff; }
.kmk .kmk-chip:first-child:not(.kmk-chip--soft):not(.kmk-chip--link):hover { background: var(--kmk-navy); }
.kmk .kmk-chip--soft {
	border-style: dashed;
	box-shadow: none;
	color: var(--kmk-muted);
	font-weight: 600;
}
.kmk .kmk-chip--soft:hover { border-style: solid; background: var(--kmk-navy); color: #fff; box-shadow: 0 3px 0 var(--kmk-orange-dark); }
.kmk .kmk-chip--link { background: var(--kmk-orange); padding-right: 6px; }
.kmk .kmk-chip--link .kmk-ico { width: 22px; height: 22px; border-radius: 50%; background: var(--kmk-navy); color: var(--kmk-orange); }
.kmk .kmk-chip--link:hover { background: var(--kmk-orange); color: var(--kmk-navy); }

/* ---------- Saisie libre ---------- */
.kmk-form {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px 14px;
	background: #fff;
}
.kmk-choices:empty + .kmk-form { padding-top: 14px; border-top: var(--kmk-line); }
.kmk .kmk-input {
	flex: 1;
	min-width: 0;
	height: 46px;
	margin: 0;
	padding: 0 16px;
	border: var(--kmk-line);
	border-radius: 999px;
	background: var(--kmk-cream);
	color: var(--kmk-navy);
	font: inherit;
	font-size: 16px;
	box-shadow: inset 0 2px 0 rgba(20, 43, 73, .08);
}
.kmk .kmk-input:focus { background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(36, 87, 214, .25); }
.kmk .kmk-input::placeholder { color: rgba(20, 43, 73, .55); font-size: 14px; }
.kmk .kmk-send {
	display: grid;
	place-items: center;
	flex: none;
	width: 46px;
	height: 46px;
	padding: 0;
	border: var(--kmk-line);
	border-radius: 50%;
	background: var(--kmk-orange);
	color: var(--kmk-navy);
	box-shadow: 0 4px 0 var(--kmk-navy);
	transition: transform .15s ease, box-shadow .15s ease;
}
.kmk .kmk-send .kmk-ico { transition: rotate .25s ease, translate .25s ease; }
.kmk .kmk-send:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--kmk-navy); }
.kmk .kmk-send:hover .kmk-ico { rotate: -14deg; translate: 2px -1px; }
.kmk .kmk-send:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--kmk-navy); }

/* ---------- Téléphone : plein écran ---------- */
@media (max-width: 600px) {
	.kmk { right: 14px; bottom: 16px; }
	.kmk--raised { bottom: 88px; }
	.kmk-launcher { width: 62px; height: 62px; }
	.kmk-launcher__avatar { width: 50px; height: 50px; }
	.kmk-teaser { right: 76px; bottom: 10px; }
	.kmk .kmk-teaser__text { font-size: 14px; padding: 7px 4px 7px 12px; }
	.kmk--open { inset: 0; right: 0; bottom: 0; }
	.kmk--open .kmk-launcher { display: none; }
	.kmk--open .kmk-panel {
		width: 100%;
		max-width: none;
		height: 100%;
		margin: 0;
		border: 0;
		border-radius: 0;
		box-shadow: none;
	}
	.kmk-head { padding-top: max(14px, env(safe-area-inset-top)); }
	.kmk-form { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
	.kmk-panel, .kmk-teaser, .kmk-msg, .kmk-pose:first-child img { animation: none; }
	.kmk-launcher, .kmk-head__btn, .kmk-card, .kmk a.kmk-link, .kmk .kmk-chip, .kmk .kmk-send,
	.kmk a.kmk-link .kmk-ico, .kmk .kmk-send .kmk-ico { transition: none; }
	.kmk-launcher:hover, .kmk-card:hover, .kmk a.kmk-link:hover, .kmk .kmk-chip:hover, .kmk .kmk-send:hover { transform: none; }
	.kmk-teaser { transform: rotate(-2deg); }
}
@media print { .kmk { display: none; } }

/* Bulle « Besoin d'aide ? » plus discrète (v0.7.1) */
.kmk-teaser { right: 82px; bottom: 18px; padding: 2px 4px 2px 2px; border-radius: 16px 16px 5px 16px; box-shadow: 0 4px 0 var(--kmk-navy); }
.kmk .kmk-teaser__text { padding: 5px 4px 5px 11px; font-size: 13px; }
.kmk .kmk-teaser__close { width: 19px; height: 19px; }
.kmk .kmk-teaser__close svg { width: 10px; height: 10px; }
@media (max-width: 600px) {
	.kmk-teaser { right: 72px; bottom: 15px; }
	.kmk .kmk-teaser__text { font-size: 12.5px; padding: 5px 3px 5px 10px; }
}
/* Croix de la bulle : pastille plus petite, croix plus grande (v0.7.2) */
.kmk .kmk-teaser__close { width: 16px; height: 16px; margin-left: 2px; }
.kmk .kmk-teaser__close svg { width: 15px; height: 15px; stroke-width: 3; }
/* La zone cliquable de la croix reste grande (réglage d'accessibilité du site : 36 px),
   seule la pastille visible est réduite. */
body .kmk .kmk-teaser .kmk-teaser__close {
	position: relative;
	margin: 0 -6px 0 -4px;
	background: transparent;
	color: var(--kmk-orange);
}
body .kmk .kmk-teaser .kmk-teaser__close::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 17px;
	height: 17px;
	border-radius: 50%;
	background: var(--kmk-navy);
	transform: translate(-50%, -50%);
	transition: background .15s ease;
}
body .kmk .kmk-teaser .kmk-teaser__close .kmk-ico { position: relative; }
body .kmk .kmk-teaser .kmk-teaser__close:hover { background: transparent; color: var(--kmk-navy); }
body .kmk .kmk-teaser .kmk-teaser__close:hover::before { background: var(--kmk-orange); }
