.tia-fab {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 99999;
	width: 66px;
	height: 90px;
	padding: 0;
	border: 0;
	background: transparent;
	font-size: 36px;
	line-height: 1;
	cursor: pointer;
	transform-origin: 50% 100%;
	animation: tia-pop .7s cubic-bezier(.3, 1.6, .5, 1) both, tia-idle 9s ease-in-out 1.2s infinite;
	-webkit-tap-highlight-color: transparent;
}
.tia-fab-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;
	user-select: none;
	filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .3));
}
.tia-fab, .tia-fab:hover, .tia-fab:focus, .tia-fab:active {
	background: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	color: inherit !important;
}
.tia-fab:hover, .tia-fab:focus-visible {
	animation: tia-hop .6s ease-in-out infinite;
}
.tia-fab:focus-visible .tia-fab-img { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 3px var(--tia-color, #2563eb)); }
.tia-fab[hidden], .tia-panel[hidden], .tia-tip[hidden] { display: none; }

.tia-tip {
	position: fixed;
	left: 20px;
	bottom: 118px;
	z-index: 99999;
	max-width: 220px;
	padding: 9px 13px;
	border: 2px solid #1f2937;
	border-radius: 12px;
	background: #fffbe6;
	color: #1f2937;
	font: 600 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	text-align: left;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
	transform-origin: 30px 100%;
	animation: tia-bubble .35s cubic-bezier(.3, 1.5, .5, 1) both;
}
.tia-tip:hover, .tia-tip:focus, .tia-tip:active { background: #fffbe6 !important; color: #1f2937 !important; }
.tia-tip::after {
	content: "";
	position: absolute;
	left: 26px;
	bottom: -9px;
	width: 14px;
	height: 14px;
	background: #fffbe6;
	border-right: 2px solid #1f2937;
	border-bottom: 2px solid #1f2937;
	transform: rotate(45deg);
}

@keyframes tia-pop {
	0% { transform: translateY(40px) scale(.3); opacity: 0; }
	100% { transform: none; opacity: 1; }
}
/* Reposo: flota suave y, de vez en cuando, se menea como llamando la atención. */
@keyframes tia-idle {
	0%, 60%, 100% { transform: translateY(0) rotate(0); }
	30% { transform: translateY(-4px) rotate(0); }
	66% { transform: translateY(-10px) rotate(-10deg); }
	70% { transform: translateY(0) rotate(9deg); }
	74% { transform: translateY(-6px) rotate(-8deg); }
	78% { transform: translateY(0) rotate(6deg); }
	82% { transform: translateY(0) rotate(0); }
}
@keyframes tia-hop {
	0%, 100% { transform: translateY(0) rotate(0); }
	30% { transform: translateY(-12px) rotate(-8deg); }
	60% { transform: translateY(0) rotate(8deg); }
}
@keyframes tia-bubble {
	0% { transform: scale(.3); opacity: 0; }
	100% { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
	.tia-fab, .tia-fab:hover, .tia-fab:focus-visible, .tia-tip { animation: none; }
}

.tia-panel {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 99999;
	width: 340px;
	max-width: calc(100vw - 24px);
	height: 480px;
	max-height: calc(100vh - 40px);
	display: flex;
	flex-direction: column;
	background: #fff;
	color: #1f2937;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
	font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tia-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	background: var(--tia-color, #2563eb);
	color: #fff;
}
.tia-avatar { width: 22px; height: 30px; object-fit: contain; margin-right: 8px; }
.tia-title { font-weight: 600; margin-right: auto; }
.tia-new {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, .6);
	border-radius: 6px;
	color: #fff;
	font-size: 12px;
	padding: 3px 8px;
	margin-right: 8px;
	cursor: pointer;
}
.tia-close {
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.tia-msgs {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	background: #f3f4f6;
}
.tia-msg {
	max-width: 85%;
	margin: 0 0 8px;
	padding: 8px 11px;
	border-radius: 12px;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.tia-bot { background: #fff; border: 1px solid #e5e7eb; margin-right: auto; }
.tia-user { background: var(--tia-color, #2563eb); color: #fff; margin-left: auto; }
.tia-typing { opacity: .6; font-style: italic; }
.tia-bot a { color: var(--tia-color, #2563eb); font-weight: 600; text-decoration: underline; }

.tia-card {
	display: flex;
	gap: 10px;
	max-width: 92%;
	margin: 0 auto 8px 0;
	padding: 8px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
}
.tia-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; }
.tia-card-body { min-width: 0; flex: 1; }
.tia-card-name { font-weight: 600; overflow-wrap: anywhere; }
.tia-card-price { color: #4b5563; margin-bottom: 6px; }
.tia-card-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tia-card-add {
	padding: 6px 10px;
	border: 0;
	border-radius: 8px;
	background: var(--tia-color, #2563eb);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.tia-card-add:disabled { opacity: .6; cursor: default; }
.tia-card-view { font-size: 13px; color: var(--tia-color, #2563eb); text-decoration: underline; }

.tia-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.tia-action {
	padding: 7px 12px;
	border-radius: 8px;
	border: 1px solid var(--tia-color, #2563eb);
	color: var(--tia-color, #2563eb);
	background: #fff;
	font-weight: 600;
	text-decoration: none;
}
.tia-action-checkout { background: var(--tia-color, #2563eb); color: #fff; }

.tia-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid #e5e7eb; background: #fff; }
.tia-input {
	flex: 1;
	min-width: 0;
	padding: 9px 10px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 14px;
	color: #1f2937;
	background: #fff;
}
.tia-send {
	padding: 0 14px;
	border: 0;
	border-radius: 8px;
	background: var(--tia-color, #2563eb);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}
.tia-send:disabled { opacity: .5; cursor: default; }

@media (max-width: 480px) {
	.tia-fab { left: calc(12px + env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 77px; }
	.tia-tip { left: calc(12px + env(safe-area-inset-left, 0px)); bottom: calc(98px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 32px); }
	.tia-panel { left: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; border-radius: 0; }
	.tia-form { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
	/* 16px evita el zoom automático de iOS al enfocar el campo. */
	.tia-input { font-size: 16px; }
}
@media (max-height: 520px) and (min-width: 481px) {
	.tia-panel { height: calc(100vh - 24px); max-height: calc(100vh - 24px); bottom: 12px; }
}
@media (min-width: 1600px) {
	.tia-panel { width: 380px; height: 560px; }
}

/* Formulario de modificadores */
.tia-mod {
	max-width: 100%;
	margin: 0 0 8px;
	padding: 10px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
}
.tia-mod-head { font-weight: 700; margin-bottom: 6px; overflow-wrap: anywhere; }
.tia-mod-group { margin: 0 0 10px; }
.tia-mod-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 4px; }
.tia-mod-name { font-weight: 600; }
.tia-mod-meta { font-size: 12px; color: #6b7280; }
.tia-mod-note { font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.tia-mod-opt {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 4px;
	padding: 7px 8px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	background: #fafafa;
	cursor: pointer;
}
.tia-mod-opt.tia-on { border-color: var(--tia-color, #2563eb); background: #fff; }
.tia-mod-opt input { margin: 0; flex: none; width: 18px; height: 18px; accent-color: var(--tia-color, #2563eb); }
.tia-mod-qty { cursor: default; }
.tia-mod-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tia-mod-price { flex: none; font-size: 12px; font-weight: 600; color: #4b5563; }
.tia-step-box { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.tia-step {
	width: 28px;
	height: 28px;
	padding: 0;
	border: 1px solid #d1d5db;
	border-radius: 50%;
	background: #fff !important;
	color: #1f2937 !important;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}
.tia-step:disabled { opacity: .35; cursor: default; }
.tia-step-val { min-width: 18px; text-align: center; font-weight: 600; }
.tia-mod-units { margin: 0 0 10px; padding-left: 8px; border-left: 3px solid var(--tia-color, #2563eb); }
.tia-mod-unit { margin: 0 0 6px; }
.tia-mod-notes {
	box-sizing: border-box;
	width: 100%;
	margin: 2px 0 8px;
	padding: 7px 9px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font: inherit;
	font-size: 13px;
	resize: vertical;
}
.tia-mod-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tia-mod-qtylabel { font-size: 13px; color: #4b5563; }
.tia-mod-go { margin-left: auto; padding: 8px 14px; }
.tia-mod-err { margin-top: 6px; font-size: 13px; color: #b91c1c; }
.tia-mod-err:empty { display: none; }
.tia-mod-done { opacity: .55; pointer-events: none; }
@media (max-width: 480px) {
	.tia-mod-notes { font-size: 16px; }
}
