/* --- Pestañas del sidebar --- */
	.sidebar-tabs {
		display: flex;
		gap: 6px;
		background: #eef0f5;
		border-radius: 12px;
		padding: 5px;
		margin: 16px 0 18px;
	}
	.sidebar-tab {
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 7px;
		border: none;
		background: transparent;
		color: #495066;
		font-size: 13px;
		font-weight: 600;
		padding: 9px 10px;
		border-radius: 8px;
		cursor: pointer;
		transition: background .15s ease, color .15s ease, box-shadow .15s ease;
	}
	.sidebar-tab i { font-size: 12px; }
	.sidebar-tab.active {
		background: #fff;
		color: #0b2350;
		box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	}
	.sidebar-tab.active i { color: #9fb3d9; }

	/* Burbujas, sugerencias y caja del chat: en ai-search.css (mismo diseño en todo el sitio) */

	/* --- Panel de escritorio: cabecera del asistente --- */
	.ai-sidebar .widget-item {
		position: relative;
		overflow: hidden;
		padding: 18px 18px 16px;
		background: #f6f7fb;
		border: 1px solid #eceef4;
		border-radius: 16px;
	}
	.ai-sidebar .widget-item::before {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 3px;
		background: linear-gradient(90deg, #0b2350, #ff8f72, #ff6a45, #ff8f72, #0b2350);
		background-size: 200% 100%;
		animation: ai-shimmer 3s linear infinite;
	}
	.ai-sidebar .ai-chat-messages { padding-top: 12px; }

	/* Escritorio (columna lateral): el chat ocupa el alto de la ventana y acompaña el scroll */
	@media (min-width: 992px) {
		.ai-sidebar {
			position: sticky;
			top: 100px;
		}
		.ai-sidebar .widget-item {
			display: flex;
			flex-direction: column;
			height: calc(100vh - 180px);
			min-height: 460px;
			margin-bottom: 0;
		}
		.ai-sidebar #aiChatHome,
		.ai-sidebar .sidebar-panel {
			flex: 1;
			min-height: 0;
			display: flex;
			flex-direction: column;
		}
		.ai-sidebar .ai-chat-messages {
			flex: 1;
			min-height: 0;
			max-height: none;
		}
	}

	/* --- Barra sobre los resultados: filtro por rubro + total --- */
	.directorio-barra {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 10px 14px;
		margin: 0 0 16px;
	}
	.directorio-total {
		margin: 0;
		font-size: 14px;
		color: #6b7186;
	}
	.directorio-total strong { color: #0b2350; font-size: 16px; }

	.dir-filtro { position: relative; min-width: 0; max-width: 100%; }
	/* Misma píldora que «Cómo llegar»; elegido un rubro, se rellena de navy y lleva su × */
	.dir-chip {
		display: inline-flex;
		align-items: stretch;
		max-width: 100%;
		height: 36px;
		border: 1px solid #c9d3e6;
		border-radius: 999px;
		background: #fff;
		color: #0b2350;
		transition: background-color .15s, border-color .15s, color .15s;
	}
	.dir-chip-toggle {
		display: inline-flex;
		align-items: center;
		gap: 7px;
		min-width: 0;
		padding: 0 14px;
		border: 0;
		border-radius: 999px;
		background: none;
		color: inherit;
		font-size: 13px;
		font-weight: 700;
		line-height: 1;
		cursor: pointer;
	}
	.dir-chip-toggle i { font-size: 12px; }
	.dir-chip-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.dir-chip-flecha { font-size: 10px !important; transition: transform .15s; }
	.dir-chip-toggle[aria-expanded="true"] .dir-chip-flecha { transform: rotate(180deg); }
	.dir-chip:not(.is-activo):hover,
	.dir-chip:not(.is-activo):has(.dir-chip-toggle[aria-expanded="true"]) { border-color: #0b2350; }
	.dir-chip.is-activo { background: #0b2350; border-color: #0b2350; color: #fff; }
	.dir-chip.is-activo .dir-chip-toggle { padding-right: 4px; }
	.dir-chip-quitar {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex: none;
		width: 34px;
		border-radius: 999px;
		color: #fff;
		font-size: 13px;
		text-decoration: none;
		opacity: .75;
		transition: opacity .15s, background-color .15s;
	}
	.dir-chip-quitar:hover,
	.dir-chip-quitar:focus-visible { opacity: 1; background: rgba(255,255,255,.14); color: #fff; }
	.dir-chip-toggle:focus-visible,
	.dir-chip-quitar:focus-visible { outline: 2px solid #ff6a45; outline-offset: 2px; }

	/* «Mejor calificadas»: la misma píldora, como enlace que activa o quita el orden */
	.dir-orden {
		align-items: center;
		gap: 7px;
		padding: 0 14px;
		color: #0b2350;
		font-size: 13px;
		font-weight: 700;
		line-height: 1;
		text-decoration: none;
		white-space: nowrap;
	}
	.dir-orden i { font-size: 12px; }
	.dir-orden:not(.is-activo) .fa-star { color: #f5a623; }
	.dir-orden:not(.is-activo):hover { border-color: #0b2350; color: #0b2350; }
	.dir-orden.is-activo:hover { color: #fff; }
	.dir-orden-quitar { opacity: .8; }
	.dir-orden:focus-visible { outline: 2px solid #ff6a45; outline-offset: 2px; }

	/* Escritorio: menú bajo el botón */
	.dir-menu {
		position: absolute;
		z-index: 20;
		top: calc(100% + 8px);
		left: 0;
		width: 290px;
		max-width: calc(100vw - 32px);
		padding: 6px;
		background: #fff;
		border: 1px solid #eceef4;
		border-radius: 14px;
		box-shadow: 0 14px 34px rgba(11,35,80,.14);
	}
	.dir-menu[hidden], .dir-menu-fondo[hidden] { display: none; }
	.dir-menu-cabecera { display: none; }
	.dir-menu-lista {
		max-height: min(440px, 62vh);
		overflow-y: auto;
		margin: 0;
		padding: 0;
		list-style: none;
	}
	.dir-menu-opcion {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 10px 12px;
		border-radius: 9px;
		color: #26304a;
		font-size: 14px;
		line-height: 1.3;
		text-decoration: none;
	}
	.dir-menu-opcion:hover,
	.dir-menu-opcion:focus-visible { background: #f3f5fa; color: #0b2350; outline: none; }
	.dir-menu-opcion.is-activo { color: #0b2350; font-weight: 700; }
	.dir-menu-opcion.is-activo .dir-menu-nombre::after {
		content: '\f00c';
		margin-left: 8px;
		font: var(--fa-font-solid);
		font-size: 11px;
		color: #ff6a45;
	}
	.dir-menu-n {
		flex: none;
		min-width: 26px;
		padding: 3px 8px;
		border-radius: 999px;
		background: #f0f1f6;
		color: #6b7186;
		font-size: 12px;
		font-weight: 600;
		text-align: center;
	}
	.dir-menu-opcion.is-activo .dir-menu-n { background: #fff0eb; color: #b23a1c; }

	.directorio-vacio {
		margin: 8px 0 24px;
		padding: 18px 20px;
		border: 1px dashed #c9d3e6;
		border-radius: 14px;
		color: #495066;
		font-size: 14px;
	}
	.directorio-vacio a { color: #0b2350; font-weight: 700; text-decoration: underline; }

	/* Móvil: el menú sube como hoja desde abajo, por encima de la barra del chat */
	@media (max-width: 575.98px) {
		.dir-menu-fondo {
			position: fixed;
			inset: 0;
			z-index: 1065;
			background: rgba(11,35,80,.42);
		}
		.dir-menu {
			position: fixed;
			z-index: 1066;
			top: auto;
			left: 0;
			right: 0;
			bottom: 0;
			width: auto;
			max-width: none;
			padding: 6px 12px calc(14px + env(safe-area-inset-bottom));
			border: 0;
			border-radius: 18px 18px 0 0;
			box-shadow: 0 -10px 30px rgba(11,35,80,.18);
		}
		.dir-menu-cabecera {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 10px 4px 8px 8px;
			border-bottom: 1px solid #eceef4;
			margin-bottom: 4px;
		}
		.dir-menu-titulo { color: #0b2350; font-size: 16px; font-weight: 700; }
		.dir-menu-cerrar {
			width: 38px;
			height: 38px;
			border: 0;
			border-radius: 999px;
			background: #f0f1f6;
			color: #0b2350;
		}
		.dir-menu-lista { max-height: 60vh; }
		.dir-menu-opcion { padding: 13px 10px; font-size: 15px; }
		body.dir-menu-abierto { overflow: hidden; }
	}

	/* --- Tarjetas de empresa --- */

	/* Misma altura en toda la fila y botones siempre alineados abajo */
	.empresa-card {
		display: flex;
		flex-direction: column;
		height: calc(100% - 30px);
	}
	.empresa-card .main-content { flex: 1; }

	/* En reposo, borde suave (también las destacadas, que ya llevan su etiqueta); al pasar el mouse
	   o al recorrerla con el teclado, la tarjeta se eleva con sombra y borde marino */
	.recent-job-item.empresa-card,
	.recent-job-item.empresa-card.es-destacada {
		border: 1px solid #e3e6ef;
		border-radius: 14px;
		box-shadow: 0 1px 2px rgba(11, 35, 80, .04);
		transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
	}
	.recent-job-item.empresa-card.es-destacada { border-color: #d5dcea; }
	.recent-job-item.empresa-card:focus-within {
		border-color: var(--marca-marino);
		box-shadow: 0 14px 30px -14px rgba(11, 35, 80, .35);
	}
	@media (hover: hover) {
		.recent-job-item.empresa-card:hover {
			transform: translateY(-4px);
			border-color: var(--marca-marino);
			box-shadow: 0 18px 34px -16px rgba(11, 35, 80, .38);
		}
		.recent-job-item.empresa-card .company-info img { transition: transform .3s ease; }
		.recent-job-item.empresa-card:hover .company-info img { transform: scale(1.05); }
	}
	@media (prefers-reduced-motion: reduce) {
		.recent-job-item.empresa-card:hover,
		.recent-job-item.empresa-card:hover .company-info img { transform: none; }
	}

	/* Nombre completo en máximo 2 líneas (antes se cortaba a 18 caracteres) */
	.recent-job-item.empresa-card .main-content .title a {
		height: auto;
		min-height: 52px;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		padding-top: 2px;
		line-height: 1.3;
	}
	.recent-job-item.empresa-card .main-content .title { display: flex; flex-direction: column; justify-content: center; }

	.empresa-ubicacion {
		min-height: 54px;
		margin: 10px 0 8px;
		font-size: 13px;
		line-height: 1.4;
		color: #495066;
	}
	/* Escritorio: cada línea centrada como el nombre, el rubro y las estrellas; el pin junto al distrito */
	.empresa-ubicacion-texto {
		display: flex;
		flex-direction: column;
		align-items: center;
		min-width: 0;
		text-align: center;
	}
	.empresa-ubicacion-texto i {
		margin-right: 6px;
		font-size: 13px;
		color: var(--marca-verde-medio);
	}
	.empresa-zona {
		font-weight: 600;
		color: #0b2350;
	}
	.empresa-direccion {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		overflow-wrap: anywhere;
		color: #6b7186;
	}
	/* Con distancia / «Cómo llegar» debajo, ese renglón ya da altura: sin hueco entre la dirección y los chips */
	.empresa-ubicacion:has(+ .empresa-ubicacion-extra) { min-height: 0; margin-bottom: 0; }
	/* Fila propia y centrada bajo la dirección (antes colgaba alineada a la izquierda del texto) */
	.empresa-ubicacion-extra {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: center;
		gap: 6px;
		margin: 10px 0 8px;
	}
	.empresa-distancia,
	.empresa-como-llegar,
	.empresa-sedes {
		display: inline-flex;
		align-items: center;
		gap: 5px;
		height: 26px;
		padding: 0 10px;
		border-radius: 999px;
		font-size: 12px;
		line-height: 1;
		white-space: nowrap;
	}
	.empresa-distancia i,
	.empresa-como-llegar i { font-size: 12px; }
	/* Distancia desde la ubicación del usuario (búsqueda por cercanía) */
	.empresa-distancia {
		background: #fff0eb;
		color: #b23a1c;
		font-weight: 700;
	}
	.empresa-como-llegar {
		border: 1px solid #c9d3e6;
		background: #fff;
		color: #0B2350;
		font-weight: 700;
		text-decoration: none;
		transition: background-color .15s, border-color .15s, color .15s;
	}
	.empresa-como-llegar:hover,
	.empresa-como-llegar:focus-visible { background: #0B2350; border-color: #0B2350; color: #fff; }
	.empresa-sedes {
		background: #f0f1f6;
		color: #495066;
		font-weight: 600;
	}

	/* Acciones: WhatsApp / Llamar / Ver más */
	.empresa-acciones { gap: 8px; }
	/* "Ver más" ocupa el espacio que dejan los botones redondos, sin partirse en dos líneas */
	.empresa-acciones .btn-second {
		flex: 1;
		min-width: 0;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		height: 38px;
		padding: 0 14px;
		white-space: nowrap;
		line-height: 1;
	}

	/* Logos completos (sin recortar los anchos) dentro de un cuadro neutro */
	.recent-job-item.empresa-card .company-info a {
		display: flex;
		align-items: center;
		justify-content: center;
		background: #fff;
		border: 1px solid #f0f1f6;
		border-radius: 10px;
	}
	.recent-job-item.empresa-card .company-info img {
		width: 100%;
		height: 100%;
		object-fit: contain;
		padding: 4px;
	}
	.empresa-accion {
		flex-shrink: 0;
		width: 38px;
		height: 38px;
		border-radius: 50%;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		border: 2px solid #e7e9f0;
		background: #fff;
		color: #0b2350;
		font-size: 17px;
		transition: background .15s ease, border-color .15s ease, color .15s ease;
	}
	.empresa-accion:hover { border-color: #0b2350; color: #0b2350; }
	.empresa-accion-ws { color: #1da851; border-color: #c9efd6; }
	.empresa-accion-ws:hover { background: #25d366; border-color: #25d366; color: #fff; }

	/* Móvil: tarjeta horizontal compacta, entran más resultados por pantalla */
	@media (max-width: 575.98px) {
		/* La cabecera móvil es más baja que en escritorio: menos espacio vacío arriba */
		.directorio-area .container { padding-top: 88px; }

		.recent-job-item.empresa-card {
			display: grid;
			/* minmax(0, …): sin él, un nombre largo del catálogo ensancha la columna y la tarjeta se sale de la pantalla */
			grid-template-columns: 60px minmax(0, 1fr);
			column-gap: 14px;
			align-items: start;
			height: auto;
			margin-bottom: 14px;
			padding: 16px;
			border-radius: 14px;
		}
		.empresa-card .company-info { justify-content: flex-start; }
		.empresa-card .company-info a,
		.recent-job-item.empresa-card .company-info img {
			width: 60px;
			height: 60px;
		}
		.recent-job-item.empresa-card .company-info img { border-radius: 10px; }
		.recent-job-item.empresa-card .main-content {
			margin: 0;
			text-align: left;
		}
		.recent-job-item.empresa-card .main-content .title { font-size: 16px; margin-bottom: 2px; }
		.recent-job-item.empresa-card .main-content .title a {
			min-height: 0;
			padding-top: 0;
		}
		.recent-job-item.empresa-card .main-content .work-type { font-size: 13px; color: #6b7186; }
		.empresa-card .empresa-ubicacion {
			min-height: 0;
			margin: 6px 0 4px;
			font-size: 12.5px;
		}
		/* Teléfono (tarjeta alineada a la izquierda): pin a la izquierda y el texto con sangría, como antes */
		.empresa-card .empresa-ubicacion-texto {
			position: relative;
			align-items: flex-start;
			padding-left: 20px;
			text-align: left;
		}
		.empresa-card .empresa-ubicacion-texto i {
			position: absolute;
			top: 2px;
			left: 0;
			margin: 0;
			font-size: 14px;
		}
		.empresa-card .rating { margin-bottom: 0; font-size: 12px; }
		.empresa-card .empresa-acciones {
			grid-column: 1 / -1;
			margin-top: 12px;
			padding-top: 12px;
			border-top: 1px solid #f0f1f6;
		}
		.empresa-card .empresa-accion { width: 40px; height: 40px; }
	}

	/* "Empresa verificada" se apoya sobre el borde superior: así nunca tapa el logo ni el nombre */
	.recent-job-item.empresa-card.es-destacada { margin-top: 22px; overflow: visible; }
	.empresa-card.es-destacada .badge-destacado {
		top: -12px;
		right: 14px;
		box-shadow: 0 4px 10px -4px rgba(11, 35, 80, .5);
	}

	/* --- Debug: motivo de coincidencia (solo modo desarrollador) --- */
	.dev-match-reason {
		margin-top: 8px;
		padding: 8px 10px;
		background: #fffaeb;
		border: 1px dashed #e8522c;
		border-radius: 8px;
		font-size: 11.5px;
		line-height: 1.45;
		color: #5c4700;
		text-align: left;
	}
	.dev-match-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 6px;
		margin-bottom: 4px;
		font-size: 11px;
		color: #1a5e2a;
	}
	.dev-match-score {
		flex-shrink: 0;
		padding: 1px 7px;
		border-radius: 999px;
		background: #ffe58a;
		color: #5c4700;
		font-weight: 700;
	}
	.dev-match-list {
		margin: 0;
		padding-left: 16px;
	}
	.dev-match-list li { margin-bottom: 2px; }
	.dev-match-verdict {
		margin-top: 5px;
		padding-top: 5px;
		border-top: 1px dashed #ecd27a;
		color: #2f6b2f;
		font-weight: 600;
	}

	/* --- Debug: detalle técnico de errores (solo modo desarrollador) --- */
	.ai-chat-bubble-dev { display: block; }
	.ai-chat-text-dev {
		max-width: 100%;
		background: #fff0eb;
		border: 1px dashed #e8522c;
		color: #1a5e2a;
		font-family: 'Courier New', monospace;
		font-size: 11px;
		line-height: 1.4;
		word-break: break-word;
		border-radius: 8px;
		padding: 7px 10px;
	}
	.dev-error-detail {
		margin: 8px 0 0;
		padding: 8px 10px;
		background: #fff0eb;
		border: 1px dashed #e8522c;
		border-radius: 6px;
		color: #1a5e2a;
		font-family: 'Courier New', monospace;
		font-size: 11px;
		white-space: pre-wrap;
		word-break: break-word;
	}


	/* Identidad visual de la IA, chat, orbe y "pensando": ahora en ai-search.css (compartidos con el chat global) */

	/* --- Resultados: barrido mientras la IA busca y entrada escalonada al llegar --- */
	/* Cada tarjeta se atenúa y una luz la cruza en diagonal, un poco desfasada de la vecina. Va en cada tarjeta
	   (no una franja sobre toda la lista): así se ve siempre, aunque la lista sea más alta que la pantalla. Es un
	   fondo animado: no cambia la posición de nada (la etiqueta «Empresa verificada» queda donde está) */
	#directorioResultados.ai-scanning .directorio-barra,
	#directorioResultados.ai-scanning .empresa-card > *,
	#directorioResultados.ai-scanning .pagination-area,
	#directorioResultados.ai-scanning .directorio-vacio {
		opacity: .4;
		filter: saturate(.6);
		transition: opacity .3s ease, filter .3s ease;
	}
	#directorioResultados.ai-scanning .empresa-card {
		background-image: linear-gradient(105deg, transparent 38%, rgba(255, 106, 69, .10) 46%, rgba(46, 84, 160, .16) 50%, rgba(255, 106, 69, .10) 54%, transparent 62%);
		background-size: 300% 100%;
		background-repeat: no-repeat;
		animation: ai-scan-tarjeta 1.5s ease-in-out infinite;
	}
	#directorioResultados.ai-scanning .row > [class*="col-"]:nth-child(3n+2) .empresa-card { animation-delay: .18s; }
	#directorioResultados.ai-scanning .row > [class*="col-"]:nth-child(3n) .empresa-card { animation-delay: .36s; }
	@keyframes ai-scan-tarjeta {
		from { background-position: 100% 0; }
		to   { background-position: 0 0; }
	}
	.ai-results-in .row > [class*="col-"] { animation: ai-rise .45s cubic-bezier(.22, 1, .36, 1) both; }
	.ai-results-in .row > [class*="col-"]:nth-child(2) { animation-delay: .06s; }
	.ai-results-in .row > [class*="col-"]:nth-child(3) { animation-delay: .12s; }
	.ai-results-in .row > [class*="col-"]:nth-child(4) { animation-delay: .18s; }
	.ai-results-in .row > [class*="col-"]:nth-child(5) { animation-delay: .24s; }
	.ai-results-in .row > [class*="col-"]:nth-child(n+6) { animation-delay: .3s; }
	@keyframes ai-rise {
		from { opacity: 0; transform: translateY(14px); }
		to   { opacity: 1; transform: none; }
	}

	/* =====================================================================
	   Móvil: lanzador, botón flotante y hoja inferior
	   ===================================================================== */

	/* Buscador IA en móvil: barra de chat fija abajo, como en las apps de mensajería.
	   No ocupa espacio arriba: los resultados empiezan justo bajo la cabecera. */
	.ai-mbar {
		position: fixed;
		z-index: 1030;
		left: 0;
		right: 0;
		bottom: var(--kb, 0px); /* sube sobre el teclado del teléfono (ver _ai_search.html.twig) */
		padding: 8px 12px calc(6px + env(safe-area-inset-bottom));
		background: rgba(255, 255, 255, .96);
		-webkit-backdrop-filter: blur(8px);
		backdrop-filter: blur(8px);
		border-top: 1px solid #e3e6ee;
		box-shadow: 0 -6px 20px -12px rgba(11, 35, 80, .3);
	}
	body.ai-sheet-open .ai-mbar { visibility: hidden; }
	.kb-abierto .ai-mbar { padding-bottom: 6px; }
	.kb-abierto .ai-sheet-panel { padding-bottom: 0; border-radius: 16px 16px 0 0; }
	.ai-mbar-form {
		display: flex;
		align-items: center;
		gap: 8px;
		margin: 0;
		padding: 4px 4px 4px 16px;
		border: 1px solid #d5d9e4;
		border-radius: 999px;
		background: #fff;
		transition: border-color .15s ease, box-shadow .15s ease;
	}
	.ai-mbar-form:focus-within { border-color: var(--ai-violet); box-shadow: 0 0 0 3px rgba(11, 35, 80, .15); }
	.ai-mbar-field { position: relative; flex: 1; min-width: 0; display: flex; }
	.ai-mbar-form input {
		flex: 1;
		min-width: 0;
		width: 100%;
		height: 38px;
		padding: 0 0 0 4px;
		border: none;
		outline: none;
		background: transparent;
		color: #1a1a1a;
		font-size: 16px; /* evita el zoom automático de iOS */
		-webkit-appearance: none;
		appearance: none;
	}
	.ai-mbar-form input::placeholder { color: #7a8094; }
	.ai-mbar-form input::-webkit-search-cancel-button { display: none; }
	.ai-mbar-send {
		flex-shrink: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		border: none;
		border-radius: 50%;
		background: var(--ai-navy);
		color: var(--ai-yellow);
		font-size: 15px;
	}
	.ai-mbar-send:active { transform: scale(.92); }
	/* Cursor que parpadea al inicio del campo vacío; al tocarlo lo reemplaza el cursor real */
	.ai-mbar-caret {
		position: absolute;
		left: 1px;
		top: 50%;
		width: 2px;
		height: 20px;
		margin-top: -10px;
		border-radius: 1px;
		background: var(--ai-violet);
		pointer-events: none;
		animation: ai-caret 1.05s steps(1) infinite;
	}
	@keyframes ai-caret { 50% { opacity: 0; } }
	.ai-mbar-field input:not(:placeholder-shown) + .ai-mbar-caret,
	.ai-mbar-field input:focus + .ai-mbar-caret { display: none; }
	/* Alineada a la izquierda con el texto del campo: al escribirse el ejemplo la línea no "baila" */
	.ai-mbar-hint {
		margin: 5px 0 0 21px;
		padding: 0;
		overflow: hidden;
		color: #7a8094;
		font-size: 12px;
		line-height: 1.35;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.ai-mbar-hint span { color: #4a5068; }
	/* Vista previa de la conversación: aparece sobre la barra al tocarla */
	.ai-mbar-peek {
		display: flex;
		align-items: center;
		gap: 10px;
		width: 100%;
		margin-bottom: 8px;
		padding: 10px 12px;
		border: 1px solid #e3e6ee;
		border-radius: 14px;
		background: #f6f7fb;
		text-align: left;
		animation: ai-peek-in .22s cubic-bezier(.22, 1, .36, 1) both;
		-webkit-tap-highlight-color: transparent;
	}
	.ai-mbar-peek[hidden] { display: none; }
	.ai-mbar-peek:active { background: #eceef5; }
	@keyframes ai-peek-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
	.ai-mbar-peek-orb { width: 30px; height: 30px; font-size: 12px; }
	.ai-mbar-peek-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
	.ai-mbar-peek-q,
	.ai-mbar-peek-a { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.3; }
	.ai-mbar-peek-q { color: var(--ai-navy); font-size: 13.5px; font-weight: 600; }
	.ai-mbar-peek-a { color: #6b7186; font-size: 13px; }
	.ai-mbar-peek-open { flex-shrink: 0; color: #1e3a70; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
	.ai-mbar-peek-open i { font-size: 10px; margin-left: 2px; }

	/* Espacio para que la barra no tape la última tarjeta ni el botón "subir" */
	@media (max-width: 575.98px) {
		.directorio-area { padding-bottom: calc(var(--ai-mbar-h, 86px) + 6px); }
		.scroll-to-top.sobre-ai-mbar.show { bottom: calc(var(--ai-mbar-h, 86px) + 8px); }
	}

	/* Panel lateral del asistente (entra desde la izquierda) */
	body.ai-sheet-open { overflow: hidden; }
	.ai-sheet {
		position: fixed;
		inset: 0;
		z-index: 1060;
		visibility: hidden;
		pointer-events: none;
		transition: visibility 0s linear .4s;
	}
	.ai-sheet.is-open {
		visibility: visible;
		pointer-events: auto;
		transition-delay: 0s;
	}
	.ai-sheet-backdrop {
		position: absolute;
		inset: 0;
		background: rgba(11, 35, 80, .55);
		-webkit-backdrop-filter: blur(3px);
		backdrop-filter: blur(3px);
		opacity: 0;
		transition: opacity .3s ease;
	}
	.ai-sheet.is-open .ai-sheet-backdrop { opacity: 1; }
	.ai-sheet-panel {
		position: absolute;
		left: 0;
		right: 0;
		bottom: var(--kb, 0px); /* sube sobre el teclado del teléfono */
		height: 82vh;
		height: min(82dvh, calc(100dvh - var(--kb, 0px) - 12px));
		display: flex;
		flex-direction: column;
		background: #f6f7fb;
		border-radius: 22px 22px 0 0;
		box-shadow: 0 -12px 40px rgba(11, 35, 80, .3);
		padding-bottom: env(safe-area-inset-bottom);
		transform: translateY(100%);
		transition: transform .42s cubic-bezier(.22, 1, .36, 1);
		overflow: hidden;
	}
	.ai-sheet.is-open .ai-sheet-panel { transform: translateY(0); }
	/* Franja de gradiente IA en el borde superior */
	.ai-sheet-panel::before {
		content: '';
		position: absolute;
		z-index: 1;
		top: 0;
		left: 0;
		right: 0;
		height: 3px;
		background: linear-gradient(90deg, var(--ai-yellow), var(--ai-amber), var(--ai-violet), var(--ai-cyan), var(--ai-yellow));
		background-size: 200% 100%;
		animation: ai-shimmer 3s linear infinite;
	}

	.ai-sheet-grab {
		flex-shrink: 0;
		padding: 8px 14px 10px;
		touch-action: none;
		background: #fff;
		border-bottom: 1px solid #eceef4;
	}
	.ai-sheet-handle {
		display: block;
		width: 40px;
		height: 4px;
		margin: 2px auto 10px;
		border-radius: 4px;
		background: #d4d8e3;
	}
	.ai-sheet-header {
		display: flex;
		align-items: center;
		gap: 10px;
	}
	.ai-sheet-heading { flex: 1; min-width: 0; }
	.ai-sheet-heading h3 {
		margin: 0;
		font-size: 16px;
		line-height: 1.2;
		color: var(--ai-navy);
	}
	.ai-sheet-status {
		display: block;
		font-size: 11.5px;
		color: #6b7186;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.ai-sheet-status .ai-live-dot { width: 6px; height: 6px; margin-right: 2px; }
	.ai-sheet-icon-btn {
		flex-shrink: 0;
		width: 36px;
		height: 36px;
		border: none;
		border-radius: 50%;
		background: #f0f1f6;
		color: #495066;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 15px;
	}
	.ai-sheet-icon-btn:active { background: #e3e5ee; }

	.ai-sheet-body {
		flex: 1;
		min-height: 0;
		display: flex;
		flex-direction: column;
		padding: 0 14px 10px;
	}
	.ai-sheet-body .sidebar-panel {
		flex: 1;
		min-height: 0;
		display: flex;
		flex-direction: column;
	}
	.ai-sheet-body .ai-chat-messages {
		flex: 1;
		min-height: 0;
		max-height: none;
		margin-bottom: 8px;
		padding: 14px 2px 8px;
		overscroll-behavior: contain;
	}
	.ai-sheet-body .ai-chat-text { max-width: 86%; font-size: 14px; }
	.ai-sheet-body .ai-chat-avatar { width: 28px; height: 28px; font-size: 12px; }

	/* Sugerencias en una sola fila deslizable: ahorra altura */
	.ai-sheet-body .ai-chat-suggestions {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		margin: 0 -14px 10px;
		padding: 0 14px 2px;
		scrollbar-width: none;
	}
	.ai-sheet-body .ai-chat-suggestions[hidden] { display: none; }
	.ai-sheet-body .ai-chat-suggestions::-webkit-scrollbar { display: none; }
	.ai-sheet-body .ai-chat-suggestions-title { display: none; }
	.ai-sheet-body .ai-chat-suggestion {
		flex: 0 0 200px;
		flex-direction: row;
		align-items: center;
		gap: 10px;
		margin-right: 8px;
		padding: 9px 12px;
	}
	.ai-sheet-body .ai-chat-suggestion-text small {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.ai-sheet-body .ai-chat-input-row { padding: 5px 5px 5px 16px; }
	/* 16px evita el zoom automático de iOS al enfocar el campo */
	.ai-sheet-body .ai-chat-input { font-size: 16px; }
	.ai-sheet-body .ai-chat-send { width: 40px; height: 40px; font-size: 15px; }

	/* "Ver N proveedores" tras una búsqueda */
	.ai-chat-results-cta { display: none; }
	.ai-sheet-body .ai-chat-results-cta:not([hidden]) {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 8px;
		width: 100%;
		margin-bottom: 10px;
		padding: 11px 14px;
		border: none;
		border-radius: 999px;
		background: var(--ai-navy);
		color: #fff;
		font-size: 14px;
		font-weight: 600;
		animation: ai-fade-in .35s ease both;
	}
	.ai-sheet-body .ai-chat-results-cta i { color: var(--ai-yellow); font-size: 13px; }
	/* Cierre automático en curso: el botón se va llenando hasta que la hoja baja sola */
	.ai-sheet-body .ai-chat-results-cta { position: relative; overflow: hidden; isolation: isolate; }
	.ai-sheet-body .ai-chat-results-cta.is-auto::before {
		content: '';
		position: absolute;
		z-index: -1;
		inset: 0;
		background: rgba(255, 255, 255, .16);
		transform-origin: left center;
		animation: ai-cta-fill var(--cierre-ms, 4000ms) linear both;
	}
	@keyframes ai-cta-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

	@media (prefers-reduced-motion: reduce) {
		.ai-orb,
		.ai-orb i,
		.ai-live-dot,
		.ai-sheet-panel::before,
		.ai-sidebar .widget-item::before,
		.ai-chat-avatar-thinking::after,
		.ai-chat-text.ai-thinking,
		.ai-thinking-dots i,
		.ai-chat-bubble-bot .ai-chat-text,
		.ai-results-in .row > [class*="col-"],
		#directorioResultados.ai-scanning .empresa-card {
			animation: none !important;
		}
		.ai-sheet-panel { transition-duration: .28s; } /* se sigue viendo que baja/sube, solo más rápido */
		.ai-mbar-peek { animation: none; }
	}
/* Ítems del catálogo que coincidieron con la búsqueda, con su precio */
.empresa-catalogo-match { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; text-align: left; }
.empresa-catalogo-match a {
	display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
	padding: 6px 10px; border-radius: 8px; background: #fff0eb; color: #0b2350; font-size: 13px;
}
.empresa-catalogo-match a:hover { background: #ffe3d9; }
.empresa-catalogo-match span { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.empresa-catalogo-match strong { flex-shrink: 0; color: #c8441f; }
.empresa-catalogo-mas a { justify-content: center; background: transparent; color: #4a5068; padding: 2px; }
