/* Yachtitude Broker AI — dialog (coerente con anteprima statica) */
.ytba-dialog .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}
#yt-scroll .ytba-dialog,
.ytba-dialog {
	position: fixed;
	z-index: 100000;
	inset: 0;
	margin: auto;
	padding: 0;
	width: min(820px, calc(100% - 32px));
	height: min(520px, calc(100dvh - 32px));
	max-width: none;
	max-height: none;
	overflow: hidden;
	border: 1px solid rgba(199, 178, 111, 0.5);
	border-radius: 12px;
	background: #f7f5f0;
	color: #001425;
	box-shadow: 0 30px 100px rgba(0, 20, 38, 0.5);
}
.ytba-dialog::backdrop {
	background: rgba(0, 20, 38, 0.76);
	backdrop-filter: blur(9px);
}
.ytba-shell {
	display: grid;
	grid-template-columns: minmax(200px, 28%) 1fr;
	height: 100%;
	min-height: 0;
	overflow: hidden;
}
.ytba-story {
	padding: 16px 14px 18px;
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	color: #fff;
	background: linear-gradient(180deg, rgba(0, 28, 49, 0.65), rgba(0, 28, 49, 0.3) 45%, rgba(0, 28, 49, 0.9)), #001c31 center/cover;
}
.ytba-story--focus {
	justify-content: stretch;
}
.ytba-story-actions {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin-top: 8px;
}
.ytba-eyebrow {
	font-size: 10px;
	letter-spacing: 0.18em;
	color: #8a6b26;
}
.ytba-story .ytba-eyebrow {
	color: #eadcae;
}
.ytba-avatar-stage {
	position: relative;
	width: min(200px, 72%);
	aspect-ratio: 1;
	margin: 28px auto 8px;
}
.ytba-avatar-stage--3d {
	flex: 1 1 auto;
	width: 100%;
	max-width: none;
	min-height: 80px;
	max-height: min(320px, 52vh);
	aspect-ratio: auto;
	height: auto;
	margin: 0;
}
.ytba-avatar-3d {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 8px;
	background: radial-gradient(ellipse at 50% 20%, rgba(234, 220, 174, 0.08), transparent 55%);
}
.ytba-avatar-3d canvas {
	display: block;
	width: 100% !important;
	height: 100% !important;
}
.ytba-avatar-3d-loading--error {
	color: #ffb4b4;
}
.ytba-avatar-3d-loading {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 12px;
	margin: 0;
	text-align: center;
	font-size: 10px;
	letter-spacing: 0.14em;
	color: #eadcae;
	pointer-events: none;
}
.ytba-story--focus .ytba-avatar-stage:not(.ytba-avatar-stage--3d) {
	flex: 1 1 auto;
	width: 100%;
	max-width: none;
	margin: 0 auto;
}
.ytba-avatar-halo,
.ytba-avatar-ring {
	position: absolute;
	inset: -8%;
	border-radius: 50%;
	pointer-events: none;
}
.ytba-avatar-halo {
	border: 1px solid rgba(234, 220, 174, 0.35);
	animation: ytba-breathe 4.5s ease-in-out infinite;
}
.ytba-avatar-ring {
	inset: -4%;
	border: 1px solid rgba(199, 178, 111, 0.25);
	opacity: 0.6;
}
.ytba-story[data-ytba-avatar-state="listening"] .ytba-avatar-halo {
	animation: ytba-pulse 1.2s ease-in-out infinite;
	border-color: rgba(234, 220, 174, 0.85);
}
.ytba-story[data-ytba-avatar-state="thinking"] .ytba-avatar-ring {
	animation: ytba-spin 2.4s linear infinite;
	opacity: 1;
}
.ytba-story[data-ytba-avatar-state="speaking"] .ytba-avatar-portrait {
	box-shadow: 0 0 0 3px rgba(199, 178, 111, 0.55);
	transform: scale(calc(1 + var(--ytba-mouth, 0.15) * 0.04));
}
.ytba-avatar-portrait {
	position: absolute;
	inset: 8%;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #1a3d5c, #001425 70%);
	background-size: cover;
	background-position: center top;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
	--ytba-mouth: 0.15;
	transition: transform 0.06s linear, box-shadow 0.2s;
}
.ytba-avatar-portrait--default {
	background-image: radial-gradient(circle at 50% 38%, rgba(234, 220, 174, 0.35), transparent 42%),
		linear-gradient(180deg, #0e2a42 0%, #001425 100%);
}
.ytba-avatar-mouth {
	position: absolute;
	left: 50%;
	top: 62%;
	width: calc(18% + var(--ytba-mouth, 0.15) * 22%);
	height: calc(6% + var(--ytba-mouth, 0.15) * 10%);
	transform: translateX(-50%);
	border-radius: 999px;
	background: rgba(234, 220, 174, 0.55);
	opacity: 0.85;
	pointer-events: none;
	transition: width 0.05s linear, height 0.05s linear;
}
.ytba-avatar-portrait:not(.ytba-avatar-portrait--default) + .ytba-avatar-mouth {
	opacity: 0;
}
.ytba-avatar-bars {
	position: absolute;
	bottom: 4%;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 4px;
	align-items: flex-end;
	height: 18px;
	opacity: 0;
	transition: opacity 0.2s;
}
.ytba-story[data-ytba-avatar-state="listening"] .ytba-avatar-bars,
.ytba-story[data-ytba-avatar-state="speaking"] .ytba-avatar-bars {
	opacity: 1;
}
.ytba-avatar-bars span {
	display: block;
	width: 3px;
	height: 6px;
	background: #eadcae;
	border-radius: 2px;
	animation: ytba-bar 0.9s ease-in-out infinite;
}
.ytba-avatar-bars span:nth-child(2) {
	animation-delay: 0.12s;
}
.ytba-avatar-bars span:nth-child(3) {
	animation-delay: 0.24s;
}
.ytba-avatar-bars span:nth-child(4) {
	animation-delay: 0.08s;
}
.ytba-avatar-bars span:nth-child(5) {
	animation-delay: 0.18s;
}
.ytba-avatar-status {
	margin: 0;
	font-size: 10px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #eadcae;
	text-align: center;
}
.ytba-voice-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 0;
	width: 100%;
	max-width: 240px;
	padding: 10px 14px;
	border: 1px solid rgba(234, 220, 174, 0.45);
	border-radius: 999px;
	background: rgba(0, 20, 38, 0.35);
	color: #fff;
	font-size: 12px;
	letter-spacing: 0.06em;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s;
}
.ytba-voice-toggle[data-ytba-voice="on"] {
	background: rgba(199, 178, 111, 0.22);
	border-color: #c7b26f;
}
.ytba-voice-icon {
	font-size: 10px;
	color: #c7b26f;
}
.ytba-voice-mobile {
	display: none;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 6px;
	background: #e8edef;
	font-size: 18px;
	cursor: pointer;
}
.ytba-voice-bar {
	flex-shrink: 0;
	padding: 4px 0 0;
}
.ytba-voice-mobile--primary {
	display: none;
	width: 100%;
	height: auto;
	min-height: 44px;
	padding: 12px 16px;
	gap: 10px;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	letter-spacing: 0.04em;
	background: #001425;
	color: #eadcae;
	border-radius: 8px;
}
.ytba-mode-btn[hidden] {
  display: none !important;
}

.ytba-sources {
  font-size: 0.75rem;
  line-height: 1.5;
  opacity: 0.8;
  overflow-wrap: anywhere;
}

.ytba-mode-picker {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-right: auto;
}
.ytba-mode-picker-label {
	font-size: 9px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #657684;
	margin-right: 4px;
}
.ytba-mode-btn {
	border: 1px solid rgba(0, 40, 75, 0.18);
	background: #fff;
	color: #001425;
	border-radius: 999px;
	padding: 5px 10px;
	font-size: 10px;
	letter-spacing: 0.06em;
	cursor: pointer;
}
.ytba-mode-btn.is-active {
	background: #001425;
	color: #eadcae;
	border-color: #001425;
}
.ytba-foot {
	justify-content: flex-end;
}
.ytba-mode-voice .ytba-messages {
	flex: 1 1 auto;
}
@keyframes ytba-breathe {
	0%,
	100% {
		transform: scale(1);
		opacity: 0.7;
	}
	50% {
		transform: scale(1.04);
		opacity: 1;
	}
}
@keyframes ytba-pulse {
	0%,
	100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.07);
	}
}
@keyframes ytba-spin {
	to {
		transform: rotate(360deg);
	}
}
@keyframes ytba-bar {
	0%,
	100% {
		height: 6px;
	}
	50% {
		height: 16px;
	}
}
.ytba-chat {
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	padding: 18px 22px 14px;
}
.ytba-heading {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}
.ytba-heading h2 {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 400;
	letter-spacing: 0.02em;
}
.ytba-close {
	width: 38px;
	height: 38px;
	border: 1px solid rgba(0, 40, 75, 0.15);
	border-radius: 50%;
	background: transparent;
	font-size: 30px;
	cursor: pointer;
}
.ytba-messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 10px 4px 6px 0;
	-webkit-overflow-scrolling: touch;
}
.ytba-msg {
	margin: 0 16px 12px 0;
}
.ytba-msg-name {
	display: block;
	font-size: 9px;
	letter-spacing: 0.16em;
	color: #657684;
	margin-bottom: 6px;
}
.ytba-msg p {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	font-size: 13px;
	line-height: 1.55;
	margin: 0;
}
.ytba-msg.user {
	margin: 0 0 12px 28px;
	padding: 10px 12px;
	background: #e8edef;
	border-radius: 12px 12px 0 12px;
}
.ytba-msg.pending {
	opacity: 0.65;
}
.ytba-form {
	display: flex;
	flex-shrink: 0;
	gap: 8px;
	border: 1px solid rgba(0, 40, 75, 0.2);
	border-radius: 8px;
	background: #fff;
	padding: 6px;
}
.ytba-form input {
	flex: 1;
	min-width: 0;
	border: 0;
	padding: 6px;
	font-size: 16px;
}
.ytba-form button {
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 6px;
	color: #c7b26f;
	background: #001425;
	font-size: 22px;
	cursor: pointer;
}
.ytba-foot {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 12px;
	margin-top: 8px;
	flex-shrink: 0;
	font-size: 9px;
	color: #657684;
}
.ytba-foot button {
	border: 0;
	background: none;
	text-decoration: underline;
	cursor: pointer;
	font-size: 11px;
	color: #001425;
}
.ytba-handoff {
	display: inline-block;
	margin-top: 12px;
	padding: 10px 16px;
	border-radius: 6px;
	background: #001425;
	color: #fff;
	text-decoration: none;
	font-size: 14px;
}
@media (max-width: 768px) {
	.ytba-dialog {
		width: calc(100% - 20px);
		height: calc(100dvh - 20px);
	}
	.ytba-shell {
		grid-template-columns: 1fr;
	}
	.ytba-story {
		display: none;
	}
	.ytba-mode-voice .ytba-voice-mobile--primary {
		display: inline-flex;
	}
	.ytba-voice-mobile:not(.ytba-voice-mobile--primary) {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
	.ytba-voice-mobile[hidden] {
		display: none !important;
	}
	.ytba-chat {
		padding: 20px 18px 14px;
	}
}
