* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #111b21;
}

/* --- Login --- */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-box { background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); width: 320px; }
.login-box h1 { font-size: 20px; margin-bottom: 20px; color: #075e54; }
.login-box input { width: 100%; padding: 10px; margin-bottom: 12px; border: 1px solid #ddd; border-radius: 6px; }
.login-box button { width: 100%; padding: 10px; background: #075e54; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; }
.login-box button:hover { background: #064e45; }
.error { color: #d32f2f; margin-bottom: 12px; font-size: 14px; }

/* --- App layout --- */
.app { display: flex; height: 100vh; }
.sidebar { width: 320px; background: #fff; border-right: 1px solid #e0e0e0; display: flex; flex-direction: column; }
.sidebar-header { padding: 16px; background: #075e54; color: #fff; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.logout-link { color: #d1f0ec; font-size: 12px; font-weight: 400; text-decoration: none; }
.logout-link:hover { text-decoration: underline; }

#conversation-list { flex: 1; overflow-y: auto; }
.conversation-item { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.conversation-item:hover { background: #f5f5f5; }
.conversation-item.active { background: #e9edef; }
.conv-name { font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.conv-preview { font-size: 13px; color: #667781; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-badge { background: #25d366; color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 10px; }

.chat-panel { flex: 1; display: flex; flex-direction: column; background: #efeae2; }
.chat-header { padding: 16px; background: #f0f2f5; border-bottom: 1px solid #e0e0e0; font-weight: 600; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.empty-state { color: #999; text-align: center; margin-top: 40px; font-size: 14px; padding: 20px; }

.msg { max-width: 60%; padding: 8px 12px; border-radius: 8px; font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.msg-in { align-self: flex-start; background: #fff; }
.msg-out { align-self: flex-end; background: #d9fdd3; }
.msg-time { font-size: 10px; color: #999; margin-top: 4px; text-align: right; }
.msg-status-failed { color: #d32f2f; font-size: 11px; margin-top: 2px; }

.chat-input-area { display: flex; padding: 12px; background: #f0f2f5; gap: 8px; }
#message-input { flex: 1; padding: 10px 14px; border-radius: 20px; border: 1px solid #ddd; outline: none; }
#send-btn { padding: 10px 20px; background: #075e54; color: #fff; border: none; border-radius: 20px; cursor: pointer; font-weight: 600; }
#send-btn:hover { background: #064e45; }
#send-btn:disabled { background: #999; cursor: not-allowed; }
