/* ChatLolo 0.8.0 — tema Día por defecto en las variables; el tema Noche va al final (.t-noche) */
:root {
	--brand: #7c3aed;
	--brand-2: #6d28d9;
	--brand-soft: #ede9fe;
	--bg: #f5f3ff;
	--panel: #ffffff;
	--line: #e7e3f3;
	--text: #1e1b2e;
	--muted: #6b6880;
	--mine: #7c3aed;
	--mine-text: #ffffff;
	--theirs: #ffffff;
	--chat-bg: #efeaf9;
	--danger: #dc2626;
	--ok: #22c55e;
	--radius: 18px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 16px; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
a { color: var(--brand); }

/* ---------- Botones y formularios ---------- */
.cl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 650; padding: 12px 22px; min-height: 46px; transition: background .15s; }
.cl-btn:hover { background: var(--brand-2); }
.cl-btn:disabled { opacity: .5; cursor: default; }
.cl-btn.is-danger { background: var(--danger); }
.cl-btn-sm { min-height: 34px; padding: 6px 14px; font-size: .9em; }
.cl-btn-ghost { background: var(--brand-soft); color: var(--brand); }
.cl-btn-ghost:hover { background: var(--brand-soft); filter: brightness(.95); }
.cl-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; color: inherit; flex: none; }
.cl-icon:hover { background: rgba(127, 127, 127, .14); }
.cl-form { display: flex; flex-direction: column; gap: 14px; }
.cl-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95em; }
.cl-form small { font-weight: 400; color: var(--muted); }
.cl-form input:not([type=checkbox]), .cl-form select, .cl-form textarea, .cl-input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel); font-weight: 400; outline: none; }
.cl-form input:focus, .cl-form select:focus, .cl-form textarea:focus, .cl-input:focus { border-color: var(--brand); }
.cl-form .cl-check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; line-height: 1.4; }
.cl-check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.cl-hp { position: absolute !important; left: -9999px; }
.cl-link { text-align: center; font-size: .92em; }
.cl-hint { color: var(--muted); font-size: .92em; margin: 6px 0; }

/* ---------- Entrada ---------- */
.cl-auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(800px 500px at 80% -10%, rgba(124, 58, 237, .18), transparent 70%), var(--bg); }
.cl-auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(46, 16, 101, .12); }
.cl-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.cl-brand img { border-radius: 16px; }
.cl-brand h1 { margin: 0; font-size: 2em; letter-spacing: -.02em; }
.cl-tagline { text-align: center; color: var(--muted); margin: 6px 0 20px; }
.cl-alert { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; }
.cl-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--brand-soft); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.cl-tabs button { border: 0; background: transparent; border-radius: 999px; padding: 10px; font-weight: 650; color: var(--muted); }
.cl-tabs button[aria-selected="true"] { background: var(--panel); color: var(--brand); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }

/* ---------- App ---------- */
.is-app { overflow: hidden; }
.cl-app { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr; height: 100dvh; }
.cl-side, .cl-main { min-height: 0; display: flex; flex-direction: column; }
.cl-side { background: var(--panel); }
.cl-main { background: var(--chat-bg); }
.cl-app[data-view="list"] .cl-main { display: none; }
.cl-app[data-view="chat"] .cl-side { display: none; }
@media (min-width: 760px) {
	.cl-app { grid-template-columns: minmax(300px, 380px) 1fr; }
	.cl-app[data-view] .cl-side, .cl-app[data-view] .cl-main { display: flex; }
	.cl-side { border-right: 1px solid var(--line); }
	.cl-back { display: none !important; }
}

.cl-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 62px; background: var(--brand); color: #fff; flex: none; }
.cl-bar h1 { flex: 1; margin: 0; font-size: 1.25em; letter-spacing: -.01em; }
.cl-me { border: 0; background: none; padding: 0; border-radius: 50%; }
.cl-me .cl-avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.cl-search { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cl-search input { width: 100%; border: 0; border-radius: 999px; padding: 10px 16px; background: var(--bg); outline: none; }
.cl-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.cl-list-empty { padding: 32px 24px; color: var(--muted); text-align: center; }
.cl-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.cl-item:hover { background: var(--bg); }
.cl-item.is-active { background: var(--brand-soft); }
.cl-item-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cl-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-item-last { color: var(--muted); font-size: .9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-item.has-unread .cl-item-last { color: var(--text); font-weight: 600; }
.cl-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: .78em; color: var(--muted); flex: none; }
.cl-item.has-unread time { color: var(--brand); font-weight: 700; }
.cl-badge { background: var(--brand); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; font-weight: 700; font-size: .95em; }
.cl-avatar { width: 46px; height: 46px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: .95em; flex: none; letter-spacing: .02em; }
.cl-avatar svg { width: 26px; height: 26px; }
.cl-me .cl-avatar, .cl-chat-title .cl-avatar { width: 40px; height: 40px; }
.cl-install { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--brand-soft); font-size: .92em; font-weight: 600; }

.cl-empty { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); padding: 24px; }
.cl-empty img { border-radius: 24px; opacity: .9; }
.cl-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cl-chat-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: #fff; text-align: left; padding: 2px; }
.cl-chat-title-txt { display: flex; flex-direction: column; min-width: 0; }
.cl-chat-title-txt strong, .cl-chat-title-txt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-chat-title-txt small { opacity: .85; font-size: .8em; }
.cl-messages { flex: 1; overflow-y: auto; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.cl-loading { margin: auto; color: var(--muted); }
.cl-older { align-self: center; border: 0; background: var(--panel); color: var(--brand); border-radius: 999px; padding: 6px 14px; font-size: .85em; margin-bottom: 8px; }
.cl-day { align-self: center; background: var(--panel); color: var(--muted); font-size: .78em; font-weight: 600; border-radius: 999px; padding: 4px 12px; margin: 12px 0 6px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.cl-system { align-self: center; max-width: 85%; text-align: center; background: var(--brand-soft); color: var(--muted); font-size: .82em; border-radius: 12px; padding: 5px 12px; margin: 6px 0; }
.cl-msg { display: flex; margin-top: 6px; }
.cl-msg.is-cont { margin-top: 2px; }
.cl-msg.is-mine { justify-content: flex-end; }
.cl-bubble { max-width: min(78%, 560px); padding: 7px 10px 5px 12px; border-radius: var(--radius); background: var(--theirs); box-shadow: 0 1px 1.5px rgba(0, 0, 0, .08); line-height: 1.4; overflow-wrap: anywhere; user-select: text; -webkit-touch-callout: none; }
.is-theirs .cl-bubble { border-top-left-radius: 6px; }
.is-mine .cl-bubble { background: var(--mine); color: var(--mine-text); border-top-right-radius: 6px; }
.is-cont.is-theirs .cl-bubble { border-top-left-radius: var(--radius); }
.is-cont.is-mine .cl-bubble { border-top-right-radius: var(--radius); }
.cl-bubble.is-deleted { font-style: italic; opacity: .75; }
.is-mine .cl-text a { color: #fff; }
.cl-who { display: block; font-size: .8em; font-weight: 700; margin-bottom: 1px; }
.cl-meta { display: flex; justify-content: flex-end; gap: 4px; font-size: .7em; opacity: .75; margin-top: 2px; white-space: nowrap; }
.cl-tick.is-read { color: #67e8f9; opacity: 1; font-weight: 700; }
.cl-failed { color: #fecaca; font-weight: 700; }
.cl-typing { align-self: flex-start; font-size: .82em; color: var(--muted); font-style: italic; padding: 6px 4px; }
.cl-hint { align-self: center; }
.cl-compose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: var(--chat-bg); flex: none; }
.cl-compose textarea { flex: 1; resize: none; border: 0; border-radius: 22px; padding: 11px 16px; background: var(--panel); max-height: 160px; line-height: 1.35; outline: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.cl-send { width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.cl-send svg { width: 22px; height: 22px; fill: #fff; stroke: none; }
.cl-blocked-note { margin: 0; padding: 14px; text-align: center; color: var(--muted); background: var(--panel); font-size: .9em; padding-bottom: max(14px, env(safe-area-inset-bottom)); }

/* ---------- Ventanas ---------- */
.cl-modal { position: fixed; inset: 0; background: rgba(15, 10, 30, .5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.cl-modal-card { width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; background: var(--panel); border-radius: 22px 22px 0 0; padding: 16px 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; animation: cl-up .18s ease-out; }
@media (min-width: 760px) { .cl-modal { align-items: center; padding: 20px; } .cl-modal-card { border-radius: 22px; } }
@keyframes cl-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.cl-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cl-modal-head h2 { margin: 0; font-size: 1.2em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-sub { margin: 10px 0 2px; font-size: .9em; color: var(--muted); }
.cl-menu-item { border: 0; background: var(--bg); border-radius: 14px; padding: 14px 16px; text-align: left; font-weight: 600; }
.cl-menu-item:hover { background: var(--brand-soft); }
.cl-menu-item.is-danger { color: var(--danger); }
.cl-quote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--brand); background: var(--bg); border-radius: 8px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cl-people li { display: flex; align-items: center; gap: 10px; padding: 4px 2px; }
.cl-people li > span { flex: 1; }
.cl-people .cl-avatar { width: 38px; height: 38px; font-size: .85em; }
.cl-pick { max-height: 46dvh; overflow-y: auto; }
.cl-person { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; border-radius: 12px; padding: 6px; text-align: left; }
.cl-person:hover { background: var(--bg); }
.cl-person span { display: flex; flex-direction: column; }
.cl-person small { color: var(--muted); }
.cl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-chips:empty { display: none; }
.cl-chip { border: 0; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .88em; }
.cl-legal { display: flex; gap: 16px; justify-content: center; font-size: .88em; margin: 8px 0 0; }
.cl-toast { position: fixed; left: 50%; bottom: max(90px, calc(env(safe-area-inset-bottom) + 80px)); transform: translateX(-50%); background: #1e1b2e; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .92em; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: calc(100% - 32px); text-align: center; }

/* ---------- 0.3.0: fotos, audios y archivos ---------- */
.cl-attach { color: var(--muted); width: 44px; height: 46px; }
.cl-attach svg { width: 23px; height: 23px; }
.cl-mic svg { fill: none; stroke: #fff; stroke-width: 2; width: 22px; height: 22px; }
.cl-bubble.has-image, .cl-bubble.has-audio, .cl-bubble.has-file { padding: 4px 4px 4px; }
.cl-bubble.has-image .cl-text, .cl-bubble.has-audio .cl-text, .cl-bubble.has-file .cl-text, .cl-bubble.has-image .cl-meta, .cl-bubble.has-audio .cl-meta, .cl-bubble.has-file .cl-meta { padding: 0 8px; }
.cl-bubble.has-image .cl-who, .cl-bubble.has-audio .cl-who, .cl-bubble.has-file .cl-who { padding: 2px 8px 4px; }
.cl-photo { display: block; border: 0; padding: 0; background: rgba(0, 0, 0, .06); border-radius: 14px; overflow: hidden; max-width: min(300px, 70vw); cursor: zoom-in; }
.cl-photo img { display: block; width: 100%; height: auto; max-height: 420px; object-fit: cover; }
.cl-audio { padding: 4px; }
.cl-audio audio { display: block; width: min(270px, 64vw); height: 40px; }
.cl-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(127, 127, 127, .12); color: inherit !important; text-decoration: none; min-width: 200px; max-width: 300px; }
.cl-file-ext { width: 42px; height: 42px; border-radius: 10px; background: #fff; color: var(--brand); display: grid; place-items: center; font-size: .72em; font-weight: 800; flex: none; }
.cl-file-info { display: flex; flex-direction: column; min-width: 0; }
.cl-file-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92em; }
.cl-file-info small { opacity: .8; font-size: .78em; }
.cl-uploading { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px; min-width: 200px; }
.cl-uploading img { max-width: 240px; max-height: 240px; border-radius: 10px; opacity: .6; object-fit: cover; }
.cl-progress { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.cl-progress i { display: block; height: 100%; background: #fff; transition: width .2s; }
.is-theirs .cl-progress i { background: var(--brand); }
.cl-uploading small { font-size: .78em; opacity: .85; }
.cl-rec { display: flex; align-items: center; gap: 10px; padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: var(--chat-bg); flex: none; }
.cl-rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: cl-blink 1s infinite; }
.cl-rec #cl-rec-time { font-variant-numeric: tabular-nums; font-weight: 700; }
.cl-rec-label { flex: 1; color: var(--muted); }
@keyframes cl-blink { 50% { opacity: .25; } }
.cl-preview img { display: block; width: 100%; max-height: 52dvh; object-fit: contain; border-radius: 12px; background: var(--bg); }
.cl-preview.is-multi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cl-preview.is-multi img { aspect-ratio: 1; object-fit: cover; max-height: none; }
.cl-lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.cl-lightbox img { max-width: 100%; max-height: calc(100dvh - 140px); object-fit: contain; border-radius: 6px; }
.cl-lightbox p { color: #fff; margin: 0; text-align: center; max-width: 640px; }
.cl-lightbox-bar { display: flex; gap: 10px; }
.cl-audio-dur { display: block; font-size: .75em; opacity: .8; padding: 2px 6px 0; }
.cl-push-ask { background: #fef3c7; }
.cl-push-ask span { flex: 1; }
.cl-push-ask .cl-icon { width: 34px; height: 34px; }
.cl-avatar.is-bot { background: linear-gradient(135deg, #dbeafe, #c7d2fe) !important; overflow: hidden; }
.cl-avatar.is-bot img { width: 100%; height: 100%; display: block; }
.cl-rems li { border-bottom: 1px solid var(--line); padding: 8px 2px; }
.cl-rems li > span { font-size: .92em; }

/* ---------- 0.6.0: modo fácil (letra grande) ---------- */
.cl-bigtoggle { text-align: center; margin: -10px 0 14px; }
.cl-bigtoggle button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 14px; font-weight: 600; color: var(--brand); }
.cl-big { font-size: 21px; }
.cl-big .cl-bar { min-height: 72px; }
.cl-big .cl-bar h1 { font-size: 1.3em; }
.cl-big .cl-avatar { width: 56px; height: 56px; font-size: 1em; }
.cl-big .cl-me .cl-avatar, .cl-big .cl-chat-title .cl-avatar { width: 48px; height: 48px; }
.cl-big .cl-icon { width: 52px; height: 52px; }
.cl-big svg { width: 30px; height: 30px; }
.cl-big .cl-item { padding: 16px 14px; gap: 14px; }
.cl-big .cl-item-last { font-size: .95em; }
.cl-big .cl-item-right { font-size: .85em; }
.cl-big .cl-bubble { max-width: 88%; padding: 10px 14px 8px; line-height: 1.45; }
.cl-big .cl-meta { font-size: .8em; opacity: .9; }
.cl-big .cl-compose textarea { padding: 14px 18px; border: 2px solid var(--line); }
.cl-big .cl-send { width: 58px; height: 58px; }
.cl-big .cl-attach { width: 54px; height: 58px; }
.cl-big .cl-btn { min-height: 56px; font-size: 1em; }
.cl-big .cl-menu-item { padding: 18px; }
.cl-big .cl-form input:not([type=checkbox]) { padding: 15px 16px; }
.cl-big .cl-check input { width: 26px; height: 26px; }
.cl-big .cl-day, .cl-big .cl-system { font-size: .85em; }
.cl-bigrow { margin: 6px 0; font-weight: 600; }
.cl-donate { text-decoration: none; display: block; background: linear-gradient(135deg, #ede9fe, #fdf2f8); color: #6d28d9 !important; }
/* Que los textos largos no ensanchen la pantalla en el móvil. */
.cl-app { grid-template-columns: minmax(0, 1fr); }
.cl-side, .cl-main, .cl-item, .cl-chat { min-width: 0; }
@media (min-width: 760px) { .cl-app { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); } }

/* Invita a los tuyos (0.7.0) */
.cl-invited { background: linear-gradient(135deg, #ede9fe, #fdf2f8); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; text-align: center; }
.cl-invite { text-align: center; }
.cl-invite .cl-modal-head { text-align: left; }
.cl-invite-lead { margin: 0 0 12px; }
.cl-qr { width: 210px; max-width: 70%; margin: 0 auto; padding: 8px; background: #fff; border-radius: 18px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 8px 24px rgba(76, 29, 149, .15); }
.cl-qr svg { display: block; width: 100%; height: auto; }
.cl-qr-hint { margin: 10px 0 12px; }
.cl-invite-link { width: 100%; text-align: center; font-size: .9em; color: var(--muted); margin: 0 0 12px; }
.cl-invite-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.cl-invite-actions .cl-btn { flex: 1 1 140px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.cl-invite-count { font-weight: 700; color: #15803d; margin: 14px 0 0; }
.cl-linkbtn { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: .85em; cursor: pointer; padding: 6px; }
.cl-invite-item { background: linear-gradient(135deg, #ede9fe, #fdf2f8); color: #6d28d9; }
.cl-empty .cl-btn { margin-top: 8px; }
.cl-big .cl-qr { width: 260px; }
.cl-qr svg, .cl-big .cl-qr svg { width: 100%; height: auto; stroke: none; }
.cl-qr svg rect { fill: #fff; }
.cl-qr svg path { fill: #1e1b2e; }

/* ---------- Tema Noche (0.8.0): fondo oscuro con azules y morados ---------- */
.t-noche {
	--brand: #8b5cf6; --brand-2: #7c3aed; --brand-soft: #231d45;
	--cyan: #38bdf8; --grad: linear-gradient(135deg, #3b82f6, #8b5cf6);
	--bg: #08080f; --panel: #11111d; --line: #23233a;
	--text: #eef0ff; --muted: #9a9cc0;
	--mine: var(--grad); --mine-text: #fff;
	--theirs: #1a1a2e; --chat-bg: #0b0b16;
	color-scheme: dark;
}
html:has(body.t-noche) { background: #08080f; }
.t-noche .cl-bar { background: linear-gradient(90deg, #1e1b4b, #312e81 45%, #4c1d95); border-bottom: 1px solid rgba(139, 92, 246, .35); }
.t-noche .cl-messages { background: radial-gradient(600px 400px at 100% 0, rgba(59, 130, 246, .10), transparent 70%), radial-gradient(500px 400px at 0 100%, rgba(139, 92, 246, .12), transparent 70%), var(--chat-bg); }
.t-noche .is-mine .cl-bubble { box-shadow: 0 4px 14px rgba(99, 102, 241, .35); }
.t-noche .is-theirs .cl-bubble { border: 1px solid #26264a; }
.t-noche .cl-item.is-active { background: linear-gradient(90deg, rgba(59, 130, 246, .18), rgba(139, 92, 246, .18)); }
.t-noche .cl-item.has-unread time { color: var(--cyan); }
.t-noche .cl-btn { background: var(--grad); box-shadow: 0 6px 18px rgba(99, 102, 241, .35); }
.t-noche .cl-btn-ghost { background: #1d1d36; color: #c4b5fd; box-shadow: none; }
.t-noche .cl-send { background: var(--grad); }
.t-noche .cl-auth { background: radial-gradient(700px 500px at 85% -10%, rgba(139, 92, 246, .35), transparent 70%), radial-gradient(600px 500px at 0% 110%, rgba(59, 130, 246, .30), transparent 70%), var(--bg); }
.t-noche .cl-auth-card { background: rgba(17, 17, 29, .88); border-color: #2a2a48; box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(139, 92, 246, .15); }
.t-noche .cl-tabs button[aria-selected="true"] { background: var(--grad); color: #fff; }
.t-noche .cl-invited, .t-noche .cl-donate, .t-noche .cl-invite-item { background: linear-gradient(135deg, rgba(59, 130, 246, .18), rgba(139, 92, 246, .22)); color: #ddd6fe !important; border: 1px solid #34305e; }
.t-noche .cl-push-ask { background: #1a1733; }
.t-noche .cl-modal-card { border: 1px solid var(--line); }
.t-noche .cl-menu-item { background: #181829; }
.t-noche .cl-menu-item:hover { background: #22223a; }
.t-noche .cl-menu-item.is-danger { color: #f87171; }
.t-noche input, .t-noche textarea, .t-noche select { background-color: #0d0d18; border-color: #2a2a48; color: var(--text); }
.t-noche .cl-search input { background-color: #161627; }
.t-noche .cl-invite-count { color: #4ade80; }
.t-noche .cl-alert { background: #2a1215; color: #fecaca; border-color: #7f1d1d; }
.t-noche a { color: #a5b4fc; }

/* Selector de aspecto (perfil y pantalla de entrada) */
.cl-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--brand-soft); border-radius: 999px; padding: 4px; margin: 6px 0 14px; }
.cl-seg button { border: 0; background: transparent; border-radius: 999px; padding: 9px 6px; font-weight: 650; color: var(--muted); }
.cl-seg button[aria-pressed="true"] { background: var(--panel); color: var(--brand); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.t-noche .cl-seg button[aria-pressed="true"] { background: var(--grad); color: #fff; }
.cl-seg-label { font-weight: 700; margin: 14px 0 0; }
.cl-auth-toggles { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.cl-bigtoggle { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Idioma (0.10.0) */
.cl-lang-select { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; margin: 6px 0 14px; }
.cl-lang { display: flex; justify-content: center; gap: 4px; margin: -4px 0 12px; }
.cl-lang a { padding: 4px 10px; border-radius: 999px; font-size: .85em; font-weight: 700; text-decoration: none; color: var(--muted); }
.cl-lang a[aria-current] { background: var(--brand-soft); color: var(--brand); }
.t-noche .cl-lang a[aria-current] { background: var(--grad); color: #fff; }
.cl-audio-dl { display: block; font-size: .85em; margin-top: 4px; }

/* Traer a mis amigos (0.14.0) */
.cl-bring { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: var(--brand-soft); color: inherit; padding: 12px 16px; border-radius: 0; cursor: pointer; }
.cl-bring:hover { filter: brightness(1.05); }
.cl-bring-ico { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #8b5cf6); font-size: 1.5em; }
.cl-bring .cl-item-mid strong { color: var(--brand); }
.cl-bring .cl-item-mid span { font-size: .88em; opacity: .8; }
.t-noche .cl-bring { background: rgba(139, 92, 246, .14); }
.t-noche .cl-bring .cl-item-mid strong { color: #c4b5fd; }
.cl-btn.cl-wa, .t-noche .cl-btn.cl-wa { background: #25d366; background-image: none; color: #06301a; text-decoration: none; width: 100%; font-size: 1.05em; box-shadow: none; }
.cl-btn.cl-wa:hover, .t-noche .cl-btn.cl-wa:hover { background: #20bd5a; background-image: none; }
.cl-other-way { display: block; margin: 10px auto 0; }
.cl-bring-card .cl-form { display: block; margin: 12px 0 16px; font-weight: 600; }
.cl-bring-card .cl-form input { display: block; width: 100%; margin-top: 6px; }
.cl-wait { margin: 24px auto; max-width: 420px; padding: 20px; border-radius: 18px; background: var(--brand-soft); text-align: center; }
.t-noche .cl-wait { background: rgba(139, 92, 246, .14); }
.cl-wait-title { font-weight: 700; font-size: 1.1em; margin: 0 0 6px; }

/* Llamadas (0.15.0) */
.cl-callbtn[hidden] { display: none !important; }
.cl-call { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: max(48px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); background: radial-gradient(120% 80% at 50% 0%, #3b2a7a 0%, #141225 55%, #0b0a14 100%); color: #fff; overflow: hidden; }
.cl-call[hidden] { display: none; }
body.cl-in-call { overflow: hidden; }
.cl-call video { background: transparent; }
#cl-call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.cl-call-video #cl-call-remote { opacity: 1; }
.cl-peer-camoff #cl-call-remote { opacity: 0; }
#cl-call-local { position: absolute; z-index: 2; top: max(16px, env(safe-area-inset-top)); right: 16px; width: 28vw; max-width: 160px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.5); transform: scaleX(-1); background: #000; }
.cl-call:not(.cl-call-video) #cl-call-local { width: 84px; opacity: .9; }
.cl-call-info { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 8vh; text-align: center; }
.cl-call-av .cl-avatar { width: 112px; height: 112px; font-size: 2.6em; box-shadow: 0 0 0 8px rgba(139,92,246,.18), 0 0 0 18px rgba(139,92,246,.08); }
.cl-call-incoming .cl-call-av .cl-avatar { animation: cl-pulse 1.4s ease-in-out infinite; }
@keyframes cl-pulse { 50% { box-shadow: 0 0 0 14px rgba(139,92,246,.28), 0 0 0 30px rgba(139,92,246,.1); } }
.cl-call-name { font-size: 1.6em; font-weight: 700; margin-top: 10px; }
.cl-call-status { opacity: .8; font-variant-numeric: tabular-nums; }
.cl-call-video .cl-call-info { margin-top: 0; flex-direction: row; gap: 10px; align-self: flex-start; background: rgba(0,0,0,.35); padding: 6px 12px 6px 6px; border-radius: 30px; backdrop-filter: blur(6px); }
.cl-call-video .cl-call-av .cl-avatar { width: 36px; height: 36px; font-size: .9em; box-shadow: none; }
.cl-call-video .cl-call-name { font-size: 1em; margin: 0; }
.cl-peer-camoff .cl-call-info { margin-top: 8vh; flex-direction: column; background: none; align-self: center; }
.cl-call-btns { position: relative; z-index: 2; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.cl-cbtn { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; color: #fff; font: inherit; font-size: .8em; cursor: pointer; }
.cl-cbtn svg { width: 64px; height: 64px; padding: 18px; border-radius: 50%; box-sizing: border-box; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; background: rgba(255,255,255,.14); backdrop-filter: blur(6px); transition: transform .15s; }
.cl-cbtn:active svg { transform: scale(.92); }
.cl-cbtn-yes svg { background: #22c55e; fill: #fff; stroke: none; }
.cl-cbtn-yes:last-child svg { animation: cl-wiggle 1.2s ease-in-out infinite; }
@keyframes cl-wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-12deg); } 80% { transform: rotate(12deg); } 90% { transform: rotate(-8deg); } }
.cl-cbtn-no svg { background: #ef4444; fill: #fff; stroke: none; transform: rotate(135deg); }
.cl-cbtn-no:active svg { transform: rotate(135deg) scale(.92); }
.cl-cbtn-tg.cl-off svg { background: #fff; color: #141225; }
@media (min-width: 760px) { .cl-cbtn svg { width: 58px; height: 58px; padding: 16px; } #cl-call-remote { object-fit: contain; background: #000; } }
#cl-call-local[hidden] { display: none; }
#cl-call-sound { display: none; }
.cl-call-unmute { position: relative; z-index: 3; border: 0; border-radius: 999px; padding: 12px 20px; font: inherit; font-weight: 700; background: #fff; color: #141225; box-shadow: 0 6px 24px rgba(0,0,0,.4); cursor: pointer; animation: cl-pulse 1.4s ease-in-out infinite; }
.cl-call-unmute[hidden] { display: none; }
.cl-call-info { order: 1; } .cl-call-unmute { order: 2; } .cl-call-btns { order: 3; }

.cl-call-hint { max-width: 320px; margin: 10px auto 0; padding: 8px 12px; border-radius: 12px; background: rgba(250,204,21,.16); color: #fde68a; font-size: .88em; line-height: 1.35; }
.cl-call-hint[hidden] { display: none; }
.cl-nudge { display: block; margin: 4px auto 10px; }
.cl-wide { width: 100%; margin: 6px 0 4px; font-size: 1.05em; }
.cl-bring-card .cl-modal-head h2 { white-space: normal; line-height: 1.25; }

/* Llamadas de grupo (0.17.0) */
.cl-gcall { padding-top: max(16px, env(safe-area-inset-top)); }
.cl-gc-grid { position: absolute; inset: 0; display: grid; gap: 4px; padding: 4px; padding-bottom: 150px; padding-top: 64px; }
.cl-gcall.cl-call-incoming .cl-gc-grid { display: none; }
.cl-gc-grid[data-n="1"] { grid-template: 1fr / 1fr; }
.cl-gc-grid[data-n="2"] { grid-template: 1fr 1fr / 1fr; }
.cl-gc-grid[data-n="3"], .cl-gc-grid[data-n="4"] { grid-template: 1fr 1fr / 1fr 1fr; }
.cl-gc-grid[data-n="3"] .cl-gc-tile:first-child { grid-column: 1 / -1; }
@media (min-width: 760px) and (orientation: landscape) { .cl-gc-grid[data-n="2"] { grid-template: 1fr / 1fr 1fr; } .cl-gc-grid[data-n="3"] .cl-gc-tile:first-child { grid-column: auto; } .cl-gc-grid[data-n="3"] { grid-template: 1fr 1fr / 1fr 1fr; } }
.cl-gc-tile { position: relative; overflow: hidden; border-radius: 16px; background: rgba(255,255,255,.06); display: grid; place-items: center; min-height: 0; }
.cl-gc-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.cl-gc-tile.has-video video { opacity: 1; }
.cl-gc-tile.is-me video { transform: scaleX(-1); }
.cl-gc-tile audio { display: none; }
.cl-gc-av .cl-avatar { width: 72px; height: 72px; font-size: 1.7em; }
.cl-gc-name { position: absolute; left: 8px; bottom: 8px; padding: 3px 10px; border-radius: 20px; background: rgba(0,0,0,.45); font-size: .85em; }
.cl-gc-tile.is-weak { outline: 2px dashed rgba(250,204,21,.6); }
.cl-gcall.cl-gc-live .cl-call-info { margin-top: 0; flex-direction: row; gap: 10px; align-self: flex-start; background: rgba(0,0,0,.35); padding: 6px 12px 6px 6px; border-radius: 30px; backdrop-filter: blur(6px); }
.cl-gcall.cl-gc-live .cl-call-av .cl-avatar { width: 36px; height: 36px; font-size: .9em; box-shadow: none; }
.cl-gcall.cl-gc-live .cl-call-name { font-size: 1em; margin: 0; }
.cl-gc-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; padding: 10px 14px; border-radius: 14px; background: rgba(34,197,94,.16); border: 1px solid rgba(34,197,94,.35); font-weight: 600; }
.t-noche .cl-avatar.is-bot { background: linear-gradient(135deg, #1e2a5a, #2e1f5e) !important; }
.cl-avatar.is-bot img { object-fit: cover; }
