/* Widget de atendimento — site institucional GRE */
.grc-chat-fab {
	position: fixed;
	right: 0.8rem;
	bottom: 1.25rem;
	margin-bottom: 48px;
	z-index: 9998;
	width: 56px;
	height: 56px;
	border: none;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--teal, #14b8a6), #0d9488);
	color: #fff;
	box-shadow: 0 8px 28px rgba(20, 184, 166, 0.45);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s, box-shadow 0.2s;
}
.grc-chat-fab:hover {
	transform: scale(1.05);
	box-shadow: 0 12px 32px rgba(20, 184, 166, 0.5);
}
.grc-chat-fab svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2; }

.grc-chat-panel {
	position: fixed;
	right: 1.25rem;
	bottom: 5.5rem;
	z-index: 9999;
	width: min(380px, calc(100vw - 2rem));
	max-height: min(520px, calc(100vh - 7rem));
	background: #fff;
	border-radius: 1rem;
	box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
	border: 1px solid var(--gray-200, #e2e8f0);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(0.98);
	transition: opacity 0.22s, transform 0.22s, visibility 0.22s;
}
.grc-chat-panel.is-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.grc-chat-head {
	background: linear-gradient(135deg, #0f766e, #14b8a6);
	color: #fff;
	padding: 0.85rem 1rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}
.grc-chat-head h3 {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 700;
}
.grc-chat-head p {
	margin: 0.15rem 0 0;
	font-size: 0.72rem;
	opacity: 0.9;
}
.grc-chat-close {
	background: rgba(255,255,255,0.15);
	border: none;
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 1.1rem;
	line-height: 1;
}

.grc-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	min-height: 200px;
	background: var(--gray-50, #f8fafc);
}
.grc-chat-body:has(#grcChatTalkView:not([hidden])) {
	overflow: hidden;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.grc-chat-form label {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--gray-700, #334155);
	margin-bottom: 0.25rem;
}
.grc-chat-form input,
.grc-chat-form textarea {
	width: 100%;
	border: 1px solid var(--gray-200, #e2e8f0);
	border-radius: 0.5rem;
	padding: 0.5rem 0.65rem;
	font-size: 0.85rem;
	margin-bottom: 0.65rem;
	font-family: inherit;
}
.grc-chat-form textarea { resize: vertical; min-height: 72px; }

.grc-chat-msgs { display: flex; flex-direction: column; gap: 0.5rem; }
#grcChatTalkView {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	height: 100%;
	padding: 0 1rem 0.5rem;
}
#grcChatTalkView[hidden] {
	display: none !important;
}
#grcChatTalkView .grc-chat-msgs {
	flex: 1;
	overflow-y: auto;
	min-height: 0;
	max-height: 280px;
	padding: 0.5rem 0 0.25rem;
	-webkit-overflow-scrolling: touch;
}
.grc-chat-msgs-loader {
	text-align: center;
	font-size: 0.68rem;
	color: var(--gray-500, #64748b);
	padding: 0.25rem 0 0.5rem;
}
.grc-chat-msgs-loader.is-loading {
	color: var(--teal, #14b8a6);
}
.grc-chat-msg {
	max-width: 88%;
	padding: 0.55rem 0.75rem;
	border-radius: 0.75rem;
	font-size: 0.82rem;
	line-height: 1.45;
	word-break: break-word;
}
.grc-chat-msg.visitante { background: #e0f2fe; align-self: flex-start; }
.grc-chat-msg.atendente { background: #fff; border: 1px solid var(--gray-200, #e2e8f0); align-self: flex-end; }
.grc-chat-msg time { display: block; font-size: 0.62rem; opacity: 0.65; margin-top: 0.25rem; }

.grc-chat-foot {
	border-top: 1px solid var(--gray-200, #e2e8f0);
	padding: 0.65rem;
	background: #fff;
	display: flex;
	gap: 0.5rem;
}
.grc-chat-foot input {
	flex: 1;
	border: 1px solid var(--gray-200, #e2e8f0);
	border-radius: 0.5rem;
	padding: 0.5rem 0.65rem;
	font-size: 0.85rem;
}
.grc-chat-foot button {
	border: none;
	background: var(--teal, #14b8a6);
	color: #fff;
	border-radius: 0.5rem;
	padding: 0 0.85rem;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.8rem;
}
.grc-chat-foot button:disabled { opacity: 0.6; cursor: not-allowed; }

.grc-chat-btn-spinner {
	display: inline-block;
	width: 0.85rem;
	height: 0.85rem;
	margin-right: 0.35rem;
	vertical-align: -0.15em;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: grc-chat-spin 0.65s linear infinite;
}
@keyframes grc-chat-spin {
	to { transform: rotate(360deg); }
}

.grc-chat-wa-hint {
	font-size: 0.68rem;
	color: var(--gray-500, #64748b);
	padding: 0 0.65rem 0.5rem;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}
.grc-chat-wa-hint svg { width: 14px; height: 14px; flex-shrink: 0; }

.grc-chat-form input.grc-chat-invalid,
.grc-chat-form textarea.grc-chat-invalid {
	border-color: #ef4444;
	box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
}
.grc-chat-error {
	display: block;
	font-size: 0.68rem;
	color: #dc2626;
	margin: -0.45rem 0 0.5rem;
}

.grc-chat-start-btn {
	width: 100%;
	border: none;
	background: var(--teal, #14b8a6);
	color: #fff;
	border-radius: 0.5rem;
	padding: 0.65rem;
	font-weight: 600;
	cursor: pointer;
	font-size: 0.88rem;
}
.grc-chat-start-btn:disabled { opacity: 0.65; cursor: not-allowed; }

.grc-chat-closed {
	text-align: center;
	color: var(--gray-500, #64748b);
	font-size: 0.82rem;
	padding: 1.5rem 1rem;
}

.grc-chat-talk-bar {
	flex-shrink: 0;
	position: sticky;
	top: 0;
	z-index: 3;
	display: flex;
	justify-content: flex-end;
	padding: 0.65rem 0 0.5rem;
	background: var(--gray-50, #f8fafc);
	border-bottom: 1px solid var(--gray-200, #e2e8f0);
	box-shadow: 0 6px 16px -8px rgba(15, 23, 42, 0.12);
}
.grc-chat-finish-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	border: 1px solid rgba(220, 38, 38, 0.28);
	background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
	color: #b91c1c;
	border-radius: 999px;
	padding: 0.35rem 0.75rem;
	font-size: 0.72rem;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}
.grc-chat-finish-btn svg {
	width: 15px;
	height: 15px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
}
.grc-chat-finish-btn:hover:not(:disabled) {
	background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
	box-shadow: 0 4px 12px rgba(220, 38, 38, 0.12);
	transform: translateY(-1px);
}
.grc-chat-finish-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.grc-chat-avaliacao,
.grc-chat-obrigado {
	padding: 0.5rem 0;
}
.grc-chat-avaliacao-inner,
.grc-chat-obrigado-inner {
	text-align: center;
	padding: 0.75rem 0.25rem 1rem;
}
.grc-chat-avaliacao-icon {
	width: 44px;
	height: 44px;
	margin: 0 auto 0.65rem;
	border-radius: 50%;
	background: linear-gradient(135deg, #fef3c7, #fde68a);
	color: #d97706;
	font-size: 1.35rem;
	line-height: 44px;
}
.grc-chat-avaliacao h4,
.grc-chat-obrigado h4 {
	margin: 0 0 0.35rem;
	font-size: 0.95rem;
	color: var(--gray-800, #1e293b);
}
.grc-chat-avaliacao p,
.grc-chat-obrigado p {
	margin: 0 0 0.85rem;
	font-size: 0.78rem;
	color: var(--gray-500, #64748b);
	line-height: 1.45;
}
.grc-chat-stars {
	display: flex;
	justify-content: center;
	gap: 0.25rem;
	margin-bottom: 0.75rem;
}
.grc-chat-stars button {
	border: none;
	background: transparent;
	font-size: 1.65rem;
	line-height: 1;
	color: #cbd5e1;
	cursor: pointer;
	padding: 0.15rem;
	transition: color 0.15s, transform 0.15s;
}
.grc-chat-stars button:hover,
.grc-chat-stars button.is-on {
	color: #f59e0b;
	transform: scale(1.08);
}
.grc-chat-avaliacao textarea {
	width: 100%;
	border: 1px solid var(--gray-200, #e2e8f0);
	border-radius: 0.5rem;
	padding: 0.55rem 0.65rem;
	font-size: 0.8rem;
	font-family: inherit;
	resize: vertical;
	min-height: 64px;
	margin-bottom: 0.65rem;
}
.grc-chat-avaliar-btn {
	width: 100%;
	border: none;
	background: linear-gradient(135deg, var(--teal, #14b8a6), #0d9488);
	color: #fff;
	border-radius: 0.5rem;
	padding: 0.6rem;
	font-weight: 600;
	font-size: 0.85rem;
	cursor: pointer;
}
.grc-chat-avaliar-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.grc-chat-avaliar-skip {
	display: block;
	width: 100%;
	margin-top: 0.5rem;
	border: none;
	background: transparent;
	color: var(--gray-500, #64748b);
	font-size: 0.72rem;
	cursor: pointer;
	text-decoration: underline;
	font-family: inherit;
}
.grc-chat-obrigado-check {
	width: 48px;
	height: 48px;
	margin: 0 auto 0.65rem;
	border-radius: 50%;
	background: linear-gradient(135deg, #d1fae5, #a7f3d0);
	color: #059669;
	font-size: 1.4rem;
	font-weight: 700;
	line-height: 48px;
}

@media (max-width: 480px) {
	.grc-chat-panel {
		right: 0.75rem;
		left: 0.75rem;
		width: auto;
		bottom: 5rem;
	}
}

/* Diálogos do chat — substituem alert/confirm nativos */
.grc-chat-dialog-root {
	position: fixed;
	inset: 0;
	z-index: 10050;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	pointer-events: none;
}
.grc-chat-dialog-root.is-open {
	pointer-events: auto;
}
.grc-chat-dialog-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.2s ease;
}
.grc-chat-dialog-root.is-open .grc-chat-dialog-backdrop {
	opacity: 1;
}
.grc-chat-dialog {
	position: relative;
	width: min(360px, calc(100vw - 2.5rem));
	background: #fff;
	border-radius: 1rem;
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
	border: 1px solid var(--gray-200, #e2e8f0);
	padding: 1.35rem 1.25rem 1.15rem;
	text-align: center;
	transform: translateY(10px) scale(0.97);
	opacity: 0;
	transition: transform 0.22s ease, opacity 0.22s ease;
}
.grc-chat-dialog-root.is-open .grc-chat-dialog {
	transform: translateY(0) scale(1);
	opacity: 1;
}
.grc-chat-dialog-icon {
	width: 52px;
	height: 52px;
	margin: 0 auto 0.85rem;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}
.grc-chat-dialog-icon svg {
	width: 26px;
	height: 26px;
	fill: currentColor;
}
.grc-chat-dialog-icon--alert {
	background: linear-gradient(135deg, #e0f2fe, #bae6fd);
	color: #0369a1;
}
.grc-chat-dialog-icon--confirm {
	background: linear-gradient(135deg, #fef2f2, #fee2e2);
	color: #b91c1c;
}
.grc-chat-dialog-title {
	margin: 0 0 0.45rem;
	font-size: 1rem;
	font-weight: 700;
	color: var(--gray-800, #1e293b);
	line-height: 1.35;
}
.grc-chat-dialog-msg {
	margin: 0 0 1.15rem;
	font-size: 0.84rem;
	line-height: 1.55;
	color: var(--gray-600, #475569);
}
.grc-chat-dialog-actions {
	display: flex;
	gap: 0.55rem;
	justify-content: center;
	flex-wrap: wrap;
}
.grc-chat-dialog-btn {
	border: none;
	border-radius: 0.55rem;
	padding: 0.55rem 1rem;
	font-size: 0.82rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	min-width: 108px;
	transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.grc-chat-dialog-btn:hover {
	transform: translateY(-1px);
}
.grc-chat-dialog-btn-primary {
	background: linear-gradient(135deg, var(--teal, #14b8a6), #0d9488);
	color: #fff;
	box-shadow: 0 4px 14px rgba(20, 184, 166, 0.28);
}
.grc-chat-dialog-btn-danger {
	background: linear-gradient(135deg, #ef4444, #dc2626);
	color: #fff;
	box-shadow: 0 4px 14px rgba(220, 38, 38, 0.22);
}
.grc-chat-dialog-btn-muted {
	background: #f1f5f9;
	color: var(--gray-700, #334155);
	border: 1px solid var(--gray-200, #e2e8f0);
}
