* { box-sizing: border-box; }
html, body { height: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* Cabecera */
.topbar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 10px 16px;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	box-shadow: var(--shadow);
	position: relative;
	z-index: 5;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo {
	width: 112px; height: 38px; flex: none;
	display: flex; align-items: center;
}
.brand-logo { display: block; width: 100%; max-height: 38px; object-fit: contain; object-position: left center; }
.logo-dark { display: none; }
html[data-theme="dark"] .logo-light { display: none; }
html[data-theme="dark"] .logo-dark { display: block; }
html[data-brand="redhispana"] .brand .logo { width: 150px; }
html[data-brand="webchat"] .brand .logo { width: 76px; height: 42px; }
html[data-brand="webchat"] .brand-logo { max-height: 42px; }

.spacer { margin-left: auto; }
.actions { display: flex; align-items: center; gap: 8px; }
.btn {
	appearance: none;
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--text);
	border-radius: 10px;
	padding: 8px 14px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	text-decoration: none;
	transition: transform .12s ease, filter .12s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn.primary {
	background: linear-gradient(135deg, var(--accent));
	border-color: transparent;
	color: #fff;
}
.btn.icon { padding: 8px 10px; }

/* Avisos */
.notice {
	background: linear-gradient(135deg, var(--accent));
	color: #fff;
	padding: 8px 16px;
	font-size: 13.5px;
	text-align: center;
}
.notice a { color: #fff; text-decoration: underline; }

/* Chat */
.chat-wrap { flex: 1; min-height: 0; padding: 12px; }
.chat-card {
	height: 100%;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 16px;
	box-shadow: var(--shadow);
	overflow: hidden;
}
#chatframe { display: block; width: 100%; height: 100%; border: 0; }

/* Footer */
footer {
	padding: 8px 16px 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	color: var(--muted);
	font-size: 14.5px;
}
footer a { color: inherit; }
.footer-zonaly { display: inline-flex; align-items: center; }
.footer-logo { display: block; width: auto; height: 20px; }
.footer-logo.logo-dark { display: none; }
html[data-theme="dark"] .footer-logo.logo-light { display: none; }
html[data-theme="dark"] .footer-logo.logo-dark { display: block; }

/* Pantalla de acceso */
.overlay {
	position: fixed; inset: 0; z-index: 20;
	display: grid; place-items: center;
	background: rgba(10, 12, 22, .55);
	backdrop-filter: blur(6px);
	padding: 16px;
}
.card {
	width: 420px; max-width: 100%;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 18px;
	box-shadow: var(--shadow);
	padding: 24px;
}
.login-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 64px;
	margin: 0 auto 18px;
}
.login-logo .brand-logo {
	width: auto;
	max-width: 240px;
	max-height: 64px;
	object-position: center;
}
html[data-brand="webchat"] .login-logo { height: 90px; }
html[data-brand="webchat"] .login-logo .brand-logo { max-height: 90px; }
.card h1 { margin: 0 0 4px; font-size: 20px; }
.card p.hint { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input {
	width: 100%;
	padding: 11px 12px;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--text);
	font: inherit;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.card .btn { width: 100%; padding: 12px; margin-top: 6px; }

.warn {
	margin: 24px auto; max-width: 520px; text-align: center;
	background: var(--surface); border: 1px solid var(--border);
	border-radius: 14px; padding: 20px;
}

@media (max-width: 720px) {
	.brand .sub, .chans { display: none; }
	.chat-wrap { padding: 0; }
	.chat-card { border-radius: 0; border-left: 0; border-right: 0; }
	footer { display: none; }
}
