/* Pymeinnova NINA — widget de voz, texto e interacción. */
.pns-nina {
	--nina-blue: #141e9c;
	--nina-teal: #12bfa0;
	--nina-ink: #0b1020;
	--nina-muted: #667085;
	--nina-line: #e4e9f2;
	--nina-surface: #fff;
	--nina-soft: #f5f8fc;
	--nina-grad: linear-gradient(135deg, var(--nina-blue), #136e9e 58%, var(--nina-teal));
	position: fixed;
	right: max(18px, env(safe-area-inset-right));
	bottom: max(18px, env(safe-area-inset-bottom));
	z-index: 2147482000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.45;
	color: var(--nina-ink);
}
.pns-nina *, .pns-nina *::before, .pns-nina *::after { box-sizing: border-box; }
.pns-nina button, .pns-nina input { font: inherit; }
.pns-nina button { cursor: pointer; }
.pns-nina [hidden] { display: none !important; }
.pns-nina .pns-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.pns-nina__launcher {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 62px;
	padding: 7px 14px 7px 7px;
	border: 1px solid rgba(20,30,156,.12);
	border-radius: 999px;
	background: rgba(255,255,255,.96);
	box-shadow: 0 16px 48px rgba(11,16,32,.2), 0 3px 10px rgba(11,16,32,.1);
	color: var(--nina-ink);
	backdrop-filter: blur(14px);
	transition: transform .2s ease, box-shadow .2s ease;
}
.pns-nina__launcher:hover { transform: translateY(-2px); box-shadow: 0 20px 54px rgba(20,30,156,.24), 0 3px 10px rgba(11,16,32,.1); }
.pns-nina__launcher:focus-visible, .pns-nina button:focus-visible, .pns-nina input:focus-visible { outline: 3px solid rgba(18,191,160,.42); outline-offset: 3px; }
.pns-nina__launcher-logo, .pns-nina__avatar { display: block; object-fit: cover; background: #fff; }
.pns-nina__launcher-logo { width: 48px; height: 48px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(18,191,160,.2); }
.pns-nina__launcher-ring { position: absolute; left: 7px; width: 48px; height: 48px; border: 2px solid rgba(18,191,160,.45); border-radius: 50%; animation: pns-nina-pulse 2.2s ease-out infinite; }
.pns-nina__launcher-copy { display: grid; text-align: left; line-height: 1.2; }
.pns-nina__launcher-copy strong { font-size: 14px; font-weight: 800; }
.pns-nina__launcher-copy small { margin-top: 3px; color: var(--nina-muted); font-size: 11px; }
.pns-nina__launcher-mic { width: 20px; height: 20px; fill: var(--nina-blue); }
.pns-nina[data-open="true"] .pns-nina__launcher { opacity: 0; pointer-events: none; transform: translateY(12px) scale(.94); }

.pns-nina__panel {
	position: absolute;
	right: 0;
	bottom: 0;
	display: grid;
	grid-template-rows: auto auto minmax(150px, 1fr) auto auto auto auto auto;
	width: min(410px, calc(100vw - 24px));
	height: min(700px, calc(100vh - 36px));
	min-height: 520px;
	border: 1px solid rgba(20,30,156,.12);
	border-radius: 26px;
	overflow: hidden;
	background: var(--nina-surface);
	box-shadow: 0 28px 80px rgba(11,16,32,.28), 0 8px 24px rgba(20,30,156,.12);
	transform-origin: right bottom;
	animation: pns-nina-open .24s cubic-bezier(.2,.8,.3,1) both;
}
.pns-nina__header { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; color: #fff; background: var(--nina-grad); }
.pns-nina__identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pns-nina__avatar { width: 46px; height: 46px; border-radius: 15px; border: 2px solid rgba(255,255,255,.9); }
.pns-nina__identity h2 { margin: 0; color: #fff; font-size: 18px; font-weight: 850; line-height: 1.15; }
.pns-nina__identity p { margin: 3px 0 0; max-width: 260px; overflow: hidden; color: rgba(255,255,255,.82); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.pns-nina__icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 12px; background: rgba(255,255,255,.14); color: #fff; }
.pns-nina__icon-btn:hover { background: rgba(255,255,255,.23); }
.pns-nina__icon-btn svg { width: 22px; height: 22px; fill: currentColor; }

.pns-nina__statusbar { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 16px; border-bottom: 1px solid var(--nina-line); color: var(--nina-muted); background: #fbfcfe; font-size: 12px; }
.pns-nina__status-dot { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; box-shadow: 0 0 0 3px rgba(152,162,179,.13); }
.pns-nina[data-state="ready"] .pns-nina__status-dot, .pns-nina[data-state="listening"] .pns-nina__status-dot { background: var(--nina-teal); box-shadow: 0 0 0 3px rgba(18,191,160,.16); }
.pns-nina[data-state="speaking"] .pns-nina__status-dot, .pns-nina[data-state="thinking"] .pns-nina__status-dot { background: #6070ed; box-shadow: 0 0 0 3px rgba(96,112,237,.16); }
.pns-nina[data-state="error"] .pns-nina__status-dot { background: #e5484d; }
.pns-nina__timer { margin-left: auto; color: #98a2b3; font-variant-numeric: tabular-nums; }

.pns-nina__messages { overflow: auto; padding: 18px 16px 8px; background: linear-gradient(180deg, #fff 0%, #f9fbfe 100%); scroll-behavior: smooth; }
.pns-nina__message { display: flex; margin: 0 0 12px; }
.pns-nina__message--user { justify-content: flex-end; }
.pns-nina__bubble { max-width: 86%; padding: 10px 13px; border-radius: 7px 17px 17px 17px; background: #eef2ff; color: #27305f; font-size: 14px; box-shadow: 0 1px 2px rgba(11,16,32,.04); white-space: pre-wrap; }
.pns-nina__message--user .pns-nina__bubble { border-radius: 17px 7px 17px 17px; background: var(--nina-grad); color: #fff; }
.pns-nina__message.is-partial .pns-nina__bubble::after { content: ""; display: inline-block; width: 5px; height: 13px; margin-left: 3px; vertical-align: -2px; background: currentColor; animation: pns-nina-blink .8s steps(2,end) infinite; }

.pns-nina__project { margin: 0 14px 8px; padding: 10px 12px; border: 1px solid rgba(18,191,160,.24); border-radius: 14px; background: linear-gradient(135deg,rgba(20,30,156,.055),rgba(18,191,160,.08)); }
.pns-nina__project > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pns-nina__project span { display: inline-flex; align-items: center; gap: 6px; color: #27305f; font-size: 11px; font-weight: 800; }
.pns-nina__project i { width: 7px; height: 7px; border-radius: 50%; background: var(--nina-teal); box-shadow: 0 0 0 3px rgba(18,191,160,.14); }
.pns-nina__project strong { color: var(--nina-blue); font-size: 14px; font-variant-numeric: tabular-nums; }
.pns-nina__project p { margin: 4px 0 0; color: var(--nina-muted); font-size: 10.5px; }
.pns-nina__project-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(18,191,160,.18); }
.pns-nina__project-actions a { flex: 1 1 120px; padding: 7px 9px; border: 1px solid rgba(20,30,156,.16); border-radius: 9px; color: var(--nina-blue); background: #fff; font-size: 10.5px; font-weight: 800; text-align: center; text-decoration: none; }
.pns-nina__project-actions a:last-child { border-color: transparent; background: var(--nina-grad); color: #fff; }

.pns-nina__quick { display: flex; gap: 7px; overflow-x: auto; padding: 8px 14px 10px; scrollbar-width: none; background: #f9fbfe; }
.pns-nina__quick::-webkit-scrollbar { display: none; }
.pns-nina__quick button { flex: 0 0 auto; padding: 7px 10px; border: 1px solid #dce3f0; border-radius: 999px; color: #33406c; background: #fff; font-size: 11px; font-weight: 700; }
.pns-nina__quick button:hover { border-color: var(--nina-teal); color: #087d6b; }

.pns-nina__voice { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 14px; border-top: 1px solid var(--nina-line); background: #fff; }
.pns-nina__wave { display: none; align-items: center; gap: 3px; width: 38px; height: 28px; }
.pns-nina__wave span { display: block; width: 3px; height: 8px; border-radius: 999px; background: var(--nina-teal); animation: pns-nina-wave .8s ease-in-out infinite alternate; }
.pns-nina__wave span:nth-child(2), .pns-nina__wave span:nth-child(6) { animation-delay: -.25s; }
.pns-nina__wave span:nth-child(3), .pns-nina__wave span:nth-child(5) { animation-delay: -.45s; }
.pns-nina__wave span:nth-child(4) { animation-delay: -.65s; }
.pns-nina[data-state="listening"] .pns-nina__wave, .pns-nina[data-state="speaking"] .pns-nina__wave { display: flex; }
.pns-nina__mic { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border: 0; border-radius: 14px; color: #fff; background: var(--nina-grad); font-size: 13px; font-weight: 800; box-shadow: 0 8px 22px rgba(20,30,156,.18); }
.pns-nina__mic svg { width: 20px; height: 20px; fill: currentColor; }
.pns-nina[data-state="listening"] .pns-nina__mic { background: linear-gradient(135deg,#c92a36,#ef5b62); }
.pns-nina__end { min-height: 42px; padding: 8px 12px; border: 1px solid #e6abb0; border-radius: 12px; color: #a52831; background: #fff7f7; font-size: 12px; font-weight: 750; }

.pns-nina__form { display: grid; grid-template-columns: 1fr 42px; gap: 7px; padding: 0 14px 12px; background: #fff; }
.pns-nina__form input { min-width: 0; height: 42px; padding: 0 13px; border: 1px solid #dce3f0; border-radius: 13px; color: var(--nina-ink); background: #f9fbfe; font-size: 13px; }
.pns-nina__form input:focus { border-color: var(--nina-teal); background: #fff; }
.pns-nina__form button { display: grid; place-items: center; border: 0; border-radius: 13px; color: #fff; background: var(--nina-blue); }
.pns-nina__form button svg { width: 20px; height: 20px; fill: currentColor; }
.pns-nina__privacy { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 0 14px 12px; color: #8b95a7; background: #fff; font-size: 9.5px; text-align: center; }
.pns-nina__privacy svg { flex: 0 0 auto; width: 13px; height: 13px; fill: currentColor; }

.pns-nina__confirm { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(11,16,32,.55); backdrop-filter: blur(5px); }
.pns-nina__confirm-card { width: min(360px, 100%); padding: 24px; border-radius: 22px; background: #fff; box-shadow: 0 24px 80px rgba(0,0,0,.28); text-align: center; }
.pns-nina__confirm-icon { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%; color: #fff; background: var(--nina-grad); font-size: 24px; font-weight: 900; }
.pns-nina__confirm h3 { margin: 0 0 8px; font-size: 18px; }
.pns-nina__confirm p { margin: 0 0 18px; color: var(--nina-muted); font-size: 14px; }
.pns-nina__confirm-card > div:last-child { display: flex; justify-content: center; gap: 9px; }
.pns-nina__confirm-no, .pns-nina__confirm-yes { min-width: 110px; padding: 10px 15px; border-radius: 12px; font-weight: 800; }
.pns-nina__confirm-no { border: 1px solid var(--nina-line); color: var(--nina-muted); background: #fff; }
.pns-nina__confirm-yes { border: 0; color: #fff; background: var(--nina-grad); }
.pns-nina__toast { position: absolute; right: 8px; bottom: 76px; max-width: 300px; padding: 10px 13px; border-radius: 12px; color: #fff; background: #172039; box-shadow: 0 8px 24px rgba(11,16,32,.25); font-size: 12px; animation: pns-nina-open .18s ease both; }
.pns-nina-highlight { outline: 4px solid rgba(18,191,160,.55) !important; outline-offset: 4px !important; border-radius: 6px; transition: outline-color .25s ease; }

/* Modo integrado: en la plataforma NINA deja de ser un globo flotante y se
   convierte en la asesora principal, siempre visible junto al cotizador. */
.pns-nina.pns-nina--embedded {
	position: relative;
	right: auto;
	bottom: auto;
	z-index: 1;
	display: block;
	width: 100%;
}
.pns-nina.pns-nina--embedded .pns-nina__launcher { display: none !important; }
.pns-nina.pns-nina--embedded .pns-nina__panel {
	position: relative;
	right: auto;
	bottom: auto;
	inset: auto;
	width: 100%;
	height: 650px;
	min-height: 650px;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	animation: none;
}
.pns-nina.pns-nina--embedded .pns-nina__close,
.pns-nina.pns-nina--embedded #pns-nina-close { display: none; }
.pns-nina.pns-nina--embedded .pns-nina__header { padding: 18px 19px; }
.pns-nina.pns-nina--embedded .pns-nina__messages { min-height: 190px; }
.pns-nina.pns-nina--embedded .pns-nina__privacy { padding-bottom: 14px; }

@keyframes pns-nina-open { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pns-nina-pulse { 0% { opacity: .7; transform: scale(1); } 70%,100% { opacity: 0; transform: scale(1.35); } }
@keyframes pns-nina-wave { from { height: 5px; } to { height: 24px; } }
@keyframes pns-nina-blink { 50% { opacity: 0; } }

@media (max-width: 540px) {
	.pns-nina { right: 12px; bottom: 12px; }
	.pns-nina__launcher-copy { display: none; }
	.pns-nina__launcher { min-width: 62px; padding-right: 7px; }
	.pns-nina__launcher-mic { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; padding: 4px; border-radius: 50%; fill: #fff; background: var(--nina-blue); }
	.pns-nina__panel { position: fixed; inset: 8px 8px max(8px,env(safe-area-inset-bottom)); width: auto; height: auto; min-height: 0; border-radius: 22px; }
	.pns-nina__identity p { max-width: 220px; }
	.pns-nina.pns-nina--embedded { right: auto; bottom: auto; }
	.pns-nina.pns-nina--embedded .pns-nina__panel { position: relative; inset: auto; width: 100%; height: min(680px, calc(100vh - 150px)); min-height: 520px; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.pns-nina *, .pns-nina *::before, .pns-nina *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (prefers-color-scheme: dark) {
	.pns-nina { --nina-ink: #f4f7fc; --nina-muted: #aab4c5; --nina-line: #293147; --nina-surface: #111827; --nina-soft: #172033; }
	.pns-nina__launcher, .pns-nina__panel { background: rgba(17,24,39,.98); color: var(--nina-ink); border-color: #30394e; }
	.pns-nina__statusbar, .pns-nina__quick, .pns-nina__voice, .pns-nina__form, .pns-nina__privacy { background: #111827; }
	.pns-nina__messages { background: linear-gradient(180deg,#111827,#151d2e); }
	.pns-nina__quick button, .pns-nina__form input { border-color: #34405a; color: #dce4f3; background: #1a2335; }
	.pns-nina__bubble { background: #242e48; color: #e6ebf6; }
	.pns-nina__project span { color: #dce4f3; }
	.pns-nina__project strong { color: #7bdcca; }
	.pns-nina__confirm-card { color: #f4f7fc; background: #111827; }
}

/* NINA conserva la experiencia de ANA: voz, transcripción y acciones. No hay
   una caja de chat que el visitante deba completar. */
.pns-nina__panel { grid-template-rows: auto auto minmax(190px,1fr) auto auto auto; }
.pns-nina__header { background: linear-gradient(120deg,#141e9c 0%,#126d9c 58%,#12bfa0 100%); }
.pns-nina__statusbar { min-height: 42px; }
.pns-nina__messages { padding: 20px 18px 12px; }
.pns-nina__message--user .pns-nina__bubble::before {
	content: "Tú";
	display: block;
	margin-bottom: 3px;
	font-size: 9px;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
	opacity: .72;
}
.pns-nina__message--assistant .pns-nina__bubble::before {
	content: "NINA";
	display: block;
	margin-bottom: 3px;
	color: var(--nina-blue);
	font-size: 9px;
	font-weight: 850;
	letter-spacing: .08em;
	text-transform: uppercase;
}
.pns-nina__voice { padding: 16px 18px 18px; background: #fff; }
.pns-nina__mic { min-height: 54px; border-radius: 16px; background: linear-gradient(135deg,#141e9c,#12bfa0); box-shadow: 0 12px 30px rgba(20,30,156,.22); }
.pns-nina__mic:hover { filter: brightness(1.07); }
.pns-nina__privacy { margin: 0; padding: 11px 18px 15px; border-top: 1px solid var(--nina-line); background: #fbfcfe; }
.pns-nina.pns-nina--embedded .pns-nina__panel { height: 620px; min-height: 620px; }
.pns-nina.pns-nina--embedded .pns-nina__messages { min-height: 235px; }
.pns-nina[data-state="connecting"] .pns-nina__status-dot,
.pns-nina[data-state="reconnecting"] .pns-nina__status-dot { background: #f59e0b; animation: pns-nina-pulse 1.1s ease-out infinite; }
.pns-nina[data-state="listening"] .pns-nina__mic { background: #12bfa0; }
.pns-nina[data-state="speaking"] .pns-nina__mic { background: #141e9c; }

@media (max-width: 540px) {
	.pns-nina.pns-nina--embedded .pns-nina__panel { height: min(650px,calc(100vh - 150px)); min-height: 520px; }
	.pns-nina__messages { padding-inline: 14px; }
}
