body { 
    font-family: 'Segoe UI', sans-serif; 
    margin: 0; 
    display: flex; 
    height: 100vh; 
    background: #e5ddd5; 
    overflow: hidden; 
}

/* Sidebar & Mobile drawer */
#side { 
    width: 320px; 
    background: white; 
    border-right: 1px solid #ddd; 
    display: flex; 
    flex-direction: column; 
    transition: 0.3s; 
    z-index: 100; 
}
.sidebar-header { 
    padding: 15px; 
    background: #eee; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid #ddd; 
}
#user-list { 
    flex: 1; 
    overflow-y: auto; 
}
.user-item { 
    padding: 15px; 
    cursor: pointer; 
    border-bottom: 1px solid #f2f2f2; 
    display: flex; 
    align-items: center; 
    transition: 0.2s; 
}
.user-item:hover { background: #f9f9f9; }
.user-item.active { background: #e9ebd4; }
.status-dot { margin-right: 10px; font-size: 14px; }
.online { color: #25D366; } 
.offline { color: #bbb; }

/* Chat Window */
#main { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    background: #efe7dd; 
    position: relative;
    height: 100dvh; 
    width: 100%;
    overflow: hidden;
}

#chat-header { 
    padding: 15px; 
    background: #eee; 
    border-bottom: 1px solid #ddd; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-weight: bold;
    flex-shrink: 0; 
}

#msg-box { 
    flex: 1; 
    overflow-y: auto; 
    padding: 20px; 
    display: flex; 
    flex-direction: column;
    min-height: 0; 
}

#input-area {
    flex-shrink: 0;
    background: #f0f0f0;
    padding: 10px;
    padding-bottom: env(safe-area-inset-bottom, 10px); 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    border-top: 1px solid #ddd;
}

/* Bubbles */
.msg { 
    margin-bottom: 10px; 
    padding: 8px 12px 18px 12px; 
    border-radius: 8px; 
    max-width: 75%; 
    position: relative; 
    word-wrap: break-word; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1); 
}
.sent { background: #dcf8c6; align-self: flex-end; border-top-right-radius: 0; }
.rcvd { background: white; align-self: flex-start; border-top-left-radius: 0; }
.timestamp { position: absolute; bottom: 3px; right: 8px; font-size: 10px; color: #888; }
.sender-tag { font-size: 10px; font-weight: bold; color: #075E54; display: block; margin-bottom: 2px; }

#chatInput { flex: 1; padding: 10px 15px; border-radius: 20px; border: 1px solid #ddd; outline: none; }
.btn-icon { cursor: pointer; font-size: 20px; user-select: none; }

/* Mobile Adjustments */
@media (max-width: 768px) {
    #side { position: fixed; left: -320px; height: 100%; box-shadow: 2px 0 10px rgba(0,0,0,0.1); }
    #side.open { left: 0; }
    .mobile-only { display: block !important; }
}
.mobile-only { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }

/* Modals & Overlays */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.card { background: white; padding: 25px; border-radius: 10px; width: 300px; text-align: center; }
.card h2 { margin-top: 0; color: #075E54; }
.card input { width: 100%; padding: 10px; margin: 8px 0; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; }
.card button { width: 100%; padding: 10px; margin-top: 10px; border-radius: 5px; border: none; background: #25D366; color: white; font-weight: bold; cursor: pointer; }
.secondary-btn { background: #999 !important; }
.logout-btn { background: #e74c3c !important; margin-top: 15px !important; }

.version-tag { 
    display: block; 
    text-align: right; 
    font-size: 10px; 
    color: #d3d3d3; 
    margin-top: 8px; 
    user-select: none; 
}