/* ─── LiveChat — estilos globales ─────────────────────────────────────────
 * Cargado vía <link> desde BaseLayoutV4 → /styles/livechat.css
 * Look: grayscale tipo Desk + acento Apple blue, mobile-first.
 * ───────────────────────────────────────────────────────────────────── */

/* ════════════════════════════════════════════════════════════════════
   BUBBLE — burbuja flotante + badge + toast stack
   ════════════════════════════════════════════════════════════════════ */
.lc-bubble {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 55;
  width: 58px; height: 58px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #18181b;
  color: #fafafa;
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.08),
    0 4px 12px rgb(0 0 0 / 0.12),
    0 12px 32px rgb(0 0 0 / 0.16),
    inset 0 1px 0 rgb(255 255 255 / 0.06);
  cursor: pointer;
  display: inline-flex;
  align-items: center; justify-content: center;
  transition: transform 200ms cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 200ms cubic-bezier(0.32, 0.72, 0, 1);
}
.lc-bubble:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 2px 4px rgb(0 0 0 / 0.10),
    0 8px 20px rgb(0 0 0 / 0.16),
    0 18px 40px rgb(0 0 0 / 0.20),
    inset 0 1px 0 rgb(255 255 255 / 0.08);
}
.lc-bubble:active { transform: translateY(-1px) scale(1.01); }
.lc-bubble:focus-visible {
  outline: 2px solid #0a84ff;
  outline-offset: 4px;
}
.lc-bubble__icon { display: inline-flex; }
.lc-bubble__icon svg { display: block; }

.lc-bubble__badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  background: #ef4444;
  color: #fff;
  border: 2.5px solid #ffffff;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  line-height: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 6px rgb(239 68 68 / 0.35);
  animation: lc-badge-pulse 2.4s ease-in-out infinite;
}
.lc-bubble__badge[hidden] { display: none; }

@keyframes lc-badge-pulse {
  0%, 100% { box-shadow: 0 2px 6px rgb(239 68 68 / 0.35), 0 0 0 0 rgb(239 68 68 / 0.45); }
  50%      { box-shadow: 0 2px 6px rgb(239 68 68 / 0.35), 0 0 0 6px rgb(239 68 68 / 0); }
}

@media (max-width: 640px) {
  .lc-bubble {
    right: 14px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0));
    width: 54px; height: 54px;
  }
}

body[data-lc-hide="1"] .lc-bubble,
body[data-lc-hide="1"] .lc-toast-stack { display: none; }

/* Toast stack ────────────────────────────────────────────── */
.lc-toast-stack {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 56;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  max-width: 360px;
}
@media (max-width: 640px) {
  .lc-toast-stack {
    top: 8px; right: 8px; left: 8px;
    max-width: none;
    align-items: stretch;
  }
}
.lc-toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: rgb(255 255 255 / 0.96);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgb(228 228 231 / 0.8);
  border-radius: 14px;
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.04),
    0 8px 24px rgb(0 0 0 / 0.08),
    0 24px 48px rgb(0 0 0 / 0.06);
  cursor: pointer;
  transform: translateX(110%) scale(0.96);
  opacity: 0;
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1), opacity 220ms ease;
  text-align: left;
  font-family: inherit;
}
.lc-toast.is-in { transform: translateX(0) scale(1); opacity: 1; }
.lc-toast.is-out { transform: translateX(120%) scale(0.96); opacity: 0; }
@media (max-width: 640px) {
  .lc-toast { transform: translateY(-110%) scale(0.96); }
  .lc-toast.is-in { transform: translateY(0) scale(1); }
  .lc-toast.is-out { transform: translateY(-120%) scale(0.96); }
}
.lc-toast__avatar {
  flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, #e4e4e7, #d4d4d8); color: #18181b;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  letter-spacing: -0.02em;
}
.lc-toast__avatar img { width: 100%; height: 100%; object-fit: cover; }
.lc-toast__main { flex: 1; min-width: 0; padding-top: 1px; }
.lc-toast__name {
  margin: 0 0 2px;
  font-size: 13px; font-weight: 600; color: #09090b;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lc-toast__body {
  margin: 0; font-size: 13px; color: #52525b; line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.lc-toast__close {
  flex-shrink: 0;
  background: transparent; border: none; padding: 4px;
  margin: -2px -2px 0 0;
  color: #a1a1aa; cursor: pointer; line-height: 0;
  border-radius: 6px;
  transition: color 120ms ease, background 120ms ease;
}
.lc-toast__close:hover { color: #18181b; background: #f4f4f5; }

/* ════════════════════════════════════════════════════════════════════
   PANEL — drawer (desktop) / bottom sheet (mobile)
   ════════════════════════════════════════════════════════════════════ */
.lc-panel {
  --lc-bg:        #fafafa;
  --lc-surface:   #ffffff;
  --lc-surface-2: #f4f4f5;
  --lc-surface-3: #e4e4e7;
  --lc-line:      #e8e8ec;
  --lc-line-2:    #d4d4d8;
  --lc-ink:       #09090b;
  --lc-ink-2:     #27272a;
  --lc-ink-3:     #71717a;
  --lc-ink-4:     #a1a1aa;
  --lc-accent:    #0a84ff;
  --lc-accent-2:  #006fe6;
  --lc-danger:    #ef4444;
  --lc-radius:    12px;
  --lc-radius-sm: 8px;

  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  font-family: inherit;
  color: var(--lc-ink);
  -webkit-font-smoothing: antialiased;
}
.lc-panel:not([hidden]) { pointer-events: auto; }

.lc-panel__backdrop {
  position: absolute; inset: 0;
  background: rgb(9 9 11 / 0.32);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 240ms ease;
}
.lc-panel.is-open .lc-panel__backdrop { opacity: 1; }

.lc-panel__sheet {
  position: relative;
  display: flex; flex-direction: column;
  width: 440px; max-width: 100vw;
  height: 100vh;
  background: var(--lc-surface);
  border-left: 1px solid var(--lc-line);
  box-shadow:
    -2px 0 4px rgb(0 0 0 / 0.04),
    -16px 0 48px rgb(0 0 0 / 0.10);
  transform: translateX(100%);
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1);
}
.lc-panel.is-open .lc-panel__sheet { transform: translateX(0); }

@media (max-width: 640px) {
  .lc-panel__sheet {
    width: 100vw;
    height: 100dvh;
    border-left: none;
    transform: translateY(100%);
  }
  .lc-panel.is-open .lc-panel__sheet { transform: translateY(0); }
  .lc-panel__backdrop { background: rgb(9 9 11 / 0.5); }
}

/* Header ──────────────────────────────────────────────────── */
.lc-panel__head {
  flex-shrink: 0;
  border-bottom: 1px solid var(--lc-line);
  background: var(--lc-surface);
}
.lc-panel__head-list,
.lc-panel__head-thread {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  min-height: 60px;
}
.lc-panel__head-thread { display: none; }
.lc-panel[data-mode="thread"] .lc-panel__head-list { display: none; }
.lc-panel[data-mode="thread"] .lc-panel__head-thread { display: flex; }

.lc-panel__title {
  flex: 1;
  margin: 0;
  font-size: 17px; font-weight: 700;
  color: var(--lc-ink);
  letter-spacing: -0.02em;
}

.lc-panel__close,
.lc-panel__back {
  width: 34px; height: 34px; padding: 0;
  background: transparent; border: none; border-radius: var(--lc-radius-sm);
  color: var(--lc-ink-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}
.lc-panel__close:hover,
.lc-panel__back:hover { background: var(--lc-surface-2); color: var(--lc-ink); }
.lc-panel__close:active,
.lc-panel__back:active { background: var(--lc-surface-3); }

.lc-head__avatar {
  flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, var(--lc-surface-2), var(--lc-surface-3));
  color: var(--lc-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  letter-spacing: -0.02em;
}
.lc-head__avatar img { width: 100%; height: 100%; object-fit: cover; }
.lc-head__main { flex: 1; min-width: 0; }
.lc-head__name {
  margin: 0; font-size: 14.5px; font-weight: 600; color: var(--lc-ink);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lc-head__sub {
  margin: 2px 0 0; font-size: 12px; color: var(--lc-ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Body ────────────────────────────────────────────────────── */
.lc-panel__body { flex: 1; overflow: hidden; position: relative; }
.lc-view {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--lc-bg);
}
.lc-panel[data-mode="list"]   .lc-view--thread { display: none; }
.lc-panel[data-mode="thread"] .lc-view--list { display: none; }

/* Lista ───────────────────────────────────────────────────── */
.lc-list {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 16px;
  background: var(--lc-bg);
  scrollbar-width: thin;
}
.lc-list::-webkit-scrollbar { width: 8px; }
.lc-list::-webkit-scrollbar-thumb { background: rgb(0 0 0 / 0.08); border-radius: 4px; }
.lc-list::-webkit-scrollbar-thumb:hover { background: rgb(0 0 0 / 0.16); }

.lc-loading {
  margin: 60px 24px 0; text-align: center;
  color: var(--lc-ink-3); font-size: 13px; line-height: 1.5;
}
.lc-empty {
  margin: 0; padding: 56px 32px 32px;
  text-align: center;
  color: var(--lc-ink-3); font-size: 13.5px; line-height: 1.55;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.lc-empty__icon {
  width: 64px; height: 64px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lc-surface), var(--lc-surface-2));
  border: 1px solid var(--lc-line);
  color: var(--lc-ink-4);
  margin-bottom: 8px;
}
.lc-empty strong {
  display: block;
  color: var(--lc-ink); font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
}
.lc-empty p { margin: 0; max-width: 260px; }

.lc-item {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: var(--lc-radius);
  text-align: left;
  background: transparent; border: none;
  color: inherit; font-family: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 140ms ease, transform 80ms ease;
  margin-bottom: 1px;
  opacity: 0;
  animation: lc-item-in 280ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
}
.lc-item:nth-child(1) { animation-delay: 0ms; }
.lc-item:nth-child(2) { animation-delay: 30ms; }
.lc-item:nth-child(3) { animation-delay: 60ms; }
.lc-item:nth-child(4) { animation-delay: 90ms; }
.lc-item:nth-child(5) { animation-delay: 120ms; }
.lc-item:nth-child(n+6) { animation-delay: 150ms; }
@keyframes lc-item-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lc-item:hover { background: var(--lc-surface-2); }
.lc-item:active { background: var(--lc-surface-3); transform: scale(0.995); }

.lc-item__avatar {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, var(--lc-surface-2), var(--lc-surface-3));
  color: var(--lc-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.02em;
}
.lc-item__avatar img { width: 100%; height: 100%; object-fit: cover; }
.lc-item__main { flex: 1; min-width: 0; padding-top: 2px; }
.lc-item__top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin-bottom: 3px;
}
.lc-item__name {
  font-size: 14px; font-weight: 600; color: var(--lc-ink);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lc-item.is-unread .lc-item__name { font-weight: 700; }
.lc-item__time {
  font-size: 11.5px; color: var(--lc-ink-4); flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.lc-item.is-unread .lc-item__time { color: var(--lc-accent); font-weight: 600; }
.lc-item__preview {
  margin: 0; font-size: 13px; color: var(--lc-ink-3); line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lc-item.is-unread .lc-item__preview { color: var(--lc-ink-2); font-weight: 500; }
.lc-item__dot {
  flex-shrink: 0; width: 9px; height: 9px;
  background: var(--lc-accent); border-radius: 50%; margin-top: 8px;
  box-shadow: 0 0 0 3px rgb(10 132 255 / 0.16);
}

/* Stream ──────────────────────────────────────────────────── */
.lc-warn-banner {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(180deg,
    color-mix(in oklab, #0ea5e9 7%, var(--lc-surface)),
    color-mix(in oklab, #0ea5e9 4%, var(--lc-surface)));
  border-bottom: 1px solid var(--lc-line);
  font-size: 11.5px; color: var(--lc-ink-2);
  line-height: 1.4;
}
.lc-warn-banner svg { color: #0369a1; flex-shrink: 0; }

.lc-stream {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--lc-bg);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.lc-stream::-webkit-scrollbar { width: 8px; }
.lc-stream::-webkit-scrollbar-thumb { background: rgb(0 0 0 / 0.06); border-radius: 4px; }
.lc-stream::-webkit-scrollbar-thumb:hover { background: rgb(0 0 0 / 0.14); }

.lc-day {
  text-align: center; margin: 14px 0 6px;
  font-size: 10.5px; color: var(--lc-ink-4); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.lc-system {
  text-align: center; padding: 6px 14px; margin: 6px auto;
  background: var(--lc-surface-2); color: var(--lc-ink-3);
  border-radius: 14px; font-size: 11.5px; max-width: 90%;
}

.lc-msg {
  display: flex; gap: 8px; align-items: flex-end;
  max-width: 82%;
  animation: lc-msg-in 240ms cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes lc-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lc-msg--mine { margin-left: auto; flex-direction: row-reverse; }
.lc-msg__avatar {
  flex-shrink: 0; width: 26px; height: 26px;
  border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, var(--lc-surface-2), var(--lc-surface-3));
  color: var(--lc-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  margin-bottom: 2px;
}
.lc-msg__avatar img { width: 100%; height: 100%; object-fit: cover; }
.lc-msg__bubble {
  padding: 9px 13px; border-radius: 18px;
  background: var(--lc-surface);
  border: 1px solid var(--lc-line);
  max-width: 100%;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.03);
}
.lc-msg--mine .lc-msg__bubble {
  background: linear-gradient(180deg, var(--lc-accent), var(--lc-accent-2));
  color: #fff; border-color: transparent;
  border-bottom-right-radius: 6px;
  box-shadow: 0 1px 2px rgb(10 132 255 / 0.18), 0 4px 12px rgb(10 132 255 / 0.10);
}
.lc-msg--peer .lc-msg__bubble { border-bottom-left-radius: 6px; }
.lc-msg__body {
  margin: 0; font-size: 14px; line-height: 1.42;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
  letter-spacing: -0.005em;
}
.lc-msg__body em { font-style: italic; opacity: 0.7; }
.lc-msg__time {
  display: block; margin-top: 3px; font-size: 10.5px; opacity: 0.62;
  font-variant-numeric: tabular-nums;
}
.lc-msg--mine .lc-msg__time { text-align: right; opacity: 0.78; }

.lc-stream-empty {
  margin: auto; text-align: center; color: var(--lc-ink-3);
  font-size: 13px; padding: 32px; line-height: 1.55;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.lc-stream-empty strong {
  display: block; color: var(--lc-ink); font-weight: 600; font-size: 14px;
  letter-spacing: -0.01em;
}

/* Composer ────────────────────────────────────────────────── */
.lc-composer {
  flex-shrink: 0;
  padding: 10px 14px 12px;
  background: var(--lc-surface);
  border-top: 1px solid var(--lc-line);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
}
.lc-composer__warn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; margin-bottom: 8px;
  background: color-mix(in oklab, #f59e0b 14%, transparent); color: #92400e;
  border: 1px solid color-mix(in oklab, #f59e0b 22%, transparent);
  border-radius: var(--lc-radius-sm); font-size: 11.5px;
  line-height: 1.4;
}
.lc-composer__warn[hidden] { display: none; }
.lc-composer__row { display: flex; align-items: flex-end; gap: 8px; }
.lc-composer__row textarea {
  flex: 1; padding: 10px 14px; min-height: 40px; max-height: 140px;
  background: var(--lc-surface-2); border: 1px solid transparent;
  border-radius: 20px;
  font-family: inherit; font-size: 14px; color: var(--lc-ink);
  resize: none; outline: none; line-height: 1.42;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
@media (max-width: 640px) {
  .lc-composer__row textarea { font-size: 16px; min-height: 44px; }
}
.lc-composer__row textarea::placeholder { color: var(--lc-ink-4); }
.lc-composer__row textarea:focus {
  background: var(--lc-surface);
  border-color: var(--lc-accent);
  box-shadow: 0 0 0 3px rgb(10 132 255 / 0.14);
}
.lc-send {
  flex-shrink: 0;
  width: 40px; height: 40px; padding: 0;
  background: linear-gradient(180deg, var(--lc-accent), var(--lc-accent-2));
  color: #fff; border: none;
  border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgb(10 132 255 / 0.20), 0 4px 12px rgb(10 132 255 / 0.20);
  transition: transform 140ms cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 140ms ease,
              opacity 140ms ease;
}
.lc-send:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgb(10 132 255 / 0.24), 0 6px 16px rgb(10 132 255 / 0.28); }
.lc-send:active { transform: translateY(0); }
.lc-send:disabled { opacity: 0.4; cursor: default; transform: none; box-shadow: none; }
@media (max-width: 640px) { .lc-send { width: 44px; height: 44px; } }
