* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { background: #d1d7db; display: flex; justify-content: center; align-items: center; min-height: 100vh; }

.chat-app { width: 100%; max-width: 400px; height: 100vh; max-height: 850px; background: #efeae2; display: flex; flex-direction: column; position: relative; overflow: hidden;}
@media (min-width: 450px) { .chat-app { height: 90vh; border-radius: 12px; } }

.chat-header { background: #008069; color: white; padding: 10px 15px; display: flex; align-items: center; gap: 12px; z-index: 10; }
.profile-pic { width: 40px; height: 40px; background: #dfe5e7; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.2rem; }
.header-info h2 { font-size: 1.1rem; font-weight: 500; }
.header-info p { font-size: 0.8rem; color: #d9fdd3; }

#telaLogin { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 30px; background: white; text-align: center; z-index: 20; position: absolute; width: 100%; height: 100%; }
#telaLogin h3 { color: #111b21; margin-bottom: 10px; font-size: 1.4rem; }
#telaLogin input { width: 100%; padding: 14px; border: 1px solid #d1d7db; border-radius: 8px; font-size: 1rem; margin-bottom: 15px; background: #f0f2f5; outline: none;}
.btn-start { background: #008069; color: white; border: none; padding: 14px; width: 100%; border-radius: 8px; font-size: 1.05rem; font-weight: bold; cursor: pointer; }

#telaChat { display: none; flex-direction: column; height: 100%; background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png'); background-size: contain; flex: 1; overflow: hidden; }
.chat-history { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }

.message { max-width: 85%; padding: 6px 8px 16px 10px; border-radius: 8px; font-size: 0.95rem; line-height: 1.3; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,0.1); cursor: pointer; user-select: none; transition: 0.2s; min-width: 100px; }
.message:active { opacity: 0.8; } 
.msg-user { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 0; }
.msg-agent { background: #ffffff; align-self: flex-start; border-top-left-radius: 0; }
.msg-content { word-wrap: break-word; margin-bottom: 2px; }
.msg-time { font-size: 0.65rem; color: #667781; align-self: flex-end; position: absolute; bottom: 4px; right: 8px; }
.msg-media img, .msg-media video { max-width: 100%; border-radius: 8px; margin-bottom: 5px; }

.quote-box { background: rgba(0,0,0,0.05); padding: 6px 10px; border-left: 4px solid #00a884; margin-bottom: 6px; font-size: 0.85rem; border-radius: 4px; color: #667781; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.quote-author { color: #00a884; font-weight: bold; font-size: 0.75rem; margin-bottom: 2px; }

#replyBox { display: none; background: #f0f2f5; padding: 8px 10px 8px 15px; margin: 0; border-left: 4px solid #00a884; border-radius: 0; font-size: 0.85rem; color: #667781; position: relative; box-shadow: 0 -2px 5px rgba(0,0,0,0.05); }
#replyText { display: block; max-height: 40px; overflow: hidden; text-overflow: ellipsis; margin-top: 4px;}
#btnFecharReply { position: absolute; right: 10px; top: 10px; background: none; border: none; cursor: pointer; color: #8696a0; font-size: 1.2rem; }

#attachMenu { display: none; position: absolute; bottom: 70px; left: 15px; background: white; border-radius: 16px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); padding: 15px; z-index: 100; flex-direction: column; gap: 15px; }
.attach-item { display: flex; align-items: center; gap: 15px; cursor: pointer; font-size: 1rem; color: #111b21; }
.attach-icon { width: 45px; height: 45px; border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; font-size: 1.3rem; }
.icon-cam { background: #d3396d; }
.icon-vid { background: #00a884; }
.icon-doc { background: #5f66cd; }

.chat-input-area { padding: 10px; display: flex; align-items: flex-end; gap: 8px; position: relative; background: transparent; }
.input-wrapper { flex: 1; background: #fff; border-radius: 24px; padding: 5px 15px; display: flex; align-items: center; box-shadow: 0 1px 1px rgba(0,0,0,0.1); gap: 5px; min-height: 48px;}
.input-wrapper input { flex: 1; border: none; outline: none; font-size: 0.95rem; background: transparent; padding: 8px 0; }

.btn-action { width: 48px; height: 48px; border-radius: 50%; border: none; background: #00a884; color: white; display: flex; justify-content: center; align-items: center; cursor: pointer; font-size: 1.3rem; flex-shrink: 0; transition: 0.2s; }
.btn-send { display: none; }

.btn-mic {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    outline: none;
}

.btn-mic.recording { background: #ea0038; animation: pulse 1s infinite; }
.btn-icon { background: transparent; color: #8696a0; border: none; font-size: 1.5rem; cursor: pointer; display: flex; padding: 5px; }

#emojiContainer { display: none; position: absolute; bottom: 70px; left: 10px; right: 10px; z-index: 100; box-shadow: 0 5px 15px rgba(0,0,0,0.2); border-radius: 8px; overflow: hidden; background: white; }
emoji-picker { width: 100%; height: 300px; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }