/* OM WebChat */
.omw-root {
	--omw-color: #0f766e;
	--omw-bg: #ffffff;
	--omw-soft: #f3f5f7;
	--omw-text: #1f2933;
	--omw-muted: #6b7785;
	--omw-border: #e2e6ea;
	--omw-radius: 16px;
	font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	color: var(--omw-text);
	box-sizing: border-box;
}
.omw-root *, .omw-root *::before, .omw-root *::after { box-sizing: inherit; }
.omw-root [hidden] { display: none !important; }

/* Protección frente a estilos de botones del tema */
.omw-root button {
	margin: 0; text-transform: none; letter-spacing: normal; text-indent: 0; text-shadow: none;
	min-width: 0; min-height: 0; box-shadow: none; font-family: inherit; line-height: 1;
}
.omw-root button svg { display: block; max-width: none !important; pointer-events: none; flex: none; }
.omw-tool svg { width: 22px !important; height: 22px !important; }
.omw-icon-btn svg, .omw-send svg { width: 18px !important; height: 18px !important; }
.omw-emoji button, .omw-msg, .omw-input {
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

/* Botón flotante */
.omw-floating { position: fixed; bottom: var(--omw-bottom, 20px); right: var(--omw-side, 20px); z-index: 2147483000 !important; }
.omw-floating.omw-left { right: auto; left: var(--omw-side, 20px); }
.omw-launcher {
	position: relative; display: inline-flex !important; align-items: center; gap: 12px;
	height: 76px !important; min-width: 76px !important; padding: 0 11px !important; border: 0 !important; border-radius: 38px !important;
	background: var(--omw-color) !important; color: #fff !important; cursor: pointer;
	box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: transform .15s ease, box-shadow .15s ease;
}
.omw-launcher.omw-has-label { padding-right: 24px !important; }
.omw-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,.28); }
.omw-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--omw-color); }
/* Globo de diálogo blanco con el logo */
.omw-bubble-icon {
	position: relative; flex: none; display: grid; place-items: center;
	width: 62px; height: 50px; margin-top: -6px; border-radius: 16px; background: #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.omw-bubble-icon::after {
	content: ""; position: absolute; left: 12px; bottom: -8px; width: 0; height: 0;
	border-left: 0 solid transparent; border-right: 14px solid transparent; border-top: 10px solid #fff;
}
.omw-bubble-icon img {
	display: block !important; width: auto !important; max-width: 50px !important; height: auto !important; max-height: 38px !important;
	margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
}
.omw-launcher-label {
	font: 800 17px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: .06em; white-space: nowrap; color: #fff;
}
.omw-dot { position: absolute; left: 60px; top: 8px; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--omw-color); background: #9aa5b1; }
.omw-dot.is-on { background: #22c55e; }
.omw-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }

/* Ventana */
.omw-box {
	display: flex; flex-direction: column; background: var(--omw-bg);
	border-radius: var(--omw-radius); overflow: hidden;
	box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.omw-floating .omw-box { position: absolute; bottom: 90px; right: 0; width: 370px; height: 560px; max-height: calc(100vh - 156px - var(--omw-bottom, 20px)); }
.omw-floating.omw-left .omw-box { right: auto; left: 0; }
.omw-inline .omw-box { width: 100%; max-width: 520px; height: 560px; box-shadow: 0 2px 12px rgba(0,0,0,.12); }

.omw-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; background: var(--omw-color); color: #fff; }
.omw-title { font-weight: 700; font-size: 16px; }
.omw-sub { font-size: 12px; opacity: .85; }
.omw-actions { display: flex; gap: 4px; }
.omw-icon-btn { width: 32px; height: 32px; padding: 0 !important; border: 0; border-radius: 8px; background: rgba(255,255,255,.15) !important; color: #fff !important; cursor: pointer; display: grid; place-items: center; }
.omw-icon-btn:hover { background: rgba(255,255,255,.3); }
.omw-box:not(.omw-has-chat) .omw-end { display: none; }

.omw-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Formularios */
.omw-form { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.omw-intro { margin: 0 0 4px; color: var(--omw-text); }
.omw-body > .omw-intro { padding: 16px; }
.omw-user { margin: 0; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.05); font-size: 12px; color: var(--omw-muted); overflow-wrap: anywhere; }
.omw-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--omw-muted); }
.omw-field input, .omw-field textarea {
	font: inherit; color: var(--omw-text); padding: 10px 12px; border: 1px solid var(--omw-border);
	border-radius: 10px; background: #fff; width: 100%;
}
.omw-field input:focus, .omw-field textarea:focus, .omw-input:focus { outline: 2px solid var(--omw-color); outline-offset: -1px; border-color: transparent; }
.omw-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--omw-muted); }
.omw-check a { color: var(--omw-color); }
.omw-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.omw-error { color: #b91c1c; font-size: 13px; min-height: 1em; }
.omw-primary { border: 0; border-radius: 10px; padding: 11px 16px; background: var(--omw-color); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.omw-primary:disabled { opacity: .6; cursor: wait; }

/* Chat */
.omw-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.omw-chat.omw-drop::after { content: "Suelta el fichero para enviarlo"; position: absolute; inset: 8px; border: 2px dashed var(--omw-color); border-radius: 12px; background: rgba(255,255,255,.9); display: grid; place-items: center; font-weight: 600; color: var(--omw-color); }
.omw-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; background: var(--omw-soft); display: flex; flex-direction: column; gap: 8px; }
.omw-msg { max-width: 85%; display: flex; flex-direction: column; }
.omw-mine { align-self: flex-end; align-items: flex-end; }
.omw-theirs { align-self: flex-start; }
.omw-meta { font-size: 11px; color: var(--omw-muted); margin: 0 6px 2px; }
.omw-bubble { padding: 8px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--omw-border); word-wrap: break-word; overflow-wrap: anywhere; }
.omw-mine .omw-bubble { background: var(--omw-color); color: #fff; border-color: transparent; border-bottom-right-radius: 4px; }
.omw-theirs .omw-bubble { border-bottom-left-radius: 4px; }
.omw-bubble a { color: inherit; text-decoration: underline; }
.omw-system { align-self: center; max-width: 92%; text-align: center; font-size: 12px; color: var(--omw-muted); background: #fff; padding: 6px 10px; border-radius: 10px; }
.omw-system a { color: var(--omw-color); }
.omw-img { display: block; max-width: 220px; max-height: 200px; border-radius: 10px; margin-bottom: 4px; }
.omw-file { display: inline-block; margin-bottom: 2px; font-weight: 600; }

.omw-composer { display: flex; align-items: flex-end; gap: 4px; padding: 8px; border-top: 1px solid var(--omw-border); background: #fff; }
.omw-tool { width: 36px; height: 36px; flex: none; padding: 0 !important; border: 0; border-radius: 8px; background: transparent !important; color: var(--omw-muted) !important; cursor: pointer; display: grid; place-items: center; }
.omw-tool:hover, .omw-tool:focus-visible { background: var(--omw-soft) !important; color: var(--omw-color) !important; }
.omw-input { flex: 1; min-width: 0; resize: none; font: inherit; padding: 8px 10px; border: 1px solid var(--omw-border); border-radius: 10px; max-height: 120px; }
.omw-send { width: 38px; height: 38px; flex: none; padding: 0 !important; border: 0; border-radius: 50%; background: var(--omw-color) !important; color: #fff !important; cursor: pointer; display: grid; place-items: center; }

.omw-emoji { border-top: 1px solid var(--omw-border); background: #fff; }
.omw-emoji-tabs { display: flex; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--omw-border); }
.omw-emoji-tabs button, .omw-emoji-grid button { border: 0; background: transparent !important; color: inherit !important; cursor: pointer; border-radius: 6px; font-size: 20px; line-height: 1.2; padding: 5px !important; }
.omw-emoji-tabs button:hover, .omw-emoji-grid button:hover { background: var(--omw-soft); }
.omw-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); max-height: 170px; overflow-y: auto; padding: 4px; }
.omw-restart { padding: 10px; text-align: center; border-top: 1px solid var(--omw-border); }

/* Panel del operador */
.omw-panel-body { margin: 0; background: #e9edf1; }
.omw-panel .omw-box { width: 100%; max-width: 760px; height: 100vh; height: 100dvh; margin: 0 auto; border-radius: 0; }
.omw-opbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 8px 14px; font-size: 13px; border-bottom: 1px solid var(--omw-border); background: #fff; }
.omw-opbar a { color: var(--omw-color); }
.omw-opbar select { font: inherit; padding: 2px 6px; }

@media (max-width: 480px) {
	.omw-floating { bottom: var(--omw-bottom, 14px); right: min(var(--omw-side, 14px), 14px); }
	.omw-floating.omw-left { left: min(var(--omw-side, 14px), 14px); }
	.omw-floating .omw-box { position: fixed; inset: 0; width: auto; height: auto; max-height: none; border-radius: 0; }
	.omw-emoji-grid { grid-template-columns: repeat(7, 1fr); }
	.omw-launcher { height: 64px !important; min-width: 64px !important; gap: 10px; padding: 0 9px !important; }
	.omw-launcher.omw-has-label { padding-right: 18px !important; }
	.omw-bubble-icon { width: 54px; height: 44px; }
	.omw-bubble-icon img { max-width: 44px !important; max-height: 33px !important; }
	.omw-launcher-label { font-size: 15px; }
	.omw-dot { left: 52px; top: 6px; }
}
