:root {
  color-scheme: light;
  --ink:          #172033;
  --muted:        #6a7282;
  --line:         #dfe4eb;
  --bg:           #f5f7fb;
  --panel:        #ffffff;
  --primary:      #176b87;
  --primary-dark: #0f4f63;
  --danger:       #b42333;
  --sent:         #d9f7d0;
  --received:     #ffffff;
  --shadow:       0 18px 48px rgba(23,32,51,.12);
  --chat-bg:      #e5ddd5;
  --radius-msg:   14px;
}
*{box-sizing:border-box}
[hidden]{display:none!important}

body{
  margin:0;min-height:100vh;
  background:linear-gradient(180deg,rgba(255,255,255,.86),rgba(245,247,251,.96)),
             radial-gradient(circle at 30% 0%,rgba(23,107,135,.16),transparent 34%),var(--bg);
  color:var(--ink);font-family:system-ui,-apple-system,'Segoe UI',Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
a{color:var(--primary);overflow-wrap:anywhere;text-decoration-thickness:1px;text-underline-offset:3px}
button,input,textarea{font:inherit}
button{cursor:pointer}

/* ── Login ──────────────────────────────────────────── */
.login-page{display:grid;place-items:center;padding:24px;min-height:100vh;
  background:linear-gradient(135deg,#f7fafc,#e9f1f4)}
.login-shell{width:min(100%,440px)}
.login-panel{background:var(--panel);border:1px solid var(--line);border-radius:12px;
  box-shadow:0 18px 46px rgba(23,32,51,.08);display:grid;gap:28px;padding:32px}
.eyebrow{margin:0 0 6px;color:var(--primary);font-size:12px;font-weight:700;
  letter-spacing:.08em;text-transform:uppercase}
h1,h2,p{margin-top:0}
h1{margin-bottom:10px;font-size:28px}
h2{margin-bottom:16px;font-size:18px}
.muted{color:var(--muted);line-height:1.5}

/* ── Forms ──────────────────────────────────────────── */
.form-stack{display:grid;gap:14px}
label{display:grid;gap:7px;color:#2d3748;font-size:14px;font-weight:700}
input,textarea{width:100%;border:1px solid var(--line);border-radius:8px;padding:11px 13px;
  background:#fff;color:var(--ink);outline:none}
textarea{resize:vertical;min-height:50px;max-height:160px}
input:focus,textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(23,107,135,.14)}

/* ── Buttons ─────────────────────────────────────────── */
.primary-button,.secondary-button,.danger-button,.ghost-button,.icon-button{
  display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:8px;
  min-height:42px;padding:0 16px;font-weight:700;text-decoration:none;
  transition:transform .14s,background .14s,box-shadow .14s}
.primary-button:hover,.secondary-button:hover,.danger-button:hover,.ghost-button:hover,.icon-button:hover{transform:translateY(-1px)}
.primary-button{background:var(--primary);color:#fff;box-shadow:0 10px 20px rgba(23,107,135,.18)}
.primary-button:hover{background:var(--primary-dark)}
.secondary-button,.ghost-button,.icon-button{background:#eef3f6;color:var(--ink)}
.danger-button{background:#fff0f1;color:var(--danger)}
.purge-btn{background:#fff0f1;color:#7b0000;border:1px dashed #f5c0c0}
.form-error{min-height:20px;margin:0;color:var(--danger);font-size:14px}

/* ── Topbar (dashboard) ──────────────────────────────── */
.topbar{position:sticky;top:0;z-index:5;display:flex;align-items:center;justify-content:space-between;
  gap:14px;min-height:64px;padding:12px 22px;
  background:linear-gradient(90deg,#16213e,#14384c);color:#fff;
  box-shadow:0 4px 20px rgba(22,33,62,.22)}
.topbar span{display:block;margin-top:2px;color:rgba(255,255,255,.72);font-size:13px}
.topbar-actions{display:flex;align-items:center;gap:10px}
.topbar .ghost-button{background:rgba(255,255,255,.12);color:#fff}

/* ── Dashboard Layout ────────────────────────────────── */
.dashboard-layout{display:grid;grid-template-columns:340px 1fr;gap:16px;padding:16px}
.sidebar{display:grid;align-content:start;gap:16px}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:10px;
  box-shadow:0 2px 12px rgba(23,32,51,.06);padding:18px}
.sidebar .panel:first-child{border-top:4px solid var(--primary)}
.section-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.conversation-list{display:grid;gap:8px;margin-top:12px}
.conversation-item{display:grid;gap:4px;width:100%;padding:12px;border:1px solid var(--line);
  border-radius:8px;background:#fff;text-align:left;
  transition:border .14s,background .14s,transform .14s}
.conversation-item:hover{transform:translateY(-1px);border-color:rgba(23,107,135,.36)}
.conversation-item.active{border-color:var(--primary);background:#f0f8fa}
.conversation-item span{color:var(--muted);font-size:12px}
.chat-workspace{min-width:0}
.empty-state{display:grid;place-items:center;min-height:360px;padding:32px;text-align:center;
  color:var(--muted);border:1px dashed #c8d3dc;border-radius:10px;background:rgba(255,255,255,.62)}
.full-page{min-height:100vh}
.conversation-panel{display:grid;gap:0;border:1px solid var(--line);border-radius:10px;
  overflow:hidden;background:var(--panel);box-shadow:0 2px 20px rgba(23,32,51,.08)}
.conversation-header{display:grid;grid-template-columns:1fr 130px;gap:16px;align-items:start;
  padding:16px 18px;border-bottom:1px solid var(--line);background:#fafcfe}
.conversation-header h1{font-size:20px;margin-bottom:4px}
.qr-box{display:grid;place-items:center;border:1px solid var(--line);border-radius:8px;
  padding:6px;background:#fff}
#qrContainer canvas,#qrContainer img{border-radius:4px}
.action-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center;
  padding:12px 18px;border-bottom:1px solid var(--line);background:#f8fafb}
.toggle{display:inline-flex;align-items:center;gap:8px;min-height:42px;padding:0 12px;
  border:1px solid var(--line);border-radius:8px;background:#fff;cursor:pointer;font-weight:700}
.toggle input{width:auto}

/* ── Dashboard: área de mensagens ────────────────────── */
.messages-shell{display:flex;flex-direction:column;min-height:300px;max-height:calc(100vh - 420px)}
.typing-status{min-height:26px;padding:6px 14px 0;color:var(--muted);font-size:12px;font-style:italic}
.messages{flex:1;display:flex;flex-direction:column;gap:6px;overflow-y:auto;
  padding:14px;background:var(--chat-bg);scroll-behavior:smooth}
.messages::-webkit-scrollbar{width:4px}
.messages::-webkit-scrollbar-thumb{background:rgba(0,0,0,.18);border-radius:2px}

/* ── Bolhas de mensagem ───────────────────────────────── */
.message{max-width:78%;padding:7px 11px 5px;border-radius:var(--radius-msg);
  line-height:1.45;overflow-wrap:anywhere;font-size:14px;
  box-shadow:0 1px 2px rgba(0,0,0,.12);position:relative}
.message.admin,.message.mine{align-self:flex-end;background:var(--sent);border-bottom-right-radius:4px}
.message.visitor{align-self:flex-start;background:var(--received);border-bottom-left-radius:4px}
.msg-name{display:block;font-size:11px;font-weight:700;color:var(--primary);margin-bottom:2px}
.msg-body{margin:0 0 2px;white-space:pre-wrap}
.message-meta{display:flex;align-items:center;justify-content:flex-end;gap:6px;
  margin-top:3px;font-size:11px;color:rgba(0,0,0,.45)}
.msg-status{font-size:12px;color:var(--primary)}
.message-action{border:0;padding:0;background:transparent;color:var(--primary);
  font-size:11px;font-weight:700;cursor:pointer;white-space:nowrap}
.message-reply{display:grid;margin-bottom:6px;border-left:3px solid var(--primary);
  border-radius:6px;padding:6px 10px;background:rgba(23,107,135,.08);font-size:12px}
.message-reply strong{color:var(--ink);margin-bottom:2px;display:block}
.message-reply span{color:var(--muted);overflow-wrap:anywhere}
.chat-banner{text-align:center;font-size:12px;color:var(--muted);padding:6px 14px;
  background:rgba(0,0,0,.06);border-radius:20px;align-self:center;margin:4px 0}

/* ── Media & download ────────────────────────────────── */
.message-media{display:block;width:min(100%,280px);max-height:320px;margin:4px 0;
  border-radius:8px;object-fit:contain;background:#0f172a}
.media-wrapper{display:flex;flex-direction:column;gap:4px;margin:4px 0;max-width:min(100%,280px)}
.media-loading{display:flex;flex-direction:column;gap:6px;padding:10px 12px;
  background:rgba(23,107,135,.06);border:1px solid var(--line);border-radius:8px}
.media-load-bar{height:4px;background:var(--line);border-radius:2px;overflow:hidden}
.media-load-fill{height:100%;width:0%;background:var(--primary);border-radius:2px;transition:width .1s}
.media-load-label{font-size:12px;color:var(--muted)}
.download-btn{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--line);
  border-radius:6px;padding:4px 10px;background:#fff;color:var(--primary);font-size:12px;
  font-weight:700;cursor:pointer;transition:border-color .14s,background .14s;align-self:flex-start}
.download-btn:hover{border-color:var(--primary);background:#f0f8fa}

/* ── Visualização única ───────────────────────────────── */
.view-once-btn{display:flex;align-items:center;gap:10px;background:rgba(23,107,135,.08);
  border:1.5px solid rgba(23,107,135,.3);border-radius:12px;padding:12px 16px;
  cursor:pointer;color:var(--primary);font-weight:700;transition:background .2s}
.view-once-btn:hover{background:rgba(23,107,135,.16)}
.view-once-btn:disabled{opacity:.6;cursor:wait}
.view-once-icon{font-size:22px;line-height:1}
.view-once-btn small{display:block;font-size:11px;font-weight:400;color:var(--muted)}
.view-once-placeholder{display:flex;align-items:center;gap:8px;padding:10px 14px;
  border:1.5px dashed var(--line);border-radius:10px;color:var(--muted);font-size:13px}
.view-once-placeholder.viewed{opacity:.7}
.view-once-placeholder.sender{background:rgba(23,107,135,.04)}
.view-once-image{border:3px solid var(--primary);border-radius:10px}
.view-once-notice{font-size:11px;color:var(--muted);font-style:italic;text-align:center}
.view-once-toggle{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;
  color:var(--primary);cursor:pointer;padding:4px 0}
.view-once-toggle input{width:auto;cursor:pointer}

/* ── Progresso de upload ──────────────────────────────── */
.upload-progress{display:flex;align-items:center;gap:10px;padding:7px 10px;
  background:#f0f8fa;border:1px solid var(--line);border-radius:8px;margin-bottom:4px}
.upload-progress-bar{flex:1;height:6px;background:var(--line);border-radius:3px;overflow:hidden}
.upload-progress-fill{height:100%;width:0%;background:var(--primary);border-radius:3px;transition:width .12s}
.upload-progress-label{font-size:12px;font-weight:700;color:var(--primary);min-width:36px;text-align:right}

/* ── Formulário admin (dashboard) ─────────────────────── */
.admin-reply-form{display:grid;gap:6px;padding:12px 16px;border-top:2px solid var(--line);
  background:#fafcfe}
.admin-reply-row{display:flex;gap:8px;align-items:flex-end}
.admin-reply-row textarea{flex:1;min-height:48px;max-height:120px;resize:vertical;border-radius:10px;padding:10px 13px}
.admin-reply-actions{display:flex;gap:6px;align-items:flex-end;flex-shrink:0}
.reply-preview{display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:7px 10px;border-left:3px solid var(--primary);border-radius:6px;
  background:rgba(23,107,135,.08);font-size:12px;color:var(--muted)}
.icon-sm{min-height:28px!important;padding:0 8px!important;font-size:12px}
.file-button{position:relative;font-size:18px;min-height:38px;padding:0 10px;cursor:pointer}

/* ═══════════════════════════════════════════════════════
   CHAT PÚBLICO — layout mobile-first com teclado virtual
   ═══════════════════════════════════════════════════════

   Estratégia:
   - body.public-chat usa display:flex + height controlado por JS
     (Visual Viewport API: body.style.height = visualViewport.height)
   - Quando o teclado abre, o JS atualiza a altura e o flex layout
     empurra o input bar para cima automaticamente
   - SEM position:fixed no body (interferiria com a atualização de height)
   ═══════════════════════════════════════════════════════ */

html:has(body.public-chat) {
  height: 100%;
  overflow: hidden;
}

body.public-chat {
  /* window.innerHeight (JS) sobrescreve este valor logo no load */
  height: 100dvh;
  /* CRÍTICO: sobrescreve min-height:100vh do estilo base do body,
     que estava empurrando o input bar para fora da tela */
  min-height: 0 !important;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--chat-bg);
}

/* ── Topbar ──────────────────────────────────────────── */
.chat-topbar {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 56px;
  padding: 0 14px;
  background: linear-gradient(90deg, #128c7e, #0d7268);
  color: #fff;
  box-shadow: 0 2px 8px rgba(18,140,126,.3);
  z-index: 10;
}
.chat-topbar-info       { flex: 1; min-width: 0; }
.chat-topbar-info strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.typing-status-inline {
  display: block;
  font-size: 12px;
  color: rgba(255,255,255,.85);
  font-style: italic;
  min-height: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Overlay de identificação ────────────────────────── */
.name-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.4);
  padding: 20px;
}
.name-card {
  background: #fff;
  border-radius: 16px;
  padding: 26px 22px;
  width: min(100%, 360px);
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.name-card h2           { font-size: 20px; margin-bottom: 6px; }
.name-card p            { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.name-card input        { border-radius: 10px; font-size: 16px; padding: 12px 14px; }
.name-card .primary-button {
  width: 100%;
  background: linear-gradient(90deg, #128c7e, #0d7268);
  border-radius: 10px;
  min-height: 46px;
  font-size: 15px;
}

/* ── Área de mensagens (scroll) ──────────────────────── */
.chat-body {
  flex: 1;
  min-height: 0;           /* crucial: permite shrink abaixo do tamanho natural */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px 6px;
  background: var(--chat-bg);
}
.chat-body::-webkit-scrollbar       { width: 3px; }
.chat-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 2px; }

/* Mensagens no chat público */
.chat-body .message {
  max-width: 82%;
  font-size: 15px;
  padding: 7px 11px 5px;
}
.chat-body .message.mine    { align-self: flex-end;   background: var(--sent); border-bottom-right-radius: 4px; }
.chat-body .message.admin,
.chat-body .message.visitor { align-self: flex-start; background: #fff;        border-bottom-left-radius:  4px; }
.chat-body .msg-name        { font-size: 12px; margin-bottom: 2px; }
.chat-body .message-media   { width: min(100%, 240px); }
.chat-banner {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 14px;
  background: rgba(0,0,0,.07);
  border-radius: 20px;
  align-self: center;
  margin: 4px 0;
}

/* ── Barra de input ───────────────────────────────────── */
.chat-input-bar {
  flex-shrink: 0;            /* nunca some — fica sempre no fim do flex */
  background: #f0f2f5;
  padding: 7px 10px;
  padding-bottom: max(7px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid rgba(0,0,0,.09);
  z-index: 10;
}
.chat-reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  border-left: 3px solid #128c7e;
  border-radius: 6px;
  background: rgba(18,140,126,.1);
  font-size: 12px;
  color: var(--muted);
}
.chat-icon-btn {
  background: rgba(0,0,0,.1);
  border: 0;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  line-height: 1;
}
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}
.chat-attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,.06);
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  transition: background .15s;
}
.chat-attach-btn:hover  { background: rgba(0,0,0,.12); }
.chat-textarea {
  flex: 1;
  border: none;
  border-radius: 20px;
  padding: 9px 14px;
  background: #fff;
  font-size: 15px;
  resize: none;
  min-height: 36px;
  max-height: 96px;
  outline: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  line-height: 1.4;
  overflow-y: auto;
}
.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  flex-shrink: 0;
  background: linear-gradient(135deg, #128c7e, #0d7268);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(18,140,126,.4);
  transition: transform .14s, opacity .14s;
}
.chat-send-btn:hover    { transform: scale(1.06); }
.chat-send-btn:active   { transform: scale(.92); }
.chat-send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }


/* ── Avatar redondo (topbar e formulário) ─────────────── */
.topbar-avatar-wrap { flex-shrink: 0; }
.topbar-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; border: 2px solid rgba(255,255,255,.35);
  display: block;
}
.topbar-avatar-ph {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.2); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; border: 2px solid rgba(255,255,255,.3);
  flex-shrink: 0;
}
.topbar-icon-btn {
  background: rgba(255,255,255,.15); border: 0; color: #fff;
  border-radius: 50%; width: 30px; height: 30px; font-size: 14px;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.topbar-icon-btn:hover { background: rgba(255,255,255,.28); }

/* ── Avatar no formulário de nome ─────────────────────── */
.avatar-upload-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar-preview {
  width: 60px; height: 60px; border-radius: 50%;
  background: #e8f4f2; border: 2px solid #128c7e;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; overflow: hidden; flex-shrink: 0;
}

/* ── Avatar nas mensagens (dashboard) ─────────────────── */
.msg-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  align-self: flex-end; margin-right: 4px;
  border: 1px solid var(--line);
}
.message { display: flex; flex-direction: row; flex-wrap: wrap; }
.message.visitor { flex-direction: row; }
.message.admin   { flex-direction: row-reverse; }
/* Mantém o conteúdo do bubble em coluna */
.message > *:not(.msg-avatar) { flex: 1; min-width: 0; }

/* ── Minimizar ───────────────────────────────────────── */
body.public-chat.minimized .chat-topbar,
body.public-chat.minimized .chat-body,
body.public-chat.minimized .chat-input-bar { display: none !important; }
.minimize-bubble {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  width: 56px; height: 56px; border-radius: 50%;
  background: #128c7e; color: #fff;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(18,140,126,.45);
  font-size: 24px; border: 2px solid rgba(255,255,255,.35);
  overflow: hidden; cursor: pointer;
}
.minimize-bubble img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* JS controla hidden; este é o estado exibido: */
.minimize-bubble:not([hidden]) { display: flex; }

/* ── Lightbox ────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.92);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.lightbox.open { display: flex; }
.lightbox-inner { position: relative; max-width: 100%; max-height: 100%; }
.lightbox-img {
  display: block;
  max-width: min(100%, calc(100vw - 32px));
  max-height: calc(100dvh - 80px);
  border-radius: 8px; object-fit: contain;
}
.lightbox-close {
  position: absolute; top: -14px; right: -14px;
  background: rgba(255,255,255,.2); border: 0; color: #fff;
  border-radius: 50%; width: 30px; height: 30px; font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,.35); }

/* ── Mensagem apagada (visitante) ────────────────────── */
.msg-delete-btn {
  background: none; border: none; cursor: pointer;
  font-size: 13px; opacity: 0; transition: opacity .2s;
  padding: 2px 4px; color: var(--muted);
  position: absolute; bottom: 4px; right: 4px;
}
.message:hover .msg-delete-btn { opacity: 1; }
.message { position: relative; }

.msg-deleted { color: var(--muted); font-style: italic; font-size: 13px; margin: 2px 0; }
.msg-deleted-wrap { opacity: .75; }
.msg-deleted-inner { flex: 1; }

/* ── Perfil admin (dashboard sidebar) ─────────────────── */
.admin-profile { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.profile-avatar-wrap { flex-shrink: 0; }
.profile-avatar {
  width: 62px; height: 62px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--line); display: block;
}
.profile-avatar-ph {
  width: 62px; height: 62px; border-radius: 50%;
  background: #eef3f6; border: 3px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--muted);
}


/* ── Topbar do chat: sem título, só avatar + typing ──── */
.topbar-typing {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: rgba(255,255,255,.88);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Botão apagar mensagem — visível no toque (mobile) ── */
/* ── Avatar do UE no cabeçalho da conversa (dashboard) ── */
.conv-header-main {
    display: flex;
    align-items: center;
    gap: 14px;
}
.conv-guest-avatar-wrap { flex-shrink: 0; }
.conv-guest-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--line);
    display: block;
}
.conv-guest-avatar-ph {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #eef3f6;
    border: 3px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--muted);
}


/* ── Alinhamento definitivo no chat público ─────────── */
.chat-body .message.mine {
    align-self: flex-end !important;
    background: var(--sent) !important;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: var(--radius-msg);
}
.chat-body .message.admin,
.chat-body .message.visitor {
    align-self: flex-start !important;
    background: #fff !important;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: var(--radius-msg);
}


/* ══ Mensagens: footer e botões ════════════════════════ */

/* Footer dentro do bubble: reply à esquerda, hora+status à direita */
.msg-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}
.msg-meta-right {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: rgba(0,0,0,.45);
    flex-shrink: 0;
    white-space: nowrap;
}
.reply-btn {
    border: 0;
    padding: 2px 7px;
    background: rgba(0,0,0,.06);
    color: var(--primary);
    font-size: 12px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.reply-btn:hover { background: rgba(23,107,135,.15); }

/* Botão apagar — FORA do bubble, irmão de msg-content */
.msg-delete-btn {
    flex-shrink: 0;
    align-self: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
    opacity: 0.6;
    transition: opacity .15s, color .15s;
}
.msg-delete-btn:hover { opacity: 1; color: var(--danger); }

/* Alinhamento definitivo no chat público */
.chat-body .message.mine {
    align-self: flex-end !important;
}
.chat-body .message.mine .msg-content {
    background: var(--sent);
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: var(--radius-msg);
}
.chat-body .message.admin .msg-content,
.chat-body .message.visitor .msg-content {
    background: #fff;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: var(--radius-msg);
}
/* Mine: bubble não tem background proprio (está em msg-content) */
.chat-body .message.mine,
.chat-body .message.admin,
.chat-body .message.visitor {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}
.msg-content {
    padding: 7px 11px 5px;
    border-radius: var(--radius-msg);
    line-height: 1.45;
    overflow-wrap: anywhere;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
    max-width: 100%;
}

@media(max-width:900px){
  .dashboard-layout{grid-template-columns:1fr}
  .conversation-header{grid-template-columns:1fr}
  .qr-box{justify-self:start}
  .messages-shell{max-height:45vh}
}
@media(max-width:620px){
  .topbar{align-items:flex-start;padding:12px}
  .dashboard-layout{padding:10px;gap:10px}
  .login-panel,.conversation-panel,.panel,.name-panel{padding:14px}
  .conversation-header{padding:12px 14px}
  .action-row{padding:8px 14px}
  .admin-reply-form{padding:8px 12px}
  .admin-reply-row{flex-direction:column;align-items:stretch}
  .admin-reply-actions{justify-content:flex-end}
  .message{max-width:90%}
  .messages-shell{max-height:40vh}
}
