:root {
	--rmai-navy: #14213D;
	--rmai-navy-2: #1c2d4f;
	--rmai-red: #C0392B;
	--rmai-steel: #8B98A6;
	--rmai-paper: #F6F4EF;
	--rmai-line: #dfe3ea;
}

#rmai-widget-root {
	max-width: 640px;
	margin: 30px auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rmai-window {
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 10px 34px rgba(20,33,61,0.14);
	border: 1px solid var(--rmai-line);
}

.rmai-header {
	background: linear-gradient(135deg, var(--rmai-navy-2), var(--rmai-navy));
	color: #fff;
	padding: 18px 22px;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}

.rmai-header-title {
	font-size: 17px;
	font-weight: 700;
	margin-bottom: 2px;
}

.rmai-header-sub {
	font-size: 13px;
	opacity: 0.8;
}

.rmai-new-btn {
	background: rgba(255,255,255,0.12);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.3);
	border-radius: 8px;
	padding: 7px 12px;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
}
.rmai-new-btn:hover { background: rgba(255,255,255,0.22); }

.rmai-disclaimer {
	background: #FCF3EE;
	border-bottom: 1px solid #F0D9CC;
	color: #7A3B1E;
	font-size: 12.5px;
	line-height: 1.5;
	padding: 10px 22px;
}

.rmai-messages {
	min-height: 120px;
	max-height: 420px;
	overflow-y: auto;
	padding: 18px 20px;
	background: var(--rmai-paper);
}

.rmai-msg {
	margin-bottom: 12px;
	padding: 11px 15px;
	border-radius: 10px;
	max-width: 85%;
	line-height: 1.6;
	font-size: 14.5px;
	word-break: break-word;
	white-space: pre-wrap;
}

.rmai-msg.assistant {
	background: #fff;
	color: #1a1a1a;
	margin-right: auto;
	border-left: 3px solid var(--rmai-navy);
	box-shadow: 0 1px 3px rgba(20,33,61,0.06);
}

.rmai-msg.user {
	background: var(--rmai-navy);
	color: #fff;
	margin-left: auto;
}

.rmai-msg a {
	color: #1a73e8;
	text-decoration: underline;
}

.rmai-msg.user a {
	color: #cfe0ff;
}

.rmai-license-alert {
	background: #FCEBEA;
	border: 1px solid #F3C6C2;
	border-left: 3px solid var(--rmai-red);
	color: #7A241A;
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 13px;
	line-height: 1.5;
	margin-bottom: 12px;
	max-width: 90%;
}

.rmai-video-wrap {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-bottom: 14px;
}

.rmai-video-frame-wrap {
	background: #fff;
	border: 1px solid var(--rmai-line);
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(20,33,61,0.06);
}

.rmai-video-caption {
	padding: 8px 12px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--rmai-navy);
	border-bottom: 1px solid var(--rmai-line);
}

.rmai-video-frame {
	width: 100%;
	aspect-ratio: 16 / 9;
	display: block;
}

.rmai-typing { display: flex; gap: 4px; padding: 11px 15px; }
.rmai-typing span {
	width: 6px; height: 6px; border-radius: 50%; background: var(--rmai-steel);
	animation: rmai-bounce 1.2s infinite ease-in-out;
}
.rmai-typing span:nth-child(2) { animation-delay: 0.15s; }
.rmai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes rmai-bounce { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.rmai-preview-row {
	display: none;
	flex-wrap: wrap;
	gap: 8px;
	padding: 10px 10px 0;
	background: #fff;
}

.rmai-preview-thumb {
	position: relative;
	width: 56px;
	height: 56px;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid var(--rmai-line);
	flex-shrink: 0;
}

.rmai-preview-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rmai-preview-remove {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: rgba(20,33,61,0.85);
	color: #fff;
	border: none;
	font-size: 12px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.rmai-attach-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 10px 0;
	background: #fff;
}

.rmai-attach-btn {
	background: #fff;
	border: 1px solid var(--rmai-line);
	border-radius: 8px;
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--rmai-navy);
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
}
.rmai-attach-btn:hover { border-color: var(--rmai-navy); }
.rmai-attach-btn:disabled { opacity: 0.5; cursor: default; }

.rmai-attach-hint {
	font-size: 12px;
	color: var(--rmai-steel);
	line-height: 1.3;
}

.rmai-input-row {
	display: flex;
	align-items: flex-end;
	border-top: 1px solid var(--rmai-line);
	background: #fff;
	padding: 10px;
	gap: 8px;
}

.rmai-input-row textarea {
	flex: 1;
	border: 1px solid var(--rmai-line);
	border-radius: 8px;
	padding: 11px 14px;
	font-size: 14px;
	font-family: inherit;
	outline: none;
	resize: none;
	overflow-y: auto;
	max-height: 140px;
	line-height: 1.4;
}
.rmai-input-row textarea:focus { border-color: var(--rmai-navy); }

.rmai-input-row button#rmai-send {
	background: var(--rmai-navy);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 11px 22px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	flex-shrink: 0;
}
.rmai-input-row button#rmai-send:hover { background: var(--rmai-navy-2); }
.rmai-input-row button#rmai-send:disabled { opacity: 0.6; cursor: default; }