/* =========================================================
   Força Aliada Chat — social-chat.css  v3.0
   Inspired by WhatsApp · Telegram · Discord · MSN
   Dark-first, polished, fast, accessible
   ========================================================= */

/* ── TOKEN SYSTEM ── */
#fa-chat-root {
  /* Surfaces */
  --fc-bg:         #0e0e0c;
  --fc-panel:      #141412;
  --fc-header:     #181816;
  --fc-surface:    #1c1c19;
  --fc-surface-2:  #232320;
  --fc-border:     rgba(201,168,76,.13);
  --fc-border-h:   rgba(201,168,76,.28);

  /* Text */
  --fc-ink:        #f0ede6;
  --fc-ink-2:      #c0bbaf;
  --fc-ink-3:      #7a756a;

  /* Accent */
  --fc-gold:       #c9a84c;
  --fc-gold-dark:  #a8872e;
  --fc-gold-glow:  rgba(201,168,76,.18);
  --fc-green:      #3dba5f;
  --fc-red:        #ff5f52;

  /* Bubbles */
  --fc-bub-me:       #c9a84c;
  --fc-bub-me-text:  #0e0d09;
  --fc-bub-them:     #1f1f1c;
  --fc-bub-them-text:#f0ede6;

  /* Effects */
  --fc-shadow:    0 32px 96px rgba(0,0,0,.82), 0 4px 20px rgba(0,0,0,.4);
  --fc-ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --fc-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --fc-r:         22px;
  --fc-r-sm:      14px;

  /* FAB offset vars */
  --fa-chat-fab-right: 24px;
  --fa-chat-fab-width: 112px;
  --fa-chat-fab-bottom: 24px;
  --fa-chat-fab-gap:    10px;

  font-family: inherit;
  position: relative;
  z-index: 800;
  color: var(--fc-ink);
}

@media(max-width:767px) {
  #fa-chat-root input,
  #fa-chat-root textarea,
  #fa-chat-root select {
    font-size: 16px !important;
  }
}

/* =========================================================
   Message interactions and feed-like shared posts
   ========================================================= */
#fa-chat-root .fa-chat-bubble-row {
  position: relative;
  transition: transform .18s var(--fc-ease), background .18s ease;
  touch-action: pan-y;
}

#fa-chat-root .fa-chat-bubble-row.is-highlighted .fa-chat-bubble {
  animation: faChatHighlight 1.35s ease;
}

@keyframes faChatHighlight {
  0%,100% { box-shadow: inherit; }
  35% { box-shadow: 0 0 0 4px color-mix(in srgb,var(--fc-gold) 32%,transparent),0 8px 26px rgba(0,0,0,.2); }
}

#fa-chat-root .fa-chat-swipe-reply {
  position:absolute;
  top:50%;
  left:5px;
  width:30px;
  height:30px;
  display:grid;
  place-items:center;
  border-radius:999px;
  background:var(--fc-gold);
  color:#111;
  font-size:17px;
  font-weight:950;
  opacity:0;
  transform:translate(-12px,-50%) scale(.72);
  transition:opacity .15s,transform .15s;
  pointer-events:none;
}

#fa-chat-root .fa-chat-bubble-row.is-me .fa-chat-swipe-reply {
  left:auto;
  right:5px;
}

#fa-chat-root .fa-chat-bubble-row.is-swipe-ready .fa-chat-swipe-reply {
  opacity:1;
  transform:translate(0,-50%) scale(1);
}

#fa-chat-root .fa-chat-message-quick-actions {
  position:absolute;
  top:50%;
  right:calc(100% + 6px);
  z-index:4;
  display:flex;
  gap:3px;
  padding:3px;
  border:1px solid var(--fc-border);
  border-radius:999px;
  background:color-mix(in srgb,var(--fc-header) 92%,transparent);
  box-shadow:0 8px 22px rgba(0,0,0,.2);
  opacity:0;
  pointer-events:none;
  transform:translateY(-45%) scale(.94);
  transition:opacity .15s,transform .15s;
}

#fa-chat-root .fa-chat-bubble-row:not(.is-me) .fa-chat-message-quick-actions {
  right:auto;
  left:calc(100% + 6px);
}

#fa-chat-root .fa-chat-bubble-row:hover .fa-chat-message-quick-actions,
#fa-chat-root .fa-chat-message-quick-actions:focus-within {
  opacity:1;
  pointer-events:auto;
  transform:translateY(-50%) scale(1);
}

#fa-chat-root .fa-chat-message-quick-actions button {
  width:25px;
  height:25px;
  display:grid;
  place-items:center;
  border:0;
  border-radius:999px;
  background:transparent;
  color:var(--fc-ink-2);
  cursor:pointer;
  font-size:14px;
  font-weight:900;
}

#fa-chat-root .fa-chat-message-quick-actions button:hover {
  background:color-mix(in srgb,var(--fc-gold) 16%,transparent);
  color:var(--fc-gold);
}

#fa-chat-root .fa-chat-message-quick-actions svg { width:14px;height:14px; }

#fa-chat-root .fa-chat-message-reactions {
  position:absolute;
  right:3px;
  bottom:-19px;
  z-index:3;
  display:flex;
  gap:4px;
  max-width:100%;
}

#fa-chat-root .fa-chat-bubble-row:not(.is-me) .fa-chat-message-reactions { right:auto;left:3px; }
#fa-chat-root .fa-chat-bubble-row:has(.fa-chat-message-reactions) { margin-bottom:20px; }

#fa-chat-root .fa-chat-message-reactions button {
  min-width:32px;
  height:25px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:3px;
  padding:0 7px;
  border:1px solid var(--fc-border);
  border-radius:999px;
  background:var(--fc-header);
  color:var(--fc-ink-2);
  box-shadow:0 3px 10px rgba(0,0,0,.16);
  cursor:pointer;
}

#fa-chat-root .fa-chat-message-reactions button.is-mine {
  border-color:color-mix(in srgb,var(--fc-gold) 64%,var(--fc-border));
  background:color-mix(in srgb,var(--fc-gold) 14%,var(--fc-header));
  color:var(--fc-gold);
}

#fa-chat-root .fa-chat-message-reactions b { font-size:9px;font-weight:950; }

#fa-chat-root .fa-chat-reply-preview {
  width:100%;
  display:grid;
  gap:2px;
  margin:0 0 6px;
  padding:6px 8px;
  border:0;
  border-left:3px solid var(--fc-gold);
  border-radius:4px 8px 8px 4px;
  background:color-mix(in srgb,currentColor 7%,transparent);
  color:inherit;
  text-align:left;
  cursor:pointer;
}

#fa-chat-root .fa-chat-reply-preview strong { color:var(--fc-gold);font-size:10px;font-weight:950; }
#fa-chat-root .fa-chat-reply-preview span { overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.72;font-size:10.5px; }
#fa-chat-root .fa-chat-edited { margin-right:4px;font-size:9px;font-weight:800;opacity:.52; }

#fa-chat-root .fa-chat-compose-context:empty { display:none; }
#fa-chat-root .fa-chat-context-card {
  display:grid;
  grid-template-columns:28px minmax(0,1fr) 28px;
  align-items:center;
  gap:8px;
  margin:8px 10px 0;
  padding:7px 8px;
  border:1px solid color-mix(in srgb,var(--fc-gold) 32%,var(--fc-border));
  border-radius:12px;
  background:color-mix(in srgb,var(--fc-gold) 8%,var(--fc-surface));
}

#fa-chat-root .fa-chat-context-icon {
  width:28px;height:28px;display:grid;place-items:center;border-radius:9px;
  background:var(--fc-gold);color:#111;font-size:15px;font-weight:950;
}
#fa-chat-root .fa-chat-context-copy { min-width:0;display:grid;gap:2px; }
#fa-chat-root .fa-chat-context-copy strong { color:var(--fc-ink);font-size:11px;font-weight:950; }
#fa-chat-root .fa-chat-context-copy small { overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--fc-ink-2);font-size:10px; }
#fa-chat-root .fa-chat-context-card > button { width:28px;height:28px;border:0;border-radius:9px;background:transparent;color:var(--fc-ink-2);cursor:pointer; }
#fa-chat-root .fa-chat-context-card > button:hover { background:rgba(255,255,255,.06);color:var(--fc-ink); }

#fa-chat-root .fa-chat-message-menu {
  position:fixed;
  z-index:2147483646;
  width:min(300px,calc(100vw - 20px));
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--fc-gold) 30%,var(--fc-border));
  border-radius:18px;
  background:color-mix(in srgb,var(--fc-header) 96%,#000);
  color:var(--fc-ink);
  box-shadow:0 22px 70px rgba(0,0,0,.46);
  backdrop-filter:blur(18px);
  animation:faChatMenuIn .16s var(--fc-ease);
}

@keyframes faChatMenuIn { from{opacity:0;transform:translateY(5px) scale(.97)} to{opacity:1;transform:none} }
#fa-chat-root .fa-chat-message-menu-head { display:grid;gap:3px;padding:11px 12px 8px;border-bottom:1px solid var(--fc-border); }
#fa-chat-root .fa-chat-message-menu-head strong { font-size:11px;color:var(--fc-gold);font-weight:950; }
#fa-chat-root .fa-chat-message-menu-head small { overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--fc-ink-2);font-size:10px; }
#fa-chat-root .fa-chat-message-menu-emojis { display:grid;grid-template-columns:repeat(7,1fr);gap:2px;padding:8px;border-bottom:1px solid var(--fc-border); }
#fa-chat-root .fa-chat-message-menu-emojis button { height:31px;border:0;border-radius:9px;background:transparent;cursor:pointer;font-size:17px;transition:background .15s,transform .15s; }
#fa-chat-root .fa-chat-message-menu-emojis button:hover { background:rgba(255,255,255,.07);transform:scale(1.14); }
#fa-chat-root .fa-chat-message-menu-actions { display:grid;padding:5px; }
#fa-chat-root .fa-chat-message-menu-actions button { min-height:36px;display:flex;align-items:center;gap:10px;padding:0 10px;border:0;border-radius:10px;background:transparent;color:var(--fc-ink);cursor:pointer;text-align:left;font-size:12px;font-weight:800; }
#fa-chat-root .fa-chat-message-menu-actions button:hover { background:rgba(255,255,255,.06); }
#fa-chat-root .fa-chat-message-menu-actions button.is-danger { color:var(--fc-red); }
#fa-chat-root .fa-chat-message-menu-actions svg { width:15px;height:15px; }

#fa-chat-root .fa-chat-social-preview {
  overflow:visible;
  border:0;
  background:transparent;
  box-shadow:none;
}

#fa-chat-root .fa-chat-social-card {
  display:block;
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--fc-gold) 56%,#000);
  border-radius:15px;
  background:#050505;
  color:#f4f1e8;
  box-shadow:0 12px 32px rgba(0,0,0,.3);
}

#fa-chat-root .fa-chat-social-card-main { display:grid;gap:8px;padding:11px 11px 9px; }
#fa-chat-root .fa-chat-social-card-author { grid-template-columns:32px minmax(0,1fr);column-gap:8px; }
#fa-chat-root .fa-chat-social-card-author img { width:32px;height:32px;border-radius:9px;border:1px solid rgba(201,168,76,.34); }
#fa-chat-root .fa-chat-social-card-author strong { font-size:12px; }
#fa-chat-root .fa-chat-social-card-text { -webkit-line-clamp:5;font-size:12px;line-height:1.46; }
#fa-chat-root .fa-chat-social-card-media { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px;background:#000; }
#fa-chat-root .fa-chat-social-card-media.media-count-1 { grid-template-columns:1fr; }
#fa-chat-root .fa-chat-social-card-media.media-count-3 img:first-child { grid-row:span 2; }
#fa-chat-root .fa-chat-social-card-media img { width:100%;height:108px;display:block;object-fit:cover;background:#0b0b0b; }
#fa-chat-root .fa-chat-social-card-media.media-count-1 img { height:auto;max-height:260px;aspect-ratio:1.35; }
#fa-chat-root .fa-chat-social-card-stats { display:block;padding:8px 11px 10px;border-top:1px solid rgba(201,168,76,.22);color:rgba(244,241,232,.62);font-size:9.5px; }
#fa-chat-root .fa-chat-social-card:hover { background:#0b0a07;transform:translateY(-1px); }

@media (pointer:coarse) {
  #fa-chat-root .fa-chat-message-quick-actions { display:none; }
}

/* Light theme overrides */
[data-theme="light"] #fa-chat-root {
  --fc-bg:         #f5f0e8;
  --fc-panel:      #fdfcf9;
  --fc-header:     #f8f5ef;
  --fc-surface:    #ede8dd;
  --fc-surface-2:  #e4ddd0;
  --fc-border:     rgba(93,73,31,.15);
  --fc-border-h:   rgba(93,73,31,.30);
  --fc-ink:        #1a1710;
  --fc-ink-2:      #5a5448;
  --fc-ink-3:      #9e9588;
  --fc-gold:       #9b7a2d;
  --fc-gold-dark:  #7a5f1e;
  --fc-gold-glow:  rgba(155,122,45,.14);
  --fc-green:      #1e8c45;
  --fc-red:        #d93025;
  --fc-bub-me:       #9b7a2d;
  --fc-bub-me-text:  #fff;
  --fc-bub-them:     #ede8dd;
  --fc-bub-them-text:#1a1710;
  --fc-shadow:    0 20px 60px rgba(31,24,12,.18), 0 4px 14px rgba(31,24,12,.09);
}

/* ═══════════════════════════════════════════════
   LAUNCHER FAB
═══════════════════════════════════════════════ */
.fa-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(201,168,76,.35);
  border-radius: 17px;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.26), transparent 20px),
    linear-gradient(145deg, var(--fc-gold), var(--fc-gold-dark));
  color: #0e0d09;
  cursor: pointer;
  box-shadow:
    0 6px 20px var(--fc-gold-glow),
    0 2px 6px rgba(0,0,0,.22),
    inset 0 1px 0 rgba(255,255,255,.20);
  transition:
    transform .2s var(--fc-spring),
    box-shadow .2s ease;
}

.fa-chat-launcher:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 12px 32px var(--fc-gold-glow),
    0 3px 10px rgba(0,0,0,.25),
    inset 0 1px 0 rgba(255,255,255,.22);
}

.fa-chat-launcher:active { transform: scale(.94); }
.fa-chat-launcher svg { width: 22px; height: 22px; }

/* Offset when FAB is present */
.fa-chat-has-fab .fa-chat-launcher {
  right: calc(var(--fa-chat-fab-right) + var(--fa-chat-fab-width) + var(--fa-chat-fab-gap));
  bottom: var(--fa-chat-fab-bottom);
}

/* ── Unread Badge ── */
.fa-chat-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  border: 2.5px solid var(--fc-panel);
  background: var(--fc-red);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -.01em;
  animation: fcBadgePop .32s var(--fc-spring) both;
}

/* ── Nav button unread badge (desktop topbar + mobile nav) ── */
.fa-chat-nav-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border-radius: 999px;
  border: 2px solid var(--fc-panel, #fff);
  background: var(--fc-red, #e53e3e);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: -.01em;
  pointer-events: none;
  animation: fcBadgePop .32s var(--fc-spring) both;
}

@keyframes fcBadgePop {
  from { transform: scale(0) rotate(-12deg); }
  to   { transform: scale(1) rotate(0deg); }
}

/* ═══════════════════════════════════════════════
   PANEL
═══════════════════════════════════════════════ */
.fa-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 86px;
  width: min(400px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 112px));
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  overflow: hidden;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-r);
  background: var(--fc-panel);
  box-shadow: var(--fc-shadow);

  /* Closed state */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(.96);
  transform-origin: bottom right;
  transition:
    opacity .2s var(--fc-ease),
    transform .26s var(--fc-spring),
    visibility 0s linear .2s;
}

.fa-chat-panel.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition:
    opacity .2s var(--fc-ease),
    transform .26s var(--fc-spring),
    visibility 0s linear 0s;
}

/* Thin scrollbars */
.fa-chat-list::-webkit-scrollbar,
.fa-chat-messages::-webkit-scrollbar,
.fa-chat-member-list::-webkit-scrollbar {
  width: 3px;
}
.fa-chat-list::-webkit-scrollbar-track,
.fa-chat-messages::-webkit-scrollbar-track,
.fa-chat-member-list::-webkit-scrollbar-track { background: transparent; }
.fa-chat-list::-webkit-scrollbar-thumb,
.fa-chat-messages::-webkit-scrollbar-thumb,
.fa-chat-member-list::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}
.fa-chat-list:hover::-webkit-scrollbar-thumb,
.fa-chat-messages:hover::-webkit-scrollbar-thumb,
.fa-chat-member-list:hover::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--fc-ink) 18%, transparent);
}

/* ═══════════════════════════════════════════════
   PANEL HEADER  (top bar + peer bar)
═══════════════════════════════════════════════ */
.fa-chat-top {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--fc-border);
  background: var(--fc-header);
}

/* Subtle gold shimmer line at top */
.fa-chat-top::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--fc-gold), transparent);
  opacity: .55;
  border-radius: var(--fc-r) var(--fc-r) 0 0;
  pointer-events: none;
}

.fa-chat-panel { position: fixed; }
.fa-chat-panel { overflow: hidden; }

.fa-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.fa-chat-title strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--fc-ink);
}

.fa-chat-title span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--fc-ink-3);
  line-height: 1.2;
  margin-top: 1px;
}

/* The chat icon in header */
.fa-chat-title .fa-chat-peer-av {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--fc-gold-glow);
  color: var(--fc-gold);
  border: 1px solid var(--fc-border);
  flex: 0 0 auto;
}

.fa-chat-title .fa-chat-peer-av svg { width: 18px; height: 18px; }

/* ═══════════════════════════════════════════════
   ICON BUTTONS
═══════════════════════════════════════════════ */
.fa-chat-icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--fc-border);
  border-radius: 10px;
  background: var(--fc-surface);
  color: var(--fc-ink-3);
  cursor: pointer;
  flex: 0 0 auto;
  transition: color .13s, background .13s, border-color .13s;
}

.fa-chat-icon-btn:hover {
  color: var(--fc-gold);
  background: var(--fc-surface-2);
  border-color: var(--fc-border-h);
}

.fa-chat-icon-btn:active { transform: scale(.92); }
.fa-chat-icon-btn svg { width: 15px; height: 15px; }

/* ═══════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════ */
.fa-chat-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 5px;
  padding: 10px 10px 0;
}

.fa-chat-tab {
  height: 32px;
  border: 1px solid var(--fc-border);
  border-radius: 9px;
  background: var(--fc-surface);
  color: var(--fc-ink-3);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .01em;
  cursor: pointer;
  transition: color .13s, background .13s, border-color .13s;
}

.fa-chat-tab.is-active {
  background: color-mix(in srgb, var(--fc-gold) 14%, var(--fc-surface));
  border-color: color-mix(in srgb, var(--fc-gold) 50%, var(--fc-border));
  color: var(--fc-gold);
  box-shadow: 0 2px 8px var(--fc-gold-glow);
}

.fa-chat-tab:hover:not(.is-active) {
  background: var(--fc-surface-2);
  color: var(--fc-ink-2);
  border-color: var(--fc-border-h);
}

/* No underline on active tab */

/* ═══════════════════════════════════════════════
   BODY / LIST AREA
═══════════════════════════════════════════════ */
.fa-chat-body {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
}

/* Search input */
.fa-chat-search {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 10px;
  border-bottom: 1px solid var(--fc-border);
  background: var(--fc-panel);
}

.fa-chat-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--fc-border);
  border-radius: 999px;
  outline: none;
  background: var(--fc-surface);
  color: var(--fc-ink);
  font: inherit;
  font-size: 12.5px;
  transition: border-color .13s, box-shadow .13s;
  /* search icon via background */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a756a' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 14px;
}

.fa-chat-search input:focus {
  border-color: color-mix(in srgb, var(--fc-gold) 55%, var(--fc-border));
  box-shadow: 0 0 0 3px var(--fc-gold-glow);
  background-color: var(--fc-surface-2);
}

.fa-chat-list,
.fa-chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 6px 7px 10px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.fa-chat-list:hover,
.fa-chat-messages:hover {
  scrollbar-color: color-mix(in srgb, var(--fc-ink) 14%, transparent) transparent;
}

/* ── Conversation / Friend rows ── */
.fa-chat-row,
.fa-chat-friend {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  position: relative;
}

.fa-chat-row:hover,
.fa-chat-friend:hover {
  border-color: var(--fc-border);
  background: var(--fc-surface);
}

/* Active/pressed effect */
.fa-chat-row:active,
.fa-chat-friend:active {
  transform: scale(.985);
  background: var(--fc-surface-2);
}

.fa-chat-row.is-unread::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 999px;
  background: var(--fc-gold);
}

.fa-chat-row.is-unread strong { color: var(--fc-gold); }

.fa-chat-row-meta,
.fa-chat-friend-meta { min-width: 0; }

.fa-chat-row strong,
.fa-chat-friend strong {
  display: block;
  overflow: hidden;
  color: var(--fc-ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fa-chat-row small,
.fa-chat-friend small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--fc-ink-3);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fa-chat-row > small {
  color: var(--fc-ink-3);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   AVATAR SYSTEM
═══════════════════════════════════════════════ */
.fa-chat-av-wrap {
  position: relative;
  flex: 0 0 auto;
  display: inline-block;
  line-height: 0;
}

/* Online dot */
.fa-chat-online-dot {
  position: absolute;
  bottom: -1px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--fc-green);
  border: 2px solid var(--fc-panel);
  animation: fcPulse 2.8s ease-in-out infinite;
}

.fa-chat-online-dot--peer {
  width: 11px; height: 11px;
  bottom: -2px; right: -2px;
}

@keyframes fcPulse {
  0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--fc-green) 30%, transparent); }
  50%      { box-shadow: 0 0 0 4px color-mix(in srgb, var(--fc-green) 10%, transparent); }
}

.fa-chat-peer-av,
.fa-chat-row img,
.fa-chat-friend img,
.fa-chat-av-wrap img {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  background: var(--fc-surface);
  border: 1px solid var(--fc-border);
}

.fa-chat-group-av {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--fc-border);
  border-radius: 12px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--fc-gold) 14%, var(--fc-surface)),
    color-mix(in srgb, var(--fc-green) 10%, var(--fc-surface)));
  color: var(--fc-gold);
}

.fa-chat-group-av svg { width: 18px; height: 18px; }

/* ═══════════════════════════════════════════════
   GROUP CREATOR
═══════════════════════════════════════════════ */
.fa-chat-new-group {
  width: calc(100% - 8px);
  min-height: 56px;
  display: grid;
  grid-template-columns: 40px minmax(0,1fr);
  gap: 10px;
  align-items: center;
  margin: 0 4px 4px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--fc-gold) 22%, var(--fc-border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--fc-gold) 7%, var(--fc-surface));
  color: var(--fc-ink);
  cursor: pointer;
  text-align: left;
  transition: background .13s, border-color .13s;
}

.fa-chat-new-group:hover {
  background: color-mix(in srgb, var(--fc-gold) 12%, var(--fc-surface));
  border-color: color-mix(in srgb, var(--fc-gold) 38%, var(--fc-border));
}

.fa-chat-new-group > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  grid-row: 1 / span 2;
  border-radius: 12px;
  background: var(--fc-gold);
  color: #0e0d09;
}

.fa-chat-new-group svg { width: 17px; height: 17px; }
.fa-chat-new-group strong, .fa-chat-new-group small { grid-column: 2; }

.fa-chat-new-group strong {
  align-self: end;
  font-size: 13px;
  font-weight: 900;
  color: var(--fc-ink);
}

.fa-chat-new-group small {
  align-self: start;
  color: var(--fc-ink-3);
  font-size: 11.5px;
  font-weight: 650;
}

.fa-chat-group-maker {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto auto auto minmax(0,1fr) auto;
  gap: 8px;
  padding: 4px 6px 6px;
}

.fa-chat-maker-head {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr);
  gap: 9px;
  align-items: center;
  padding: 4px 2px;
}

.fa-chat-maker-head strong {
  display: block;
  font-size: 13px;
  font-weight: 900;
}

.fa-chat-maker-head small {
  color: var(--fc-ink-3);
  font-size: 11.5px;
  font-weight: 650;
}

.fa-chat-group-name {
  width: 100%;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--fc-border);
  border-radius: 999px;
  outline: none;
  background: var(--fc-surface);
  color: var(--fc-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: border-color .13s, box-shadow .13s;
}

.fa-chat-group-name:focus {
  border-color: color-mix(in srgb, var(--fc-gold) 55%, var(--fc-border));
  box-shadow: 0 0 0 3px var(--fc-gold-glow);
}

.fa-chat-selected {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 0 2px;
}

.fa-chat-selected span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fc-gold) 14%, var(--fc-surface));
  color: var(--fc-gold);
  font-size: 11px;
  font-weight: 850;
  border: 1px solid var(--fc-border-h);
}

.fa-chat-selected small { color: var(--fc-ink-3); font-size: 11.5px; }

.fa-chat-member-list {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.fa-chat-member-list:hover {
  scrollbar-color: color-mix(in srgb, var(--fc-ink) 14%, transparent) transparent;
}

.fa-chat-member {
  width: 100%;
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) 26px;
  gap: 9px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .12s, border-color .12s;
}

.fa-chat-member:hover,
.fa-chat-member.is-selected {
  border-color: color-mix(in srgb, var(--fc-gold) 24%, var(--fc-border));
  background: color-mix(in srgb, var(--fc-gold) 7%, var(--fc-surface));
}

.fa-chat-member img {
  width: 38px; height: 38px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--fc-border);
}

.fa-chat-member strong, .fa-chat-member small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fa-chat-member strong { font-size: 13px; font-weight: 800; }

.fa-chat-member small {
  margin-top: 2px;
  color: var(--fc-ink-3);
  font-size: 11.5px;
}

.fa-chat-member i {
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--fc-surface-2);
  color: var(--fc-ink-3);
  font-style: normal;
  font-size: 13px;
  font-weight: 900;
  border: 1px solid var(--fc-border);
}

.fa-chat-member.is-selected i {
  background: var(--fc-gold);
  color: #0e0d09;
  border-color: var(--fc-gold);
}

.fa-chat-create {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--fc-gold), var(--fc-gold-dark));
  color: #0e0d09;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: opacity .13s, transform .13s;
  box-shadow: 0 4px 14px var(--fc-gold-glow);
}

.fa-chat-create:hover:not(:disabled) { opacity: .88; transform: scale(1.02); }
.fa-chat-create:active:not(:disabled) { transform: scale(.97); }
.fa-chat-create:disabled { cursor: not-allowed; opacity: .38; }

/* ═══════════════════════════════════════════════
   PILLS & STATUS
═══════════════════════════════════════════════ */
.fa-chat-pill {
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--fc-gold);
  color: #0e0d09;
  font-size: 10px;
  font-weight: 900;
  flex: 0 0 auto;
}

/* ── Add-friend button ── */
.fa-chat-add-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1.5px solid color-mix(in srgb, var(--fc-gold) 45%, var(--fc-border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--fc-gold) 10%, var(--fc-surface));
  color: var(--fc-gold);
  cursor: pointer;
  transition: background .13s, border-color .13s, transform .13s;
}

.fa-chat-add-btn:hover {
  background: color-mix(in srgb, var(--fc-gold) 20%, var(--fc-surface));
  border-color: var(--fc-gold);
  transform: scale(1.1);
}

.fa-chat-add-btn:active { transform: scale(.9); }

.fa-chat-add-btn svg {
  width: 13px;
  height: 13px;
}

.fa-chat-add-btn.is-sent {
  background: color-mix(in srgb, var(--fc-green) 14%, var(--fc-surface));
  border-color: var(--fc-green);
  color: var(--fc-green);
  pointer-events: none;
}

/* ── Verified badge ── */
.fa-chat-verified {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-left: 4px;
  vertical-align: middle;
  color: var(--fc-gold);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--fc-gold) 55%, transparent));
}

.fa-chat-verified svg {
  width: 14px;
  height: 14px;
}

/* ── Friend section header ── */
.fa-chat-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 4px;
}

.fa-chat-section-head strong {
  color: var(--fc-ink-2);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* ═══════════════════════════════════════════════
   EMPTY / ERROR STATES
═══════════════════════════════════════════════ */
.fa-chat-empty {
  padding: 32px 18px;
  color: var(--fc-ink-3);
  text-align: center;
  line-height: 1.5;
}

.fa-chat-error {
  padding: 24px 16px;
  color: var(--fc-red);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.fa-chat-error small {
  display: block;
  font-size: 11.5px;
  color: var(--fc-ink-3);
  font-weight: 400;
  max-width: 220px;
  line-height: 1.4;
}

.fa-chat-retry-btn {
  margin-top: 6px;
  padding: 7px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--fc-gold);
  background: transparent;
  color: var(--fc-gold);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.fa-chat-retry-btn:hover {
  background: var(--fc-gold);
  color: var(--fc-bub-me-text);
}

.fa-chat-inline-error {
  margin: 4px 4px 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--fc-red) 24%, var(--fc-border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--fc-red) 8%, var(--fc-surface));
  color: var(--fc-red);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fa-chat-inline-error strong {
  font-size: 12px;
  font-weight: 900;
}

.fa-chat-empty strong,
.fa-chat-error strong {
  display: block;
  color: var(--fc-ink-2);
  font-size: 13.5px;
  font-weight: 800;
  margin-bottom: 5px;
}

/* ═══════════════════════════════════════════════
   SKELETON LOADERS
═══════════════════════════════════════════════ */
.fa-chat-skel {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) 34px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
}

.fa-chat-skel span,
.fa-chat-skel i,
.fa-chat-skel b {
  display: block;
  min-width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg,
    var(--fc-surface),
    color-mix(in srgb, var(--fc-surface) 44%, var(--fc-surface-2)),
    var(--fc-surface));
  background-size: 220% 100%;
  animation: fcSkel 1.4s ease-in-out infinite;
}

.fa-chat-skel span { width: 38px; height: 38px; border-radius: 10px; }
.fa-chat-skel i   { width: 80%; height: 11px; }
.fa-chat-skel b   { width: 30px; height: 16px; }

@keyframes fcSkel {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

@keyframes fcSpin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════
   THREAD LAYOUT
═══════════════════════════════════════════════ */
.fa-chat-thread {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
}

/* ── Peer Bar ── */
.fa-chat-peerbar {
  min-height: 56px;
  display: grid;
  grid-template-columns: auto auto minmax(0,1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--fc-border);
  background: var(--fc-header);
}

.fa-chat-peerbar strong {
  display: block;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fc-ink);
}

.fa-chat-peerbar small {
  display: block;
  color: var(--fc-ink-3);
  font-size: 11px;
  font-weight: 650;
  margin-top: 1px;
}

.fa-chat-peerbar img.fa-chat-peer-av,
.fa-chat-peerbar .fa-chat-av-wrap img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

/* ═══════════════════════════════════════════════
   DATE SEPARATOR
═══════════════════════════════════════════════ */
.fa-chat-date-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 8px;
  pointer-events: none;
}

.fa-chat-date-sep span {
  padding: 3px 13px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fc-surface-2) 80%, transparent);
  border: 1px solid var(--fc-border);
  color: var(--fc-ink-3);
  font-size: 10.5px;
  font-weight: 750;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ═══════════════════════════════════════════════
   MESSAGES AREA
═══════════════════════════════════════════════ */
.fa-chat-messages {
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Bubble Row ── */
.fa-chat-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  margin-top: 2px;
}

/* Breathing room on first of group */
.fa-chat-bubble-row.is-group-first { margin-top: 12px; }

.fa-chat-bubble-row.is-me { justify-content: flex-end; }

/* Avatar in bubble */
.fa-chat-bubble-av {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--fc-surface);
  flex: 0 0 auto;
  align-self: flex-end;
  border: 1px solid var(--fc-border);
}

.fa-chat-bubble-av-spacer {
  width: 26px;
  flex: 0 0 auto;
}

/* Wrap: alert icon + bubble */
.fa-chat-bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  max-width: 78%;
}

.fa-chat-bubble-row.is-me .fa-chat-bubble-wrap {
  flex-direction: row-reverse;
}

/* ── The Bubble ── */
.fa-chat-bubble {
  position: relative;
  padding: 8px 12px 6px;
  border-radius: 17px;
  background: var(--fc-bub-them);
  color: var(--fc-bub-them-text);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  border: 1px solid var(--fc-border);
}

/* Clearfix para conter o float do .fa-chat-meta-row sem cortar o conteúdo */
.fa-chat-bubble::after {
  content: '';
  display: table;
  clear: both;
}

/* Conteúdo de texto da bubble */
.fa-chat-bubble-body {
  display: inline;
}

.fa-chat-media-grid {
  display: grid;
  gap: 7px;
  margin: 0 0 6px;
  max-width: min(320px, 72vw);
}

.fa-chat-attachment {
  position: relative;
  max-width: min(320px, 72vw);
}

.fa-chat-media-link,
.fa-chat-media-img,
.fa-chat-media-video {
  display: block;
  max-width: 100%;
  border-radius: 12px;
}

.fa-chat-media-link {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  background: rgba(0,0,0,.08);
}

.fa-chat-media-img {
  width: min(300px, 70vw);
  max-height: 280px;
  object-fit: cover;
}

.fa-chat-image-open {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.fa-chat-media-video {
  width: min(320px, 72vw);
  max-height: 300px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  background: #000;
  cursor: pointer;
}

/* ── Audio Player Customizado ─────────────────────────────────────────────── */

/* ── A bubble que envolve o player fica "nua": sem padding, sem background
   extra, sem border própria. O player já tem tudo isso.
   Usa :has() — suportado Chrome 105+, Safari 15.4+, Firefox 121+.
   Fallback: mesmo sem :has() a pior coisa que acontece é a borda dupla,
   que a regra abaixo em .fa-chat-attachment--audio também mitiga. ─────────── */
.fa-chat-bubble:has(> .fa-chat-media-grid > .fa-chat-attachment--audio:only-child) {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
/* Remove margem-bottom da media-grid quando é só áudio */
.fa-chat-bubble:has(> .fa-chat-media-grid > .fa-chat-attachment--audio:only-child) .fa-chat-media-grid {
  margin: 0;
  gap: 0;
}

/* Garante que o container do attachment não adicione padding extra */
.fa-chat-attachment--audio {
  overflow: visible;
}

.fa-chat-audio-player {
  width: min(290px, 74vw);
  display: grid;
  grid-template-columns: 44px minmax(0,1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 14px 10px 10px;
  border-radius: 17px;
  background: var(--fc-bub-them);
  border: 1px solid var(--fc-border);
  cursor: default;
  user-select: none;
  transition: background .15s;
}

/* Player dentro de bubble de quem enviou — dourado sem borda */
.fa-chat-bubble-row.is-me .fa-chat-audio-player {
  background: var(--fc-bub-me);
  border-color: color-mix(in srgb, var(--fc-bub-me) 60%, transparent);
}

/* Estado de loading: spinner sutil no player */
.fa-chat-audio-player.is-loading { opacity: .7; pointer-events: none; }
.fa-chat-audio-player.is-loading .fa-cap-play { animation: fcCapSpin .8s linear infinite; }
@keyframes fcCapSpin {
  to { transform: rotate(360deg); }
}

/* Botão play/pause */
.fa-cap-play {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--fc-ink-2, rgba(255,255,255,.72));
  color: var(--fc-bub-them-text, #f0ede6);
  cursor: pointer;
  transition: transform .15s, opacity .15s, background .15s;
}

.fa-cap-play:hover  { transform: scale(1.08); }
.fa-cap-play:active { transform: scale(.90);  }

/* Ícone dentro do botão */
.fa-cap-play svg {
  width: 18px;
  height: 18px;
  color: var(--fc-bub-them, #1f1f1c);
  flex: 0 0 auto;
}

/* Bubble do remetente (dourado) */
.fa-chat-bubble-row.is-me .fa-cap-play {
  background: rgba(0,0,0,.28);
  color: var(--fc-bub-me-text, #0e0d09);
}
.fa-chat-bubble-row.is-me .fa-cap-play svg {
  color: var(--fc-bub-me-text, #0e0d09);
}

[data-theme="light"] .fa-cap-play {
  background: var(--fc-ink-3, rgba(0,0,0,.45));
}
[data-theme="light"] .fa-cap-play svg {
  color: #fff;
}
[data-theme="light"] .fa-chat-bubble-row.is-me .fa-cap-play {
  background: rgba(0,0,0,.22);
}
[data-theme="light"] .fa-chat-bubble-row.is-me .fa-cap-play svg {
  color: #fff;
}

.fa-cap-icon-pause { display: none; }
.fa-chat-audio-player.is-playing .fa-cap-icon-play  { display: none; }
.fa-chat-audio-player.is-playing .fa-cap-icon-pause { display: block; }

/* Erro no player */
.fa-chat-audio-player.has-error .fa-cap-play { opacity: .45; pointer-events: none; }
.fa-chat-audio-player.has-error .fa-cap-waveform { opacity: .35; }

/* Coluna direita */
.fa-cap-body {
  min-width: 0;
  display: grid;
  gap: 5px;
}

/* Waveform sintético */
.fa-cap-waveform {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 24px;
  pointer-events: none;
}

.fa-cap-waveform span {
  flex: 1;
  min-width: 2px;
  max-width: 3px;
  border-radius: 999px;
  background: var(--fc-ink-2, rgba(255,255,255,.55));
  opacity: .35;
  transition: opacity .12s;
}

.fa-cap-waveform span.played {
  opacity: .85;
}

/* Me: waveform mais escuro */
.fa-chat-bubble-row.is-me .fa-cap-waveform span {
  background: rgba(0,0,0,.55);
}
.fa-chat-bubble-row.is-me .fa-cap-waveform span.played {
  background: rgba(0,0,0,.85);
  opacity: 1;
}

.fa-chat-audio-player.is-playing .fa-cap-waveform span {
  animation: fcWfPulse 1.1s ease-in-out infinite alternate;
}
.fa-chat-audio-player.is-playing .fa-cap-waveform span:nth-child(2n) { animation-delay: .18s; }
.fa-chat-audio-player.is-playing .fa-cap-waveform span:nth-child(3n) { animation-delay: .36s; }

@keyframes fcWfPulse {
  from { opacity: .3; }
  to   { opacity: .85; }
}

/* Track de progresso */
.fa-cap-progress-track {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fc-ink-2) 25%, transparent);
  cursor: pointer;
  touch-action: none;
  transition: height .12s;
}

.fa-cap-progress-track:hover { height: 4px; }

.fa-cap-progress-fill {
  position: absolute;
  inset: 0;
  right: auto;
  border-radius: 999px;
  background: var(--fc-ink-2, rgba(255,255,255,.72));
  pointer-events: none;
  transition: width .08s linear;
}

.fa-chat-bubble-row.is-me .fa-cap-progress-fill {
  background: rgba(0,0,0,.55);
}

.fa-cap-progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fc-ink, #f0ede6);
  pointer-events: none;
  transition: transform .12s;
}

.fa-chat-bubble-row.is-me .fa-cap-progress-thumb {
  background: rgba(0,0,0,.7);
}

.fa-cap-progress-track:hover .fa-cap-progress-thumb,
.fa-chat-audio-player.is-playing .fa-cap-progress-thumb {
  transform: translate(-50%, -50%) scale(1);
}

/* Rodapé: tempo + velocidade + duração + download */
.fa-cap-foot {
  display: flex;
  align-items: center;
  gap: 5px;
}

.fa-cap-time,
.fa-cap-dur {
  font-size: 10px;
  font-weight: 800;
  opacity: .55;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--fc-ink, #f0ede6);
}

.fa-chat-bubble-row.is-me .fa-cap-time,
.fa-chat-bubble-row.is-me .fa-cap-dur {
  color: rgba(0,0,0,.7);
}

.fa-cap-time { min-width: 26px; }
.fa-cap-dur  { margin-left: auto; }

/* ── Botão de velocidade 1×/1.5×/2× ── */
.fa-cap-speed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 20px;
  padding: 0 5px;
  border: 0;
  border-radius: 6px;
  background: rgba(255,255,255,.12);
  color: var(--fc-ink-2, rgba(255,255,255,.72));
  font-size: 10px;
  font-weight: 900;
  font-family: inherit;
  letter-spacing: -.01em;
  cursor: pointer;
  opacity: .75;
  transition: opacity .15s, background .15s, transform .1s;
  flex: 0 0 auto;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.fa-cap-speed:hover  { opacity: 1; background: rgba(255,255,255,.2); }
.fa-cap-speed:active { transform: scale(.88); }
.fa-cap-speed.is-active {
  opacity: 1;
  background: rgba(255,255,255,.22);
  font-weight: 950;
  color: #fff;
}

/* Bubble do remetente (fundo dourado) */
.fa-chat-bubble-row.is-me .fa-cap-speed {
  background: rgba(0,0,0,.15);
  color: rgba(0,0,0,.7);
}
.fa-chat-bubble-row.is-me .fa-cap-speed:hover    { background: rgba(0,0,0,.25); }
.fa-chat-bubble-row.is-me .fa-cap-speed.is-active { background: rgba(0,0,0,.28); color: rgba(0,0,0,.9); }

/* Botão de download — <button> em vez de <a> para evitar download automático
   via Content-Type: application/octet-stream do Cloudinary raw */
.fa-cap-dl {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fc-ink-2, rgba(255,255,255,.72));
  opacity: .5;
  cursor: pointer;
  transition: opacity .13s, background .13s, transform .1s;
  flex: 0 0 auto;
  -webkit-tap-highlight-color: transparent;
}

.fa-cap-dl:hover  { opacity: .9;  background: rgba(255,255,255,.12); }
.fa-cap-dl:active { opacity: 1; transform: scale(.88); }
.fa-cap-dl svg    { width: 13px; height: 13px; }

.fa-chat-bubble-row.is-me .fa-cap-dl {
  color: rgba(0,0,0,.7);
}
.fa-chat-bubble-row.is-me .fa-cap-dl:hover { background: rgba(0,0,0,.14); }

.fa-chat-pdf-preview {
  width: 100%;
  height: 190px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.92);
}

.fa-chat-pdf-card {
  width: min(300px, 72vw);
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 8px;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, currentColor 7%, transparent);
}

.fa-chat-pdf-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, #ef4444 18%, transparent);
  color: #ef4444;
  font-size: 10px;
  font-weight: 950;
}

.fa-chat-pdf-download {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, currentColor 8%, transparent);
  color: currentColor;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 900;
}

.fa-chat-pdf-download:hover {
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.fa-chat-pdf-download svg {
  width: 13px;
  height: 13px;
}

.fa-chat-pdf-card strong,
.fa-chat-pdf-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fa-chat-pdf-card strong {
  font-size: 12px;
  font-weight: 900;
}

.fa-chat-pdf-card small {
  font-size: 10px;
  opacity: .72;
}

.fa-chat-file-card {
  width: min(300px, 72vw);
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, currentColor 7%, transparent);
  color: currentColor;
}

.fa-chat-file-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: 10px;
  font-weight: 950;
}

.fa-chat-file-icon svg {
  width: 20px;
  height: 20px;
}

.fa-chat-file-meta {
  min-width: 0;
}

.fa-chat-file-meta strong,
.fa-chat-file-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fa-chat-file-meta strong {
  font-size: 12px;
  font-weight: 900;
}

.fa-chat-file-meta small {
  margin-top: 2px;
  font-size: 10px;
  opacity: .72;
}

.fa-chat-social-previews {
  display: grid;
  gap: 6px;
  margin-top: 7px;
  white-space: normal;
}

.fa-chat-social-preview {
  width: min(310px, 72vw);
  overflow: hidden;
  border: 1px solid rgba(201,168,76,.68);
  border-radius: 12px;
  background: #070706;
  color: #f0ede6;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
}

.fa-chat-social-preview.is-loading {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.fa-chat-social-preview-shimmer {
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 13%, transparent);
  animation: faChatPreviewPulse 1.15s ease-in-out infinite alternate;
}

.fa-chat-social-preview-shimmer.is-short {
  width: 62%;
}

@keyframes faChatPreviewPulse {
  to { opacity: .38; }
}

.fa-chat-social-card {
  width: 100%;
  display: grid;
  grid-template-columns: 84px minmax(0,1fr);
  padding: 0;
  border: 0;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.fa-chat-social-card.no-media {
  grid-template-columns: minmax(0,1fr);
}

.fa-chat-social-card--comment,
.fa-chat-social-card.is-unavailable {
  grid-template-columns: minmax(0,1fr);
  gap: 5px;
  padding: 11px;
}

.fa-chat-social-card-cover {
  width: 84px;
  height: 100%;
  min-height: 116px;
  object-fit: cover;
  background: rgba(0,0,0,.16);
  border-right: 1px solid rgba(201,168,76,.34);
}

.fa-chat-social-card-main {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 10px;
}

.fa-chat-social-card-brand {
  color: var(--fc-gold);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.fa-chat-social-card-author {
  min-width: 0;
  display: grid;
  grid-template-columns: 25px minmax(0,1fr);
  grid-template-rows: auto auto;
  column-gap: 7px;
  align-items: center;
}

.fa-chat-social-card-author img {
  width: 25px;
  height: 25px;
  grid-row: 1 / span 2;
  border-radius: 6px;
  object-fit: cover;
}

.fa-chat-social-card-author strong,
.fa-chat-social-card-author small,
.fa-chat-social-card-text,
.fa-chat-social-card-context {
  overflow: hidden;
  text-overflow: ellipsis;
}

.fa-chat-social-card-author strong {
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.fa-chat-social-card-author small,
.fa-chat-social-card-stats,
.fa-chat-social-card-context {
  color: color-mix(in srgb, currentColor 66%, transparent);
  font-size: 9.5px;
}

.fa-chat-social-card-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
  font-size: 11.5px;
  line-height: 1.4;
}

.fa-chat-social-card-context {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  padding: 7px 8px;
  border-left: 2px solid var(--fc-gold);
  border-radius: 0 7px 7px 0;
  background: color-mix(in srgb, currentColor 6%, transparent);
  line-height: 1.35;
}

.fa-chat-social-card:hover {
  background: rgba(201,168,76,.08);
}

.fa-chat-bubble.is-social-only,
.fa-chat-bubble-row.is-me .fa-chat-bubble.is-social-only {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fc-ink-2);
  box-shadow: none;
}

.fa-chat-bubble.is-social-only .fa-chat-social-previews {
  margin-top: 0;
}

.fa-chat-bubble.is-social-only .fa-chat-meta-row {
  float: none;
  display: flex;
  justify-content: flex-end;
  margin-top: 3px;
  padding: 0 2px;
}

.fa-chat-attach-menu-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(0,0,0,.62);
  color: #fff;
  cursor: pointer;
  opacity: .92;
  transition: transform .13s, background .13s;
}

.fa-chat-attach-menu-btn:hover {
  background: rgba(0,0,0,.78);
  transform: scale(1.04);
}

.fa-chat-attach-menu-btn svg {
  width: 16px;
  height: 16px;
}

.fa-chat-attach-menu {
  position: absolute;
  top: 40px;
  right: 7px;
  z-index: 3;
  min-width: 118px;
  padding: 5px;
  border: 1px solid var(--fc-border-h);
  border-radius: 10px;
  background: var(--fc-panel);
  box-shadow: 0 12px 30px rgba(0,0,0,.34);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(.96);
  transform-origin: top right;
  transition: opacity .13s, transform .13s;
}

.fa-chat-attachment.is-menu-open .fa-chat-attach-menu {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.fa-chat-attach-menu button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fc-ink);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  text-align: left;
}

.fa-chat-attach-menu button:hover {
  background: var(--fc-surface);
}

.fa-chat-attach-menu svg {
  width: 15px;
  height: 15px;
}

/* Meta row: timestamp + tick — alinhada ao final da última linha de texto
   usando a técnica do "spacer span" (igual ao WhatsApp Web):
   a meta row fica após o texto inline, empurrada para a direita */
.fa-chat-meta-row {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  /* Empurra para o fim da linha */
  float: right;
  /* Espaço da borda do texto até o tick */
  margin-left: 8px;
  margin-bottom: -1px;
  /* Alinha verticalmente ao bottom da linha */
  vertical-align: bottom;
  /* Pequeno indent para não grudar no texto em mensagens curtas */
  padding-top: 2px;
}

/* Timestamp dentro do meta row */
.fa-chat-meta-row time {
  display: inline-block;
  color: currentColor;
  font-size: 9.5px;
  font-weight: 700;
  opacity: .55;
  white-space: nowrap;
  vertical-align: middle;
}

/* Tail — first bubble of a block */
.fa-chat-bubble-row:not(.is-me) .fa-chat-bubble.has-tail {
  border-bottom-left-radius: 5px;
}

.fa-chat-bubble-row.is-me .fa-chat-bubble.has-tail {
  border-bottom-right-radius: 5px;
}

/* Me bubble */
.fa-chat-bubble-row.is-me .fa-chat-bubble {
  background: var(--fc-bub-me);
  color: var(--fc-bub-me-text);
  border-color: color-mix(in srgb, var(--fc-bub-me) 60%, transparent);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--fc-bub-me) 25%, transparent);
}

/* Pending */
.fa-chat-bubble-row.is-pending .fa-chat-bubble { opacity: .62; }

/* Failed */
.fa-chat-bubble-row.is-failed .fa-chat-bubble {
  background: color-mix(in srgb, var(--fc-red) 90%, #000);
  color: #fff;
  border-color: var(--fc-red);
  animation: fcShake .44s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes fcShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-5px); }
  35% { transform: translateX(5px); }
  55% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
  90% { transform: translateX(-1px); }
}

/* Fail-alert button */
.fa-chat-fail-alert {
  width: 22px; height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--fc-red);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  align-self: flex-end;
  margin-bottom: 4px;
  transition: transform .15s, opacity .15s;
}

.fa-chat-fail-alert:hover { transform: scale(1.18); opacity: .9; }

/* New message entrance */
.fa-chat-bubble-row.is-new .fa-chat-bubble {
  animation: fcMsgIn .22s var(--fc-ease) both;
}

.fa-chat-bubble-row.is-new.is-me .fa-chat-bubble {
  animation: fcMsgInMe .22s var(--fc-ease) both;
}

@keyframes fcMsgIn {
  from { opacity: 0; transform: translateY(5px) translateX(-3px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

@keyframes fcMsgInMe {
  from { opacity: 0; transform: translateY(5px) translateX(3px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* Group name badge inside bubble */
.fa-chat-bubble-name {
  display: block;
  margin-bottom: 3px;
  color: var(--fc-gold);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .01em;
}

/* Timestamp legado (compatibilidade — mantido mas sobrescrito pelo .fa-chat-meta-row time) */
.fa-chat-bubble time:not(.fa-chat-meta-row time) {
  display: block;
  margin-top: 3px;
  color: currentColor;
  font-size: 9.5px;
  font-weight: 700;
  opacity: .55;
}

/* ── Status Ticks (WhatsApp style) ── */
/* Ticks ficam dentro de .fa-chat-meta-row, ao lado do timestamp */

.fa-tick-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 14px;
  color: currentColor;
  /* Herda a opacidade do parent por padrão; cada estado sobrescreve */
}

.fa-tick {
  width: 16px;
  height: 14px;
  flex: 0 0 auto;
  display: block;
  overflow: visible;
}

/* ⏳ pending — spinner animado */
[data-tick-status="pending"] .fa-tick {
  animation: fcTickSpin .9s linear infinite;
  opacity: .65;
}

.fa-tick-spin {
  stroke-dasharray: 25;
  stroke-dashoffset: 25;
  animation: fcTickDash .9s ease-in-out infinite;
  transform-origin: center;
}

@keyframes fcTickSpin {
  to { transform: rotate(360deg); }
}
@keyframes fcTickDash {
  0%   { stroke-dashoffset: 25; opacity: .3; }
  50%  { stroke-dashoffset: 0;  opacity: 1;  }
  100% { stroke-dashoffset: -25; opacity: .3; }
}

/* ✓ sent — cinza/opaco */
[data-tick-status="sent"] .fa-tick {
  opacity: .55;
}

/* ✓✓ delivered — mais visível */
[data-tick-status="delivered"] .fa-tick {
  opacity: .85;
}

/* ✓✓🔵 read — azul brilhante */
[data-tick-status="read"] .fa-tick--read {
  stroke: #5AC8FA;
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(90,200,250,.6));
}

/* ⚠ failed — vermelho */
[data-tick-status="failed"] .fa-tick--fail {
  stroke: var(--fc-red);
  opacity: 1;
}

/* Transição suave entre estados */
.fa-tick-wrap svg {
  transition: opacity .25s ease, stroke .25s ease;
}

/* ═══════════════════════════════════════════════
   COMPOSE BAR  (WhatsApp-style pill)
═══════════════════════════════════════════════ */
.fa-chat-compose-wrap {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--fc-border);
  background: var(--fc-header);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.fa-chat-compose { padding: 8px 10px 10px; }

.fa-chat-compose-error {
  min-height: 0;
  padding: 0 14px;
  color: var(--fc-red);
  font-size: 11px;
  font-weight: 800;
}

.fa-chat-compose-error:empty { display: none; }

.fa-chat-attachments-preview {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 8px 10px 0;
  scrollbar-width: none;
}

.fa-chat-attachments-preview:empty { display: none; }
.fa-chat-attachments-preview::-webkit-scrollbar { display: none; }

.fa-chat-recording-panel:empty {
  display: none;
}

.fa-chat-recording {
  display: grid;
  grid-template-columns: auto auto minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 8px 10px 0;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--fc-red) 24%, var(--fc-border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--fc-red) 8%, var(--fc-surface));
  color: var(--fc-ink);
}

.fa-chat-recording-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--fc-red);
  animation: fcRecordPulse 1s ease-in-out infinite;
}

@keyframes fcRecordPulse {
  0%, 100% { opacity: .45; transform: scale(.82); }
  50% { opacity: 1; transform: scale(1.15); }
}

.fa-chat-recording strong {
  font-size: 13px;
  font-weight: 950;
  color: var(--fc-red);
  font-variant-numeric: tabular-nums;
}

.fa-chat-recording small {
  overflow: hidden;
  color: var(--fc-ink-2);
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fa-chat-recording.is-locked {
  border-color: color-mix(in srgb, var(--fc-gold) 42%, var(--fc-border));
  background: color-mix(in srgb, var(--fc-gold) 9%, var(--fc-surface));
}

.fa-chat-recording button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--fc-red) 30%, var(--fc-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--fc-red) 10%, var(--fc-surface));
  color: var(--fc-red);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.fa-chat-pending-attachment {
  position: relative;
  width: 78px;
  min-width: 78px;
  height: 68px;
  overflow: hidden;
  border: 1px solid var(--fc-border);
  border-radius: 12px;
  background: var(--fc-surface);
  color: var(--fc-ink-2);
}

.fa-chat-pending-attachment img,
.fa-chat-pending-attachment video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.fa-chat-pending-attachment > span:not(.fa-chat-attach-kind) {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  overflow: hidden;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(0,0,0,.62);
  color: #fff;
  font-size: 9px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fa-chat-attach-kind {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--fc-gold);
  font-size: 12px;
  font-weight: 950;
}

.fa-chat-pending-attachment button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(0,0,0,.68);
  color: #fff;
  cursor: pointer;
}

.fa-chat-pending-attachment button svg {
  width: 12px;
  height: 12px;
}

.fa-chat-compose-pill {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  background: var(--fc-surface);
  border: 1.5px solid var(--fc-border);
  border-radius: 999px;
  padding: 5px;
  transition: border-color .13s, box-shadow .13s;
}

.fa-chat-tool-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fc-ink-3);
  cursor: pointer;
  transition: color .13s, background .13s, transform .13s;
}

.fa-chat-tool-btn:hover {
  background: var(--fc-surface-2);
  color: var(--fc-gold);
}

.fa-chat-tool-btn:active { transform: scale(.92); }
.fa-chat-tool-btn svg { width: 17px; height: 17px; }

.fa-chat-mic-btn.is-recording {
  background: color-mix(in srgb, var(--fc-red) 12%, var(--fc-surface-2));
  color: var(--fc-red);
}

.fa-chat-compose-pill:focus-within {
  border-color: color-mix(in srgb, var(--fc-gold) 55%, var(--fc-border));
  box-shadow: 0 0 0 3px var(--fc-gold-glow);
  background: var(--fc-surface-2);
}

.fa-chat-compose-pill textarea {
  flex: 1 1 auto;
  min-height: 28px;
  max-height: 110px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fc-ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 3px 0;
  scrollbar-width: none;
}

.fa-chat-compose-pill textarea::placeholder { color: var(--fc-ink-3); }
.fa-chat-compose-pill textarea::-webkit-scrollbar { display: none; }

/* Send button — circular, inside pill */
.fa-chat-send {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--fc-gold), var(--fc-gold-dark));
  color: #0e0d09;
  cursor: pointer;
  box-shadow: 0 3px 10px var(--fc-gold-glow);
  transition: transform .18s var(--fc-spring), opacity .13s;
}

.fa-chat-send:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 5px 18px var(--fc-gold-glow);
}

.fa-chat-send:active:not(:disabled) { transform: scale(.92); }
.fa-chat-send:disabled { cursor: not-allowed; opacity: .36; transform: none; }
.fa-chat-send svg { width: 15px; height: 15px; }

/* Char counter */
[data-chat-char-counter] {
  text-align: right;
  font-size: 10px;
  padding: 0 14px 2px;
  opacity: 0;
  transition: opacity .15s;
  color: var(--fc-ink-3);
}

/* ═══════════════════════════════════════════════
   LOADING SPINNER (inside messages)
═══════════════════════════════════════════════ */
.fa-chat-message-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--fc-ink-3);
}

.fa-chat-message-loading svg {
  animation: fcSpin .8s linear infinite;
  opacity: .7;
}

.fa-chat-message-loading span {
  font-size: 12px;
  font-weight: 700;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE  — Mobile
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .fa-chat-launcher {
    right: 16px;
    bottom: 16px;
  }

  /* Hide floating launcher when mobile bottom nav is present */
  .fa-chat-has-mobile-nav .fa-chat-launcher {
    display: none;
  }

  .fa-chat-has-fab .fa-chat-launcher {
    right: calc(var(--fa-chat-fab-right) + var(--fa-chat-fab-width) + 8px);
    bottom: var(--fa-chat-fab-bottom);
  }

  .fa-chat-panel {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    transform-origin: center;
    transform: translateX(100%);
    transition:
      opacity .18s var(--fc-ease),
      transform .24s var(--fc-ease),
      visibility 0s linear .18s;
    z-index: 960;
  }

  .fa-chat-has-mobile-nav .fa-chat-panel {
    inset: 0;
    width: 100vw;
    height: 100dvh;
  }

  .fa-chat-panel.is-open {
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition:
      opacity .18s var(--fc-ease),
      transform .24s var(--fc-ease),
      visibility 0s linear 0s;
  }

  .fa-chat-thread {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  .fa-chat-thread .fa-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fa-chat-thread .fa-chat-compose-wrap {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 1;
  }

  body.fa-chat-open .mobile-bottom-nav {
    display: grid!important;
  }
}

/* Full-screen viewer lives outside #fa-chat-root. */
body.fa-chat-viewer-open {
  overflow: hidden;
}

.fa-chat-viewer {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.fa-chat-viewer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.fa-chat-viewer-bg {
  position: absolute;
  inset: 0;
  background: rgba(5,5,5,.94);
  backdrop-filter: blur(18px);
}

.fa-chat-viewer-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(10,10,10,.42);
}

.fa-chat-viewer-topbar > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.fa-chat-viewer-topbar strong,
.fa-chat-viewer-topbar small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fa-chat-viewer-topbar strong {
  font-size: 13px;
  font-weight: 900;
}

.fa-chat-viewer-topbar small {
  color: rgba(255,255,255,.62);
  font-size: 10px;
}

.fa-chat-viewer-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}

.fa-chat-viewer-tools button,
.fa-chat-viewer-nav {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  transition: background .14s ease, transform .14s ease;
}

.fa-chat-viewer-tools button {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border-radius: 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
}

.fa-chat-viewer-tools button:hover,
.fa-chat-viewer-nav:hover {
  background: rgba(255,255,255,.17);
}

.fa-chat-viewer-tools svg,
.fa-chat-viewer-nav svg {
  width: 16px;
  height: 16px;
}

.fa-chat-viewer-stage {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px 72px;
}

.fa-chat-viewer-stage img {
  max-width: 100%;
  max-height: calc(100vh - 112px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
  transform-origin: center;
  transition: transform .14s ease;
}

.fa-chat-viewer-nav {
  position: fixed;
  z-index: 3;
  top: 50%;
  width: 42px;
  height: 58px;
  border-radius: 12px;
  transform: translateY(-50%);
}

.fa-chat-viewer-nav.is-prev {
  left: 14px;
}

.fa-chat-viewer-nav.is-next {
  right: 14px;
}

.fa-chat-viewer-nav.is-next svg {
  transform: rotate(180deg);
}

@media (max-width: 640px) {
  .fa-chat-viewer-topbar {
    align-items: flex-start;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px;
  }

  .fa-chat-viewer-tools {
    gap: 3px;
  }

  .fa-chat-viewer-tools button {
    min-width: 32px;
    height: 32px;
    padding: 0 7px;
  }

  .fa-chat-viewer-tools [data-chat-viewer-zoom-out],
  .fa-chat-viewer-tools [data-chat-viewer-zoom-in] {
    display: none;
  }

  .fa-chat-viewer-stage {
    padding: 12px;
  }

  .fa-chat-viewer-stage img {
    max-height: calc(100dvh - 92px);
  }

  .fa-chat-viewer-nav {
    top: auto;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
    transform: none;
  }
}

@media (max-width: 480px) {
  #fa-chat-root .fa-chat-social-preview {
    width: min(300px, 76vw);
  }

  #fa-chat-root .fa-chat-social-card {
    grid-template-columns: 72px minmax(0,1fr);
  }

  #fa-chat-root .fa-chat-social-card--comment,
  #fa-chat-root .fa-chat-social-card.no-media,
  #fa-chat-root .fa-chat-social-card.is-unavailable {
    grid-template-columns: minmax(0,1fr);
  }

  #fa-chat-root .fa-chat-social-card-cover {
    width: 72px;
    min-height: 108px;
  }

  #fa-chat-root .fa-chat-social-card-main {
    gap: 5px;
    padding: 8px;
  }
}

/* ═══════════════════════════════════════════════
   FA SHELL OVERRIDES  (cosmetic polish)
═══════════════════════════════════════════════ */
#fa-chat-root .fa-chat-panel {
  border-color: var(--fc-border);
}

#fa-chat-root .fa-chat-top {
  background: var(--fc-header);
}

/* Keep avatar corners consistent with the rest of the shell */
#fa-chat-root .fa-chat-peer-av,
#fa-chat-root .fa-chat-row img,
#fa-chat-root .fa-chat-friend img,
#fa-chat-root .fa-chat-av-wrap img,
#fa-chat-root .fa-chat-bubble-av {
  border-radius: 8px;
}

/* =========================================================
   Chat shell v4: real messenger window
   ========================================================= */
#fa-chat-root .fa-chat-panel {
  right: 18px;
  bottom: 82px;
  width: min(880px, calc(100vw - 36px));
  height: min(680px, calc(100vh - 104px));
  display: block;
  border-radius: 18px;
  background: var(--fc-panel);
}

#fa-chat-root .fa-chat-app {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  overflow: hidden;
}

#fa-chat-root .fa-chat-sidebar {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-right: 1px solid var(--fc-border);
  background: var(--fc-panel);
}

#fa-chat-root .fa-chat-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--fc-bg) 80%, transparent), var(--fc-bg)),
    radial-gradient(circle at 18px 18px, color-mix(in srgb, var(--fc-gold) 10%, transparent) 1px, transparent 1.5px);
  background-size: auto, 34px 34px;
}

#fa-chat-root .fa-chat-top {
  position: relative;
}

#fa-chat-root .fa-chat-body {
  min-height: 0;
  height: auto;
  grid-row: 3;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

#fa-chat-root .fa-chat-search {
  position: relative;
  top: auto;
  z-index: 1;
  background: var(--fc-panel);
}

#fa-chat-root .fa-chat-list {
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

#fa-chat-root .fa-chat-thread {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

#fa-chat-root .fa-chat-peerbar {
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
}

#fa-chat-root .fa-chat-thread .fa-chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 10px;
}

#fa-chat-root .fa-chat-compose-wrap {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--fc-header) 94%, transparent);
}

#fa-chat-root .fa-chat-empty-stage {
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 34px;
  color: var(--fc-ink-3);
  text-align: center;
}

#fa-chat-root .fa-chat-empty-stage strong {
  color: var(--fc-ink);
  font-size: 19px;
  font-weight: 900;
}

#fa-chat-root .fa-chat-empty-stage p {
  max-width: 320px;
  margin: 0;
  color: var(--fc-ink-2);
  font-size: 13px;
  line-height: 1.45;
}

#fa-chat-root .fa-chat-empty-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--fc-border-h);
  border-radius: 16px;
  background: color-mix(in srgb, var(--fc-gold) 12%, var(--fc-surface));
  color: var(--fc-gold);
}

#fa-chat-root .fa-chat-empty-icon svg {
  width: 27px;
  height: 27px;
}

#fa-chat-root .fa-chat-row,
#fa-chat-root .fa-chat-friend {
  border-radius: 12px;
}

#fa-chat-root .fa-chat-row:focus-visible,
#fa-chat-root .fa-chat-friend:focus-visible,
#fa-chat-root .fa-chat-tab:focus-visible,
#fa-chat-root .fa-chat-icon-btn:focus-visible,
#fa-chat-root .fa-chat-send:focus-visible {
  outline: 3px solid var(--fc-gold-glow);
  outline-offset: 2px;
}

#fa-chat-root .fa-chat-inline-error {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
}

#fa-chat-root .fa-chat-inline-error strong,
#fa-chat-root .fa-chat-inline-error span {
  min-width: 0;
}

#fa-chat-root .fa-chat-inline-error button {
  grid-row: 1 / span 2;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--fc-red) 32%, var(--fc-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--fc-red) 10%, var(--fc-surface));
  color: var(--fc-red);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

@media (max-width: 768px) {
  body.fa-chat-open {
    overflow: hidden;
  }

  #fa-chat-root .fa-chat-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    transform: translateX(100%);
    transform-origin: center;
    z-index: 960;
    box-shadow: none;
  }

  #fa-chat-root .fa-chat-panel.is-open {
    transform: translateX(0);
  }

  #fa-chat-root .fa-chat-app {
    position: relative;
    display: block;
    height: 100%;
  }

  #fa-chat-root .fa-chat-sidebar,
  #fa-chat-root .fa-chat-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-right: 0;
  }

  #fa-chat-root .fa-chat-panel.has-thread .fa-chat-sidebar,
  #fa-chat-root .fa-chat-panel.has-inbox .fa-chat-stage {
    display: none;
  }

  #fa-chat-root .fa-chat-panel.has-inbox .fa-chat-sidebar {
    display: grid;
  }

  #fa-chat-root .fa-chat-panel.has-thread .fa-chat-stage {
    display: grid;
  }

  #fa-chat-root .fa-chat-top,
  #fa-chat-root .fa-chat-peerbar {
    min-height: calc(58px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
  }

  #fa-chat-root .fa-chat-thread {
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  #fa-chat-root .fa-chat-thread .fa-chat-messages {
    padding: 14px 10px 8px;
    -webkit-overflow-scrolling: touch;
  }

  #fa-chat-root .fa-chat-compose-wrap {
    position: relative;
    bottom: auto;
    padding-bottom: 0;
  }

  /* Prevent iOS zoom on input focus (font-size must be >= 16px) */
  #fa-chat-root .fa-chat-compose-pill textarea {
    font-size: 16px;
  }

  #fa-chat-root .fa-chat-search input {
    font-size: 16px;
  }

  #fa-chat-root .fa-chat-group-name {
    font-size: 16px;
  }

  #fa-chat-root .fa-chat-compose {
    padding: 8px 9px 10px;
  }

  #fa-chat-root .fa-chat-compose-pill {
    border-radius: 18px;
  }

  #fa-chat-root .fa-chat-tool-btn {
    width: 36px;
    height: 36px;
  }

  #fa-chat-root .fa-chat-pending-attachment {
    width: 74px;
    min-width: 74px;
    height: 64px;
  }

  #fa-chat-root .fa-chat-media-grid,
  #fa-chat-root .fa-chat-attachment,
  #fa-chat-root .fa-chat-file-card,
  #fa-chat-root .fa-chat-audio-player,
  #fa-chat-root .fa-chat-pdf-card,
  #fa-chat-root .fa-chat-media-video {
    max-width: 76vw;
  }

  #fa-chat-root .fa-chat-pdf-preview {
    height: 170px;
  }

  #fa-chat-root .fa-chat-recording {
    grid-template-columns: auto auto minmax(0,1fr);
  }

  #fa-chat-root .fa-chat-recording button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #fa-chat-root .fa-chat-bubble-wrap {
    max-width: 84%;
  }

  body.fa-chat-open .mobile-bottom-nav {
    display: grid!important;
  }
}
