/* Chat interno de Envíos Kukin — estilos aislados con prefijo kchat- */
.kchat { display: flex; flex-direction: column; min-height: 420px; background: var(--surface, #0e1522); border: 1px solid var(--line, rgba(255,255,255,.08)); border-radius: 18px; overflow: hidden; }
.kchat * { box-sizing: border-box; }
.kchat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); background: rgba(255,255,255,.02); flex-wrap: wrap; }
.kchat-title { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.kchat-title .kchat-badge { position: static; }
.kchat-tabs { display: flex; gap: 6px; }
.kchat-tab { border: 1px solid var(--line, rgba(255,255,255,.08)); background: transparent; color: var(--muted, #aab3c8); border-radius: 999px; padding: 6px 11px; font-size: 12px; font-weight: 700; cursor: pointer; }
.kchat-tab.active { background: var(--green, #22d3a5); color: var(--green-dark, #05201a); border-color: transparent; }
.kchat-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red, #ff6b78); color: #fff; font-size: 10px; font-weight: 800; }
.kchat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.kchat-list { display: flex; flex-direction: column; overflow: auto; max-height: 62vh; }
.kchat-contact { display: flex; align-items: center; gap: 10px; padding: 11px 14px; width: 100%; border: 0; border-bottom: 1px solid rgba(255,255,255,.04); background: transparent; color: var(--text, #f4f7ff); text-align: left; cursor: pointer; }
.kchat-contact:hover { background: rgba(255,255,255,.03); }
.kchat-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; font-size: 13px; font-weight: 800; background: rgba(34,211,165,.16); color: var(--green, #22d3a5); overflow: hidden; }
.kchat-avatar.sm { width: 32px; height: 32px; font-size: 11px; }
.kchat-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.kchat-avatar.role-A { background: rgba(139,92,246,.18); color: #c3acff; }
.kchat-avatar.role-P, .kchat-avatar.role-D { background: rgba(110,168,254,.16); color: #9dc1ff; }
.kchat-avatar.role-R { background: rgba(247,201,72,.14); color: #f7c948; }
.kchat-main { flex: 1; min-width: 0; }
.kchat-name { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kchat-sub { font-size: 11px; color: var(--muted, #aab3c8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.kchat-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.kchat-time { font-size: 10px; color: var(--muted, #aab3c8); }
.kchat-empty { padding: 30px 18px; text-align: center; color: var(--muted, #aab3c8); font-size: 13px; }

.kchat-thread-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); }
.kchat-back { border: 1px solid var(--line, rgba(255,255,255,.08)); background: transparent; color: var(--text, #f4f7ff); border-radius: 10px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; }
.kchat-thread-title { flex: 1; min-width: 0; }
.kchat-thread-title .kchat-name { font-size: 14px; }
.kchat-messages { flex: 1; min-height: 220px; max-height: 52vh; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 7px; background: rgba(0,0,0,.12); }
.kchat-day { align-self: center; font-size: 10px; color: var(--muted, #aab3c8); background: rgba(255,255,255,.05); border-radius: 999px; padding: 3px 9px; margin: 4px 0; }
.kchat-msg { max-width: 84%; padding: 8px 10px; border-radius: 14px; font-size: 13px; line-height: 1.4; word-break: break-word; position: relative; }
.kchat-msg.in { align-self: flex-start; background: var(--surface-2, #121b2b); border: 1px solid var(--line, rgba(255,255,255,.06)); border-bottom-left-radius: 5px; }
.kchat-msg.out { align-self: flex-end; background: rgba(34,211,165,.16); border: 1px solid rgba(34,211,165,.28); border-bottom-right-radius: 5px; }
.kchat-msg.deleted { opacity: .65; font-style: italic; color: var(--muted, #aab3c8); }
.kchat-msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 9px; color: var(--muted, #aab3c8); margin-top: 3px; }
.kchat-msg.out .kchat-msg-meta { color: rgba(244,247,255,.72); }
.kchat-read { font-size: 12px; font-weight: 900; letter-spacing: -1px; line-height: 1; margin-left: 3px; }
.kchat-read.sent { color: rgba(244,247,255,.42); }
.kchat-read.read { color: #ffffff; text-shadow: 0 0 6px rgba(34,211,165,.95); }
.kchat-del { border: 0; background: transparent; color: inherit; opacity: .55; cursor: pointer; font-size: 11px; padding: 0 2px; }
.kchat-img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; margin-bottom: 4px; }
.kchat-file { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.2); color: inherit; text-decoration: none; font-size: 12px; margin-bottom: 4px; }
.kchat-typing { min-height: 16px; padding: 0 14px 4px; font-size: 11px; color: var(--green, #22d3a5); }
.kchat-composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line, rgba(255,255,255,.08)); background: rgba(255,255,255,.02); }
.kchat-input { flex: 1; min-height: 40px; max-height: 110px; resize: none; border: 1px solid var(--line, rgba(255,255,255,.08)); border-radius: 12px; background: var(--surface-2, #121b2b); color: var(--text, #f4f7ff); padding: 10px 12px; font: inherit; outline: none; }
.kchat-input:focus { border-color: rgba(34,211,165,.5); }
.kchat-icon-btn { border: 1px solid var(--line, rgba(255,255,255,.08)); background: var(--surface-2, #121b2b); color: var(--text, #f4f7ff); border-radius: 11px; width: 40px; height: 40px; cursor: pointer; font-size: 16px; flex: 0 0 auto; }
.kchat-send { background: var(--green, #22d3a5); color: var(--green-dark, #05201a); border-color: transparent; font-weight: 900; }
.kchat-file-chip { font-size: 11px; color: var(--muted, #aab3c8); padding: 0 12px 8px; }
.kchat-notice { margin: 10px 12px; padding: 10px 12px; border-radius: 12px; background: rgba(34,211,165,.08); border: 1px solid rgba(34,211,165,.22); color: var(--muted, #aab3c8); font-size: 12px; line-height: 1.45; }
.kchat-form { padding: 12px; border-top: 1px solid var(--line, rgba(255,255,255,.08)); }
.kchat-form label { display: block; font-size: 11px; font-weight: 700; color: var(--muted, #aab3c8); margin: 8px 0 4px; }
.kchat-select, .kchat-textarea { width: 100%; border: 1px solid var(--line, rgba(255,255,255,.08)); border-radius: 10px; background: var(--surface-2, #121b2b); color: var(--text, #f4f7ff); padding: 9px 10px; font: inherit; }
.kchat-textarea { min-height: 80px; resize: vertical; }
.kchat-btn { border: 0; border-radius: 11px; padding: 10px 14px; font-weight: 800; cursor: pointer; background: var(--green, #22d3a5); color: var(--green-dark, #05201a); }
.kchat-btn.soft { background: rgba(255,255,255,.07); color: var(--text, #f4f7ff); border: 1px solid var(--line, rgba(255,255,255,.08)); }
.kchat-error { color: var(--red, #ff6b78); font-size: 12px; padding: 8px 12px; }
.kchat-broadcast { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.05); cursor: pointer; }
.kchat-broadcast.unread { background: rgba(34,211,165,.06); border-left: 3px solid var(--green, #22d3a5); }
.kchat-broadcast-title { font-size: 13px; font-weight: 800; }
.kchat-broadcast-body { font-size: 12px; color: var(--muted, #aab3c8); margin-top: 4px; white-space: pre-wrap; line-height: 1.45; }
.kchat-broadcast-meta { font-size: 10px; color: var(--muted, #aab3c8); margin-top: 5px; display: flex; justify-content: space-between; gap: 8px; }
.kchat-row { display: flex; gap: 8px; align-items: center; }
.kchat-row .kchat-btn { flex: 1; }
